Good language to develop a game server in?

2019-03-09 13:27发布

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 would just be too much trouble since it doesn't spawn threads across cores (meaning an 8 core server=1 core server). I also didn't really like the language (that "self" stuff grossed me out).

I know that C++ is the language for the job in terms of performance, but I hate it. I don't want to deal with its sloppy syntax and I like my hand to be held by managed languages. This brings me to C# and Java, but I am open to other languages. I love the simplicity of .NET, but I was wondering if, speed wise, this would be good for the job. Keep in mind since this will be deployed on a Linux server, it would be running on the Mono framework - not sure if that matters. I know that Java is syntax-wise very similar to .Net, but my experience with it is limited. Are there any frameworks out there for it or anthing to ease in the development?

Please help me and my picky self arrive on a solution.

UPDATE: I didn't mean to sound so picky, and I really don't think I was. The only language I really excluded was C++, Python I don't like because of the scalability problem. I know that there are ways of communicating between processes, but if I have an 8 core server, why should I need to make 8 processes? Is there a more elegant solution?

15条回答
做个烂人
2楼-- · 2019-03-09 13:54

The obvious candidates are Java and Erlang:

Pro Java:

  • ease of development
  • good development environments
  • stability, good stack traces
  • well-known (easy to find experienced programmers, lots of libraries, books, ...)
  • quite fast, mature VM

Pro Erlang:

  • proven in systems that need >99.9% uptime
  • ability to have software updates without downtime
  • scalable (not only multi-core, but also multi-machine)

Contra Erlang:

  • unfamiliar syntax and programming paradigm
  • not so well known; hard to get experienced programmers for
  • VM is not nearly as fast as java

If your game server mainly works as a event dispatcher (with a bit of a database tucked on), Erlang's message-driven paradigm should be a good match.

In this day and age, I would not consider using an unmanaged language (like C or C++); the marginal performance benefits simply aren't worth the hassle.

查看更多
成全新的幸福
3楼-- · 2019-03-09 13:54

What are your objectives? Not the creation of the game itself, but why are you creating it?

If you're doing it to learn a new language, then pick the one that seems the most interesting to you (i.e., the one you most want to learn).

If it is for any other reason, then the best language will be the one that you already know best and enjoy using most. This will allow you to focus on working out the game logic and getting something up and running so that you can see progress and remain motivated to continue, rather than getting bogged down in details of the language you're using and losing interest.

If your favorite language proves inadequate in some ways (too slow, not expressive enough, whatever), then you can rewrite the problem sections in a more suitable language when issues come up - and you won't know the best language to address the specific problems until you know what the problems end up being. Even if your chosen language proves entirely unsuitable for final production use and the whole thing has to be rewritten, it will give you a working prototype with tested game logic, which will make dealing with the new language far easier.

查看更多
三岁会撩人
4楼-- · 2019-03-09 13:57

More details about this game server might help folks better answer your question. Is this a game server in the sense of something like a Counter Strike dedicated server which sits in the background and hosts multiplayer interactions or are you writing something which will be hosted on an HTTP webserver?

Personally, if it were me, I'd be considering Java or C++. My personal preference and skill set would probably lead me towards C++ because I find Java clumsy to work with on both platforms (moreso on Linux) and don't have the confidence that C# is ready for prime-time in Linux yet.

That said, you also need to have a pretty significant community hammering on said server before performance of your language is going to be so problematic. My advise would be to write it in whatever language you can at the moment and if your game grows to be of sufficient size, invest in a rewrite at that time.

查看更多
登录 后发表回答