Archived

This topic is now archived and is closed to further replies.

yaroslavd

Air Hockey Online

Recommended Posts

I want to make an online air hockey game. I decided to have the server broadcast the game info (all the players'' positions, table color, etc.) to the clients with UDP. I''m going to serialize the GameInfo object, send it as bytes to the clients and deserialize it in the client application. I''m also wondering what I should use for client->server communication. The client needs to send the server its position and velocity. I''m pretty sure I should use UDP, but I''m not COMPLETELY sure. Can anyone tell me if I''m doing this the right way? BTW, I''m using Java.

Share this post


Link to post
Share on other sites
I dunno what you mean about broadcasting all the players positions. There are only 2 players so you only need to send the opponent''s position/velocity to each player.

Things like colors don''t need to be sent except in the initialization. Let the clients figure out how to display stuff.

I really don''t think air hockey at true speeds is viable on the net. But if you have a slow motion game it could work.

Share this post


Link to post
Share on other sites
quote:
Original post by 5010
I dunno what you mean about broadcasting all the players positions. There are only 2 players so you only need to send the opponent''s position/velocity to each player.

Things like colors don''t need to be sent except in the initialization. Let the clients figure out how to display stuff.

I really don''t think air hockey at true speeds is viable on the net. But if you have a slow motion game it could work.


Well, actually I''m gonna implement it so more than two players could play. For example, six players can play in a hexagonal arena. Also, I know that I''ll only need to send the color once, I was just trying to make my post simple.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Barring a congested network, on a normal day i''ve seen on average a 1.2% packet loss ( those are packets which arrive very late or dont make it at all. Late is defined as 2x ping. )

-ddn

Share this post


Link to post
Share on other sites
So in other words, I should use UDP and not TCP for server->client, right? That''s what I thought, but I got flamed for asking that at another forum. And what should I use for the client->server? UDP or TCP?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Use udp for all non-critical time sensitve packets, both ways. Reserve tcp for the critcial packets, like protocol, chat, etc..

Hope that helps.

-ddn

Share this post


Link to post
Share on other sites
So basically, I should just use UDP for everything, right? I mean at 30+ fps, I don''t really care if it skips one, right? Except maybe for the game over msgs or something, those are important.

Sound good?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
that''s the way to go.

In these days of cable modems, sending updates 30x sec won''t be a problem, bandwith wise. But you''ll find that even though you send a packet every frame, the client will not recive those packets on a regualr interval as they were sent. For smooth motion you will have to create some interperaltion code. This will reduce the number of packets down to say 10x sec, and produce smoother motion.

You should experiement on this and try to solve the problem, it will give u some good exp.

Good Luck!

ddn

Share this post


Link to post
Share on other sites