fdmfdm at January 15th, 2013 15:24 — #1
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.....
fireside at January 15th, 2013 20:49 — #2
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:
rouncer at January 15th, 2013 23:18 — #3
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 at January 16th, 2013 03:10 — #4
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 at January 16th, 2013 03:53 — #5
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 at January 16th, 2013 06:44 — #6
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 at January 16th, 2013 07:09 — #7
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 at January 16th, 2013 13:28 — #8
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 at January 25th, 2013 00:10 — #9