online multiplayer tutorial?

fdmfdm 101 Jan 15, 2013 at 20:24

does anyone know a good tutorial for making a online multiplayer game?
there is this strategygame im playing, and i want to make a simulator of one part of the game, to train working together with others,
the issue is that i can make the game easy enough, but dont know how to make a online multiplayer game :(
i have looked around, and i saw some tutorials, but they are usually very focussed on 1 type of game, and not on making the online part, they usually just give you that…..

8 Replies

Please log in or register to post a reply.

fireside 141 Jan 16, 2013 at 01:49

It gets pretty complicated because you have to set up a server or possibly a bank of servers. There are companies that provide the service like Player.IO:…games-tutorial/

rouncer 104 Jan 16, 2013 at 04:18

my advice is you should probably work more tcp-ip lan like based, rather than online straight away. just get tcp-ip working for 2 computers at once (even on the net) then move from there.

Just dont go tackle the 100 simultanious players right at the start. :)

jbadams 102 Jan 16, 2013 at 08:10

You’re asking about a very broad topic, and the ideal solution is often very different depending on the type of game you’re trying to make. It’s unlikely that you’ll find much in the way of tutorials.

fdmfdm 101 Jan 16, 2013 at 08:53

hmm rouncer, will that work for 4 or 8 computers?
the game im simulating would be fine with 4 - 6 or 8 players, 2 however would not be enough

TheNut 179 Jan 16, 2013 at 11:44

As rouncer said, focus first on learning the ins and outs of socket programming, then work on incorporating that into your game. Beej’s Guide to Network Programming is a good starting point. It will cover most of what you need to know. I also recommend reading Microsoft’s MSDN code pages on the various socket functions just so you understand the inputs and outputs better, including certain limitations and to handle all types of errors that can occur.

Once you get the gist of socket programming, you need to learn about asynchronous programming. If you’re not up to par with this, you should learn about threads and various thread patterns (task scheduling, thread pooling, event/delegate pattern).

After completing the above, you should start thinking about creating your own protocol, on top of TCP/IP or UDP. By now you should know what those two are and how you should use them. Your games however will need a format of their own, something your code can parse and extract data from. HTTP is an example of a protocol built on top of TCP/IP. Once you define your protocol, you will need to create all the possible packets that can be sent and received for your game, and then build a packet handler to manage that. This is where you will need to think about a good design to put all the pieces together.

Finally, you will have to think about latency and synchronization, network prediction, and protocol compression. I haven’t seen these topics covered well, but they are fairly intuitive. At least if you get as far as doing all of the above, you should be able to problem solve these as you go. As you get more experience, these solutions will come more naturally to you.

fdmfdm 101 Jan 16, 2013 at 12:09

okay thanks :)
then i have some work to do XD
i figured this game i was planning would be easy compared to a normal game, as the computer only have to send information 1 time in 30 seconds to tell the moves that are made, as it is a turn based strategy game in which the turns are done at the same time, so the players have 30 seconds to guess what the others will do and put their own moves ready, and then the server asks for the moves and calculates what happens.

fireside 141 Jan 16, 2013 at 18:28

You could also check out SFML if you are working in c or c++. They have a networking library. I think it’s divided, so you don’t have to use the other libraries.

v1technologies 101 Jan 25, 2013 at 05:10