Air Hockey Online

Started by
9 comments, last by yaroslavd 20 years, 8 months ago
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.
Advertisement
Am I approaching this problem the right way?
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.
-solo (my site)
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.
UDP is good and quick. I don''t see anything wrong with that. Just don''t expect all the messages to make it.
-solo (my site)
What percentage of messages should be expected to make it?

Also, I heard that some routers block UDP. Should I be concerned about that?
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
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?
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
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?

This topic is closed to new replies.

Advertisement