Good language to develop a game server in?

前端 未结 15 1224
悲哀的现实
悲哀的现实 2021-02-01 08:50

I was just wondering what language would be a good choice for developing a game server to support a large (thousands) number of users? I dabbled in python, but realized that it

15条回答
  •  盖世英雄少女心
    2021-02-01 09:16

    I might be going slightly off-topic here, but the topic interests me as I have (hobby-wise) worked on quite a few game servers (MMORPG servers) - on others' code as well as mine. There is literature out there that will be of interest to you, drop me a note if you want some references.

    One thing that strikes me in your question is the want to serve a thousand users off a multithreaded application. From my humble experience, that does not work too well. :-)

    When you serve thousands of users you want a design that is as modular as possible, because one of your primary goals will be to keep the service as a whole up and running. Game servers tend to be rather complex, so there will be quite a few show-stopping bugs. Don't make your life miserable with a single point of failure (one application!).

    Instead, try to build multiple processes that can run on a multitude of hosts. My humble suggestion is the following:

    • Make them independent, so a failing process will be irrelevant to the service.
    • Make them small, so that the different parts of the service and how they interact are easy to grasp.
    • Don't let users communicate with the gamelogic OR DB directly. Write a proxy - network stacks can and will show odd behaviour on different architectures when you have a multitude of users. Also make sure that you can later "clean"/filter what the proxies forward.
    • Have a process that will only monitor other processes to see if they are still working properly, with the ability to restart parts.
    • Make them distributable. Coordinate processes via TCP from the start or you will run into scalability problems.
    • If you have large landscapes, consider means to dynamically divide load by dividing servers by geography. Don't have every backend process hold all the data in memory.

    I have ported a few such engines written in C++ and C# for hosts operating on Linux, FreeBSD and also Solaris (on an old UltraSparc IIi - yes, mono still runs there :). From my experience, C# is well fast enough, considering on what ancient hardware it operates on that sparc machine.

    The industry (as far as I know) tends to use a lot of C++ for the serving work and embeds scripting languages for the actual game logic. Ah, written too much already - way cool topic.

提交回复
热议问题