Online Games in China have been developing for many years, and the selection of development languages has gradually changed, c To C ++ to C ++ Python or C ++ Lua many companies have started to use Erlang, Java, and C #. At present, it is a colorful situation.
However, if you want to create a new online game server without considering compatibility with the company or existing things, how do you choose? I have thought about this question carefully and may have to consider the following aspects:
1. Whether the language library is complete.
If C ++ or C is used, I think many things have to be rewritten by myself. The written things may not be correct yet. Time-consuming and labor-consuming. In addition, some game server's indispensable functions, such as ORM, cannot be implemented using C.
2. Language development efficiency
A good ide can greatly improve development efficiency. C # vs Java eclipse is very good. Python, Lua, and Erlang ide support is very weak, C & C ++ Compilation speed is too slow, leading to a lower development speed than other languages
3. Is the language easy to use and good recruitment.
C ++ has extremely high requirements on developers. It is difficult to recruit and expensive. There are too few people using Erlang, Python, and Lua.
4. Whether the language fault tolerance is good.
C & C ++ is difficult to avoid coredump. Once the server fails, the user experience will be significantly reduced, but the loss is money. In addition, C ++ is difficult to hot update, which can be easily implemented by Python Lua C # Erlang. If a small bug occurs, the logic can be updated without restarting the server, it is vital for distributed online game servers
5. Is the language well supported by asynchronous syntax?
In a distributed server architecture, there must be a large amount of interaction between the server and the server. Because the game logic is difficult to split into multiple threads, it is generally a single logic thread + asynchronous Remote Call. Therefore, the asynchronous syntax of the language is indispensable.
C language asynchronous support is very poor, it is difficult to do, C ++ has Lambda STD: bind STD: function limited support, it is still difficult to write a large number of asynchronous logic, in addition, the C ++ callback method disconnects the logic. Both Python and Lua have similar coroutine support. C # supports async await, C # supports the WCF framework, and remote calls are the same as local calls. Java Asynchronization is also hard to write. Erlang is a distributed language by nature.
6. Select windows Linux as the server
Linux is free, Windows requires a purchase, Linux maintenance personnel are difficult to find, the price is high, Windows Maintenance personnel are more convenient to find, the price is slightly cheaper. It is hard to find users who develop Linux programs, and the price is high. Windows developers are everywhere.
C # If you want to use WCF, you can only develop it on Windows. If you don't use WCF, Mono can run C #
In fact, Windows Server and Visual Studio authorization are less expensive than developers' salaries. If your game requires a lot of Windows servers, you probably won't care about the money.
7. Dynamic or static Language
C & C ++ C # Java is a static language, and Python Lua is a dynamic language. The majority of problems can be found during static language compilation. The dynamic language needs to run that step to discover bugs. Static languages need to be compiled, and the compilation speed of C & C ++ is really unbearable. Java and C # are fine, but dynamic languages do not need to be compiled. Another advantage of Python Lua is that it can be hot-updated, which can be done by C.
8. Language Performance
Python has poor performance. However, for distributed server, the language performance may not be so important. It is enough for a process to support 1000 people.
So in summary, I will select Windows platform C #.