Jump to content
  • Advertisement
Sign in to follow this  
LEPT0N

Multiplayer Pong

This topic is 4344 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

Hey everyone, I'm trying to make a 2D multiplayer game that can be played over LAN. After looking around it seems like openTNL would be great to use, however I haven't found any good tutorials / example code to show how to use openTNL. I basically just want to be able to have a networked gameworld across LAN, and the user would never have to input IP addresses, games would be broadcasted to any other client in shouting distance. So first off, is OpenTNL the kind of thing I'd want for this? I've heard it's very nice and powerful, but how's the learning curve? And also, are there any nice tutorials for this sort of thing? I've searched around GameDev and openTNL's site and haven't found anything that's helped me much. Thanks for any Help!

Share this post


Link to post
Share on other sites
Advertisement
If I may, I suggest that you start learning to program multiplayer games with something other than pong. Pong is a real-time game, and as such is very difficult to make work. You should probably start out with something turn-based, until you have a solid understanding of networking, as synchronisation of real-time environments is a very tricky subject.

Share this post


Link to post
Share on other sites
Quote:
Original post by swiftcoder
If I may, I suggest that you start learning to program multiplayer games with something other than pong. Pong is a real-time game, and as such is very difficult to make work. You should probably start out with something turn-based, until you have a solid understanding of networking, as synchronisation of real-time environments is a very tricky subject.


I understand that things would be easier in a turn based game, but would multiplayer pong really be that bad over LAN? Simply send out your paddle's position and velocity every frame (or every couple frames) and every frame, read in any messages you got over the network to update your opponent's paddle? I know it's most likely more difficult than I'm making it sound, but it's what I want to do. I understand what you're saying, it's just not for me :P

Anyone else?

Share this post


Link to post
Share on other sites
Quote:
Original post by LEPT0N
I understand that things would be easier in a turn based game, but would multiplayer pong really be that bad over LAN? Simply send out your paddle's position and velocity every frame (or every couple frames) and every frame, read in any messages you got over the network to update your opponent's paddle? I know it's most likely more difficult than I'm making it sound, but it's what I want to do. I understand what you're saying, it's just not for me :P


it depends if your want peer-to-peer, or server based pong, if it is peer-to-peer: don't forget that the messages take time to arrive (not as much on a LAN, but it is still an issue). So when your message arrives, it applies to some time in the past, but affects the world at the current time, so the two players will get further and further out of sync, until eventually the ball goes right through one players paddle, because the other players computer thinks it is somewhere else.

Server based pong is easier (and I recommend this as the way to go for your first attempt), as the server always has the authoritative game state, and the clients are just dumb-terminals, sending input to the server and receiving positional data back.

Share this post


Link to post
Share on other sites
Well yes, that's all in the implementation details. server/client would probably be the way to go. However that still leaves the fact that I still need to find some tutorial on openTNL or something similar to get me started :P

Share this post


Link to post
Share on other sites
hhe, sorry that I can't help with your learning, but, I might add a little word for you to consider when you actually write the game, ad it is that you should keep in mind that sending the paddles stats isn't that important, I mean, of course you have to send them for the game to seem uncheated to the players, but, the most important thing would be to send the balls postition and speed (direction) after the paddle hits it, and the client will just calculete each frame from there, instead of sending the data each frame (of course that you have to make sure that the message arrives, and also, you should be careful about unsinchronization issues). About the paddles.. just send their position/action/speed(direction) (depending on how you decide to implement it) whenever it changes but without worrying about making that data reliable.
I assume that you have realized that I'm talking about UDP here, I'm not sure of what TNL uses..

So! I hope this helps you when the time comes (and I hope to be righ about this, however, anyone intrested in proving that I'm wrong is welcome to argue with me).

PS: hmhm, are you sure TNL doesn't include some help/tutorials/demo files?

Share this post


Link to post
Share on other sites
Allright, now I just spent the few seconds to google for documentation for OpenTNL (which you should do before posting, next time).

This would seem to be the most relevant result (and also the first): OpenTNL Documentation
There is quite a bit of information, and plenty of instructions for beginners.

Share this post


Link to post
Share on other sites
Quote:
Original post by swiftcoder
Allright, now I just spent the few seconds to google for documentation for OpenTNL (which you should do before posting, next time).


You know what assuming does... :P

I already saw that site, but the documentation and tutorials were too generalized and I thought weren't good for beginners like me. I came on here after searching Google to see if anyone here knew of other OpenTNL tutorials.

Share this post


Link to post
Share on other sites
If u cant find any tutorials i would consider a book theyre always the best for beginning things, look in your local library or buy one.

Share this post


Link to post
Share on other sites
Quote:
Original post by LEPT0N
I already saw that site, but the documentation and tutorials were too generalized and I thought weren't good for beginners like me. I came on here after searching Google to see if anyone here knew of other OpenTNL tutorials.
Welcome to lesson #1 of becoming a good programmer: Picking up APIs with crappy documentation. [smile]

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!