asteroids, shots!
ok im planning out how im going todo multiplayer in my asteroids clone ( 2d ). i have decided to: *send the current coord of the center POINT and the angle, ( i can then work out all of the other points, not that i need to, that will be done on the client ) *and send the x and y speeds and the clients moventment keys. ( so the client can predict where the ship will move ) *any bullets that the ship shot but im not sure how i would handle the bullets. i would have the x,y and angle but i think i would need some sort of time stamp? please give any suggestions
-www.freewebs.com/tm1rbrt -> check out my gameboy emulator ( worklog updated regularly )
and also what sort of packets a second should i sending?
-www.freewebs.com/tm1rbrt -> check out my gameboy emulator ( worklog updated regularly )
The Forum FAQ talks about how to form different packets. Asteroids really isn't that different from, say, Unreal, Half-Life or Quake 3, so the links for those games should work fine for you.
In brief, you probably want to send position, heading, and velocity for your ships and asteroids, and position and velocity for your shots (because they are likely heading-less). "velocity" is a 2D vector, and "position" is a 2D point. You might want to also send a time-stamp for each network packet, to make forward extrapolation smoother, or you can just time-stamp on receipt at the other end. Typically, a time stamp in milliseconds since start of game is quite sufficient. Make sure to adjust clocks continually as they may drift apart otherwise.
In brief, you probably want to send position, heading, and velocity for your ships and asteroids, and position and velocity for your shots (because they are likely heading-less). "velocity" is a 2D vector, and "position" is a 2D point. You might want to also send a time-stamp for each network packet, to make forward extrapolation smoother, or you can just time-stamp on receipt at the other end. Typically, a time stamp in milliseconds since start of game is quite sufficient. Make sure to adjust clocks continually as they may drift apart otherwise.
enum Bool { True, False, FileNotFound };
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement