View Single Post
GLaDOS GLaDOS's Avatar

JCF Member

Joined: Aug 2010

Posts: 40

GLaDOS is doing well so far

Oct 3, 2013, 05:24 PM
GLaDOS is offline
Reply With Quote
The solution to bullet desync is not related to the protocol they're sent on; TCP vs. UDP is nothing but a tradeoff between delay and loss. I think bullets are sent over TCP, due to the way they "stack up" and get shot all at once during lag spikes.
It's a combination of two issues within the protocol: bullet velocities being calculated from local player velocities (which may vary across server/clients) instead of being sent with the "bullet shot" packet, and seekers moving towards players' local player positions (strongly desynced by extrapolation and packet timing inconsistencies).

To eliminate airhits, bullet velocities could be added to the packet that is sent when a player fires. To deal with seekers, the server could send the position of all (nearby) seeker bullets every few frames and let the clients extrapolate from there. This would preferrably happen over UDP. I have no idea how difficult it is to introduce new packets to JJ2's protocol, but these two changes should reduce the frequency of airhits by quite a bit, at least in low to moderate packet loss conditions.
It may be necessary to take AngelScript into account here (perhaps by adding a function that disables syncing for specific bullet types), as some levels might manipulate bullets client-side in some way for gameplay or visual effects.

3HKs are the result of player health not being updated reliably in some way, but I'm not sure where exactly the problem is located (health packets over UDP? Unusual client side condition needed for health update?), since I haven't looked too much into the protocol. The solution would be to periodically update player health, perhaps over TCP. Again, it requires protocol updates; hopefully it's doable.