Jump to content
  • Advertisement
Sign in to follow this  
element2001

help me decide on 1st multiplayer game

This topic is 4973 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'm thinking of making my first multiplayer game. I can't decide between a pong clone or turn based game based on programming requirements for the network code. Allow me to explain. I've heard that for action based movement you need to have prediction in order for it to work. I have no idea how to implement this. I was thinking for the pong clone I could just send where the paddle moves to for example when the player pushes the right arrow key that makes the paddle move right at some velocity. And just send using TCP the velocity(speed and direction) but not the position (except in the beginning) Hope this isn't confusing... But what about lag? if I need prediction for lag and I have no idea how to do that maybe I should just make a turn based game instead. So has anyone here made a multiplayer action game without prediction and would it work even with some lag? Am I getting myself in way over my head trying to make a pong clone and should I stick to a simpler turn based game or is an action game like pong multiplayer possible without getting too complicated with prediction and what not? I know how to send data back and forth so I don't need help with that, I've made a simple chat program for example but it's turn based and not realtime, know what I mean?

Share this post


Link to post
Share on other sites
Advertisement
I don't have a terrible amount of experience yet, but as far as prediction goes, Pong is really simple. You can determine exactly where the ball at any point in time between paddle hits. So as far as ball data, you only hve to send ball data once every time the ball strikes a paddle, sending only it's speed and direction (it's location is implicit, since it's position as it struck the paddle is known already by both parties).

To calculate the ball's position at any point in time is more of a Physics/Math problem. First, you take the ball's position and ray trace it, taking into account of any walls it hits. Then once you have the path the ball will travel, multiply the local game time by the ball's most recent velocity. That will give you the positive distance the ball has traveled along the path.

The paddle netcode would seem to present slightly greater freedom. The simplest solution would be to send a packet containing the paddle location every time a user moved it. If you wanted to go another step, you could cache several movement commands and then send a packet containing the cache at regular intervals. IE: every time the paddle is moved, add it to a list. Then, every X seconds, send the list of commands over the network.

About your turn-based chat, are you using Standard Input? Standard Input makes it impossible to create a decent looking chat program. Use a GUI. And if you know how, put your networking code into a seperate thread. That way, you don't have to worry about sockets your game code. They can sit and wait all they want in their own happy little thread.

If you can manage to program pong without networking, you shouldn't have too much trouble adding networking. The prediction is very limited. Perhaps the most difficult part of the game would be handling collisions and reflections.

Share this post


Link to post
Share on other sites
Tac Tics thanks for the response. The chat program is in opengl, so yes it is GUI based. I was going to just send the data for the game the same way as the chat text, only with special code prefixes that tell it not to display it as text but to read it as movement game code. I know that's kind of simplistic, but it would work right?

Share this post


Link to post
Share on other sites
http://pages.infinit.net/cbenoi1/NetPong.zip

It should give you an idea of the components and messages exchanged.

-cb

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!