Jump to content
  • Advertisement
Sign in to follow this  
walle

Learning by doing...

This topic is 4815 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I would like to learn multiplayer game making. I thought about making a simple pong clone multiplayer. But I don't really know how to do this. If we do this the simplest possible you have to do: Send the paddle1, paddle2 and ball coordinates to the clients. That's it? I would like to be able to both host and join a game in an aplication, not like in all tutorials I've seen where you build a server whitch you have to run separatly. Would it be simplest to make a packet struct with all coordinates and just send it to both clients? Or would you have a packet struct for each object? I'm doing this in SDL_Net I think. //walle

Share this post


Link to post
Share on other sites
Advertisement
Well, I just got started with this myself, but my game is coming along nicely so I will try and answer your questions.

Quote:

If we do this the simplest possible you have to do:
Send the paddle1, paddle2 and ball coordinates to the clients. That's it?


Yes, thats all you have to do to get teh paddle coordinates to the clients, however, if you are doing client-server type system where the server does all the work, you will have to send a packet from the client to the server with all of the input data so the server can respond accordingly.

Quote:

I would like to be able to both host and join a game in an aplication, not like in all tutorials I've seen where you build a server whitch you have to run separatly.


If you have an option to host the game yourself, you could just make your game run the server in the background and run the client program on the same computer. Just connect to yourself (I.P. 127.0.0.1) and it will be the same as having 2 clients and no server(and a lot simpler IMHO). If you dont want to do that however, look into client-client architecture. I dont know of any really good Client-Client tutorials, so you may have to try a lot of crap before you get it right.

Quote:

Would it be simplest to make a packet struct with all coordinates and just send it to both clients? Or would you have a packet struct for each object?


Dont really know about that one. In my game I send the client's player's packet info first, then use a for loop to send everyone elses.

Anyways, good luck.

Share this post


Link to post
Share on other sites
If you want to get fun with this, it should be possible to only send the ball's coordinates at game start, and from there let each client make the decision as to where it should go given the paddle information. To keep things on the level, I'd also throw in a quick synchronizing function to verify the ball is in the same place for both clients("server" instance can do this). This should remove some overhead, and would probably be fun to code, at least for me, since I'm a network code kinda guy.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!