Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am trying to develop a multiplayer rts game. My question here is: which language is best suited for the server side of that game? My very first choices wolud be lower level languages, such as C++ or Java, but I'm afraid I'll have to pay way more than what I can afford for the hosting of a server app written in said languages. (Can you suggest me a free host for developing (or should I use my home PC?) and a cheap one for the first months of deployment?)

PHP at first seemed ok, but then I realized I needed an idle process running even as no user is connected and no pages are being requested. Although I managed to work around some of the issues related to this problem with AJAX requests, I still feel very limited about what I can do with this language; PLUS, even hosting the server locally with Wamp, I have very limited FPS, and the loop on the client which costantly pools the server does it at very unregular intervals (but this may be fault of the way I wrote the client...). Still, I belive that's not what PHP was meant for.

As regards the client, I'd like my game to be a browsergame, for the sake of semplicity (auto-updates, no dowloads and installations needed, portability), probably written in HTML5 (no complex 3d graphics) or flash, but if I have to fall back to a good old standard app in Java or C++ I guess I'll be fine anyway.

share|improve this question

closed as off-topic by Byte56 Jul 11 '13 at 13:08

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions that are about "which tech to use" are outside the scope of the site. For more information, see this meta post" – Byte56
If this question can be reworded to fit the rules in the help center, please edit the question.

1  
This site is not for questions about which technology to use. Just pick something you like and when you get stuck, come back and ask again. –  sm4 Jul 11 '13 at 12:02

3 Answers 3

up vote 1 down vote accepted

If your game is an RTS (and not turn based), you are going to need a server and a client system that are geared towards fast communication.

This makes environments like PHP, and methods like AJAX unsuitable.

PHP because, as you said, it's not meant for this and because you will undoubtedly run into performance issues, and AJAX, because it is designed as a system that generally doesn't care how long it takes to complete a request or to post data, but only cares if the message arrives or not within a long timeout.

To write your game server, you're probably best off with a full blown programming language like JAVA or C++, (fun fact, Java is a high level language).

To keep the communication lightweight and fast, use websockets (though these are TCP, and may still be too slow for you).

Alternatively, you could use UDP by leveraging Flash, using a datagramsocket

If you're going to go down this road, and your home internet connection has some decent bandwidth, you should be fine running the server from your home.

share|improve this answer
    
Websockets are not fully supported on all browsers so this might not be the best way to go. Also, javascript is browser dependant so making it work on every browser is hard. –  Thomas Jul 11 '13 at 10:45
1  
There are frameworks such as Socket.IO that use a fallback system just for those cases. see socket.io/#browser-support –  Timothy Groote Jul 11 '13 at 10:46
    
I know java, being an interpreted language, is considered "high level", but still not as high as PHP. Anyway I think I'll go for Java, it's the one I know best, and there's the possibility of me creating an Android version in the future. –  Riccardo Vailati Jul 11 '13 at 11:32
    
An android version of the server? Keep in mind that your server and client do not have to be the same language ;) good luck! –  Timothy Groote Jul 11 '13 at 12:40

Java and C++ are not a low level language?

Anyway, html5 is not really suited for multiplayer games since not all browsers support tcp sockets in html5. You could use ajax, but most webservers are stateless, so keeping track of statefull 'parts' of the game like a player inventory or player stats would require a lot of database read / writes.

Also, the framerates / javascript loop intervals on clients might differ causing player 1 to update on a different frequency then player 2.

That said, id go for either java or C# to produce the server. I would host it on my own pc or a small home server (using NAT) for development and testing purposes. When you find your game to be well enough you can go with an external server. If you use C# you could use Azure to put the server in the cloud and have extreme and global scaling available.

You could consider using phonegap to port a javascript client to all mobile devices, but i'm not sure how to implement tcp socket connections in this case.

My advice in short:

Don't use html5 or php for the client, make a native app

Use java or C# for the server

Develop on your own computers for as long as you can

Try to get people to like it before putting it on an external server

share|improve this answer
2  
Java is high level, C++ is intermediate level. –  Timothy Groote Jul 11 '13 at 10:44
    
Mostly sound advice, C# being a little easier to write than C++. I would advise against phonegap though, it's terribly slow, and there are javascript game frameworks that run way faster by cutting out the need for a WebView (like impact.js). –  Timothy Groote Jul 11 '13 at 10:50
    
ASM < C < C++ Java < Python < Haskell < God –  Zhen Jul 11 '13 at 12:14
1  
@Zhen i would disagree, but let's not go there ;p –  Timothy Groote Jul 17 '13 at 14:37
1  
@TimothyGroote +1 indeed –  Zhen Jul 17 '13 at 20:40

I've seen several games with 1M+ active users daily that use a Flash front-end and have Ruby on the server side.

Most of these applications have a database in the background and scaling horizontally in that aspect is very important as you'll want to be able to handle a large user base.

I've also seen games running PHP on the serverside, it won't matter as much what you use. Get it running first and optimize later. Hopefully by then you'll be making money and you'll be able to scale properly so the server-side code of things won't matter.

UPDATE:

Additionally with PHP, should your code ever become a bottleneck you can use hip-hop that will translate the code into C++.

share|improve this answer
    
-1. Php and flash are great for simple turn based games. For real time games it's not that suitable. I've seen a big studio struggle creating multiplayer flash games. –  Thomas Jul 11 '13 at 10:44

Not the answer you're looking for? Browse other questions tagged or ask your own question.