Advertisement

Physics-based game...network possible?

Started by May 06, 2004 06:34 PM
3 comments, last by EricDB 20 years, 9 months ago
I have a game based on the collisions of balls (discs) in 2 dimensions. Is it possible for such a chaotic system (in the technical sense of being very sensitive to small changes in initial conditions) to work in a networked environment? I''m just curious if it''s flatly impossible, or if there are some established methods of keeping things in sync.
You don''t really need to transmit that much information. Each ball will presumably have a position vector with a magnitude representing velocity and possibly an acceleration vector. The clients would only need to be updated when one client changed the position velocity/acceleration of his ball. Everything else could be predicted client side and then verified through the server which is not very time sensitive.

You can generally expect about 10 server frame updates per second, so as long as the players were not drastically changing the heading of their balls more than 10 times per second it would be pretty much trivial.
Advertisement
I agree with haro. You've hit on an important point with regards to chaos, though. This is a chaotic system, and small deviances in representation will quickly grow to change the system fundamentally. I would suggest locking the framerate, to avoid progressive error resulting from different simulation step sizes. Furthermore, I'd designate one player as maintaining the "official" world state, and having it push the entire world state out to the other player(s) every n seconds, where n is not very large.


"Sneftel is correct, if rather vulgar." --Flarelocke

[edited by - sneftel on May 6, 2004 7:45:13 PM]
You need to make sure they all use the same FPU rounding mode and precision mode; use fnstcw to change it to what you want.

You also need to baseline them, and send deltas between baselines.

There uses a distributed physics simulation that runs 30 steps a second, client/server, with authoritative servers; it seems to work fine (even on a modem).
enum Bool { True, False, FileNotFound };
I don''t think worrying too much about deviation is worthwhile. Your simulation will certianly diverge from client to server - but as long as you have good prediction and interpolation, you can pretty easily smooth things out.

Zap, a 2D vector graphics space game I''m working on uses 2D circle collisions over the network and so far we''ve been able to get some really smooth physics with it. The source is open - you can check it out at www.opentnl.org.

This topic is closed to new replies.

Advertisement