Game server general questions

Hi! I was hoping to learn more about how game servers are chosen/implemented. I understand how to write basic TCP/UDP server/client programs in java. I’m more interested in how this would be applied in industry to make a functional server.

To make a server accepting clients (with the example of a game perhaps):

  1. Do game developers buy/rent servers and simply upload a java program onto it?

  2. Is a server for this type of application basically a regular computer just running a java program 24/7?

  3. Would Apache Tomcat be used for something like this? (Basically in my searches I have found things like Tomcat and I don’t understand how they fit into the picture. Does a server run Tomcat which enables you to run your java-server-program?)

  1. If you don’t have your own dedicated computer to use a server, then yup that’s simply it.

  2. Yup :slight_smile:

  3. Apache Tomcat is to be used for Java servlets, aka mostly HTTP stuff. If you want to run a custom Java app that listens on its own port, then you don’t need Tomcat. You only want a computer that can run Java 24/7 without problems. :wink:

Ah I see, thanks a lot! That clears things up.

I guess the only advantage of using a real server compared to a dedicated computer would be efficiency then? I’d imagine that servers would have the OS and stuff stripped down since that is their primary function. Or are all servers fully functioning computers in essence, easily able to add java (if you wanted to)?

Big servers are usually much more powerful, with tonnes of ram, loads of CPU cores, and a very fast internet connection. Most of them do also run special linux distros, but I don’t think there’s anything stopping you from downloading one yourself for a standard desktop, If you want that little extra bit of efficiency, but I’m not sure whether it would benefit you.

Also, keep in mind that many IPS frown on people hosting their own servers without paying for the extra data/setup for it. For a small box, it shouldn’t be too much of an issue, but if you expect hundreds of hits a day, it could be an issue.

Thanks all I think I think it finally makes sense! ;D

Also thanks for the extra tips those will certainly come in handy

  1. Depending on the project and the requirements we might use virtual or dedicated servers. Some at work some examples might be Amazon EC2, Softlayer. I have a personal VM on Chunkhost that works great as well.

  2. Yes. You can probably get a long way during development just hosting on your own home machine if you want to save costs, but at some point you will end up needing dedicated hosting.

  3. You could use Tomcat, but for realtime games, I would recommend something like Electroserver 5 which is really designed for making multiplayer games and has support for a variety of client platforms, including Java.

Moderator note: this member is a developer of the advised product.

Electrotank seems good. They are even also support Unity and iFamily.

Thanks for the advice, but it would be nice if you disclosed your conflict of interest with electrotank. Especially when consulting a beginner. :frowning:

It’s not a “conflict” of interest so much as merely an interest, and yes that’s always a good idea when talking about commercial products.

Electrotank doesn’t look like my cup of tea, but it certainly does look interesting. Never thought I’d see the day when MUD infrastructure would become proper SaaS.

Normally I wouldn’t mind recommending a product, but looking through his post history shows that he’s a developer or at least affiliated with the company.

Just look at his profile, where he states his website to be

IMHO, his shameless plugs are borderline acceptable. I’ll leave it at that.

Upon further research, it seemed that 4 out of 4 of his posts in 2012 were plugs to his product. The links have been removed, as JGO will not be abused as a platform to spam. Other than that, the posts are not modified.

That’s what I mean by saying he has an interest. “Conflict of interest” is a little more loaded, implying something much more adversarial, and he didn’t have an existing duty to impartiality … I’m just nitpicking on shades of meaning here, don’t mind me. Disclosing one’s own commercial interests really is still the best policy.

I had a hard time painting the picture of what a server really is. It’s so simple it’s confusing. A Server, low and behold, is a computer.

Your desktop PC or laptop can function as a server - what does that mean “function as a server”. It means that your computer of choice is connected to a network (for example, the internet) and that a program is run on that computer that listens for incoming connections (like a java application you’ve built). That’s it.

It doesn’t even have to be connected to a network, you can run a server locally and have programs on the same computer talk to each other. ( Which is where 99% of the debugging occurs during development. ).

So what are “webservers”? What does a server that hosts a website look like??

Simple. It’s a computer that listens for incoming data, just like ALL servers. What makes it “different” from other servers is how it interprets the data it is being sent and how it responds. Ie, the protocol. You might have heard of HTTP before. It stands for Hypertext Transfer Protocol.

A Protocol is just a fancy word for a set of agreed upon rules people came up with. These rules are vital, because EVERYTHING you send is in bytes, ie, ones 1 and zeroes 0.


The above bits can be interpreted in lots of ways. It can represent the character ‘@’ or the number ‘64’ for instance, or perhaps a color. Or perhaps the 2 first bits are supposed to represent the x coordinate, the following 2 bits the y coordinate, and the last 4 bits the player score. If we don’t know WHAT the bytes are SUPPOSED to represent (What is agreed before-hand), we have NO chance of making sense of it.

What happens when you open up your music player and you try to play an image file? Most likely the music player would complain that it can’t make sense of the bytes, or that it needs a codec ( Ie, a set of rules of how bytes are supposed to be read in order to convert it into music ). This is why files are littered with “suffixes” like .mp3 or .gif etc. They’re CLUES for the operating system to know which program should be opened to interpret the data. Suffixes have nothing to do with the contents itself. The content in reality is just a bunch of 1’s and 0’s, no matter if it’s music, images, text, movies, whatever.

Try opening a music/image file with notepad (or text editor of choice). That’s what you get when you misinterpret bytes.

This is why protocols and a set of agreed upon rules are absolute key in anything computer related. No matter if it’s over a network or not.

Now you might think you could host your java servers on a simple webserver or website, but that’s probably not the case. Since web hosts come in many different shapes. Some hosts give you access to your very own computer to use ( expensive ), some a virtual machine ( cheaper ) and some gives you only access to common website tasks (limited, cheap) where you can host a website but you can’t actually run any of your own programs/servers (most free/paid website/blog hosting).

My 2 cents.


I just wanted to take a minute to apologize personally if it was in any way unclear that I am one of the developers of Electroserver. It certainly was not my intention to obscure that. I generally explicitly mention that if I mention our product but alas, this time i seem to have forgotten to include it. I believe that information was also available in my profile, but I am not 100% sure there.

In any case, the only reason I mentioned it was because you mentioned Tomcat. Tomcat is excellent software which I use extensively, but HTTP based servers are generally not the best choice for realtime games. I am of course making an assumption that you are interested in that type of game.

Hope that helps!

Edit: removed abnormal amount of whitespace from end of post.


I have no issue with removal of any links. I have no interest in traffic, links or anything of that nature. My interest and passion is multiplayer gaming and Java. I think a review of my entire posting history on JGO ( instead of last 4 posts ) would make that abundantly clear.