I started to enter the page game industry in 2012, and the first game project I came into contact with was Moore Manor by Taomee. At that time, the company had just been listed on THE NYSE. Under the influence of Benson, Wei Zhen and Rock and Tencent, I was making favorite games… (Later in my work, I often meet a lot of post-00s colleagues who come up to me and say, Jack, I grew up playing with the Moore Manor and the Ship you made before, blah blah blah… Shame, I am old or you grow too fast…) Later, I went to another team to play the game, but no matter how, after so many years of server development, the main code of server development is still C++, in addition to historical reasons, performance problems are the main problem.
Basically, the whole development of the game from project approval to the upper limit, the server is considering how to reduce memory occupancy, prevent memory exhaustion; The server is considering increasing stability and the maximum number of people supported by a single server. There is a very buggy problem with scripting language, debugging is difficult to control. Few plans pay attention to performance issues, and it’s easy to end up with a variety of cards. No wonder they focus on the logic of the game rather than the technical aspects. However, I know that garbage collection mechanisms such as C#,Java, and Lua can easily cause congestion when recollecting memory.
Server-side development by overseas developers
I’ve had the opportunity to work with overseas developers. I’ve worked with developers from well-known studios like ironhide, Games Workshop, MadFinger Games, and they’ve wisely avoided the cumbersome language of C++, Ironman’s Kingdom series was developed in Flash, Games WorkShop’s Warhammer 40K was developed in JS, and many of their Games were developed on The GameSparks platform, which has a rich SDK. It allows developers to focus only on their own business logic without caring about the underlying network libraries, databases, multi-threading and caching. I have been in touch with the development of MadFingerGames’ Unkilled product, which mainly uses Java and uses Google’s GAE platform for direct service distribution. (If readers are interested, you can leave a message in the background or at the end of the article, we can exchange some technology of the overseas developers you are interested in, and their framework platform selection)
Why are the major domestic game companies still using C++
In fact, the use of C++ is the norm in the domestic end game industry. In the domestic page tour mobile tour small team can not Hold.
Analysis of the reasons may be the following aspects. 1. For historical reasons, the early major domestic game development companies basically wrote game engines in C++. This is probably because there were probably no professional server-side programmers at the time, and a lot of programmers were both client-side and server-side. Writing the client is mostly C++. So it was easier to use the same language and write the server directly in C++ without hiring again. The second possibility was that Java was really immature at the time, and there wasn’t a convincing case in the industry. .net is even more so. The end game industry is another industry that values success stories. One project worked well in C++, and the next one might go on. And that group of people out to start a business, will certainly use their own familiar scheme, so C++ has been handed down. 2. For technical reasons, C++ is really a good language to write servers in.
-
High ceiling
-
Master core technology
-
Ecology and others
The upper limit is high, which means extreme performance. Big companies tend not to adopt low-cap technologies, and TRIPLE-A products are all extreme integrations, like WOW on a scale. The cost and difficulty of development are not big problems for them, but the key functions cannot be realized due to the low ceiling, which is the real problem. Can heap people to solve all is not a matter, afraid of heap people can not solve, such as hardware limitations. If you think about how many big companies in the past don’t even let you use STL virtual functions.
Master core technology. Big companies cannot allow their core technology to be controlled by others. Think about why Huawei developed hongmeng systems. So it’s normal for big companies to make wheels. Even if UE is open source, the big companies will continue to develop their own engines with no choice and money is no object. The core technologies are basically infrastructure, and C++ is the big one.
So based on these 3 points, it is impossible for large companies to use other technologies as core tools, C#, Java and Go fail in performance, Rust fails in ecology.
Most of the time, the bottleneck of the game server is not in CPU, nor is it in IO, but in memory. Game is different from web server, game online player data is stored in memory, database only as a persistent data existence. So the key to limiting the number of people online at the same time on a game server is memory utilization. No language has yet reached the same level of memory utilization as C/C ++. Therefore, for some games with few simultaneous online and little interaction, it doesn’t matter what language they use, but for games with more than 1000 simultaneous online users and strong interaction, they basically choose c++.
Here are a few examples to make my argument more convincing (note I’ve been talking about large projects) :
- Naughty Dog developed several big titles using Object LISP and then switched back to traditional methods (C, C++) due to SONY’s ecological concerns.
2. Ubisoft has a title called General-Programmer, who basically covers both the front end and the back end as well as other aspects. (Yes, THAT’s where I started.)
3. Most aaa mobile games are made in C++. For example, the current UE4 mobile terminal shares most technologies with the same engine. Before Android didn’t have NDK, there were no AAA games on Android. As mobile development becomes more like PC development, sharing becomes even more advantageous.
4. Microsoft has abandoned the XNA framework and returned to native development, pushing pure C# for large game development is still not up to now. (The exact reason was not disclosed by a source)
5. Even Unity uses IL2CPP to generate native. One is performance, the other is the cost of porting the Mono back end (and of course there are other reasons like licensing). For a large engine, the cost of maintaining its own toolchain (which is still only run time) away from upstream is still very high.
6. Choose Java or GO as the server, all want to use them to do the ecology of the Web backend. Big companies have their own C++ ecosystem, so big companies use C++ better, small companies may not be the same, can only embrace the web lap.
Disadvantages of C++ write server
If you’ve ever written node.js, python, or PHP and you’ve occasionally regretted writing C++ all the time,No, I lost my hair.
-
Writing logic in C++ is anti-human, with N times more code for the same function (compare that to node.js, which can write a whole bunch of business logic in four or five lines of code).
-
A bug in C++ logic is a bug that can core your set of servers. The project team is big + even the most awesome people will also have a brain, the online server at any time there is a risk of core drop.
-
In the early days of mobile games, it was a seller’s market, and when your game died, my players had no other games to play. Later, it was a buyer’s market. If your game failed, I only had to pay a small cost, and THEN I changed to another game with similar quality as yours. So the hot update has become a large factory end vernier. How to hot update pure C++ server? So you’ll hear a lot of old pure C++ writers on the server that the only way to get hot updates is to quickly restart the server.
Why are there teams hiring C++
Let’s take a look at the heart of the traditional C++ terminal game team: team expansion, to recruit some business logic dogs. C++ logic programs are so damn hard to hire, low paid programmers live all day core, high paid programmers don’t want to do business logic dogs. How to do? Change to change. Worried about performance? Then I don’t change the IO thread, still use C++; AOI does not change, still use C++. The logical thread main loop is still running C++, but python/lua is encroachment on more and more logical modules. Performance impact is not particularly big, slowly C++ that piece of code no one dares to move and no one wants to move. What’s worse, hire a big factory who has used Bigworld to be the “architect”, refer to PPT lectures leaked by big factory, and build a set of gate that can be hot expanded. In front of DB, there is also a set of proxy that can be hot expanded, and cooperate with the split line. Is the performance problem still a problem?
This is the majority of the old end game teams in China, so why do they like to ask C++ when recruiting? Because they are familiar with C++ before C++, C++ test is superior to the old C++ programmer, C++ test is easy to read a book Inside C++ Object Model the night before the interview can ask 80%, and then casually look at the new C++ features, can ask another 15%, what is the remaining 5%? Is that the only compiler left? Where’s the business logic dog?
What language can you write a game server in
Ok, so what language should you write the game server in? Just use whatever language you like. Roughly divided into the following categories: the first category. C++ fork some script (C++ &lua more). Advantages: Generally is a large factory position, strong technical accumulation. Disadvantages: the bottom part can not be touched. Do you dare to change the code even if it exists? Many of them have been running online for several years. Do you dare to change the code even if you find bugs?
The second category. A server-side development framework for various models. For example, direct Erlang, Skynet of Cloud Wind, Pinus or Pomelo of netease. Pros: Most game server programmers are more traditional and only consider the logic thread +IO thread principle. Although they have never used actors, they just feel that mmos are not suitable for actors. But the goal of a programmer is to learn new things, so you can get away from the unmotivated programmers and into the motivated ones. Cons: Basically limited to working in Guangzhou, Hangzhou, Xi ‘an (and possibly other cities).
The third kind. Game server development platforms like Photon, Playfab, GamesParks, GAE, etc. Advantages: Developers do not need to pay attention to the underlying library network, caching, load, you just need to focus on their own game logic, most platforms can be based on the server pressure horizontal extension, these platforms can provide some players data storage, list, match, multiplayer, GM, hot update configuration and some business logic, and language development is essentially js, Java, Some even need to be configured directly in the background, and it is easy to switch from dev to PROd. Disadvantages: part of the service charge is relatively high, and the free trial period is short, for large projects to use the early cost is not small.