• Advertisement

Archived

This topic is now archived and is closed to further replies.

Physics-based game...network possible?

This topic is 5037 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement