Sending Coordinates Through a Socket To Drive a Real-Time Network Pac-Man Game

I'm creating a two-player Pac-Man game in which one player controls Pac-Man and the other controls a single ghost. While Pac-Man gains points, the ghost loses points. The goal for the ghost is to catch Pac-Man before the points tip in Pac's favor.

All that is in working order.

Now, the coordinates for Pac and the ghost are stored in two x and y integer values each, and what I am attempting to do, but failing, is continually send those quickly changing integer values through a TCP socket and set those values to the coordinates for the ghost or Pac on the opponent's computer, so he/she may see the moves the other player is making in real time.

Any thoughts/suggestions on how I might go about doing this?

Thanks for the help.
[782 byte] By [csnopes] at [2007-11-20 9:34:53]
# 1 Re: Sending Coordinates Through a Socket To Drive a Real-Time Network Pac-Man Game
Given the nature of sockets, and the unpredictability of delays through a network, it will be difficult to achieve anything close to a real-time performance.

You almsot certainly will not achieve it with TCP, which intentionally introduces delays in an effort to increase efficiency in the use of network bandwidth. For example, there is delayed-ACK algorithm, Nagle algorithm etc.

Most games use UDP for time sensitive data. You might have better luck with UDP, but recognize that you lose the reliability and ordering guarantees of TCP, and must therefore supply these yourself.

Mike
MikeAThon at 2007-11-10 2:14:45 >