Sign in to follow this  

Simulation accuracy across platforms

This topic is 1505 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

What are some considerations I need to make when building an accurate cross-platform simulator? That is, given an input set, what considerations should I make such that I can obtain the same play-through when run on different hardware and operating systems?

In this simple 2D game I'm planning, a recording of the player's play-through, final score, and initial game state are sent to a server. This server then replays the game and accepts or rejects the score. If accepted, the score obtained from the simulation is then entered into the leaderboard.

Obviously the hardware and operating system on the server will be different than the players'. I plan on using the chipmunk physics library to do the bulk of the work, but I have doubts that floating point arithmetic might not always be the same across different hardware, let alone an entire environment with interacting rigid bodies. I'm certain that a networked client/server model partially follows what I'm after, but I don't think I can accept any amount of simulation error...


Any ideas?
Thanks in advance. Edited by fastcall22

Share this post


Link to post
Share on other sites

That is indeed an excellent article, read it carefully.

 

You don't mention which platforms you're targeting, I believe that by being incredibly careful and putting in a huge amount of effort you can eventually achieve consistency across AMD/Intel processor PCs, but throw in different platforms like Linux, OSX, iPhone and Android, and I think it's just not a viable approach. (I know Linux/OSX are the same architecture, but you'll probably be using different compilers which will optimise differently)

 

Fixed point is the only way to be sure. I believe someone did a fixed point version of Box2D for NDS (http://code.google.com/p/box2d/wiki/FAQ), might it be an option to switch to that?

Another possible option might be to use a software floating point implementation. This'll likely be even slower than fixed point, and when I last looked into it, I couldn't find a good free implementaiton, but if you've already gone a long way down the road of using floats it might be quicker to replace the floats than refactor the codebase.

 

I think that if all you're doing it for is cheat prevention then maybe you should take some other approach.

Share this post


Link to post
Share on other sites

I think I've read somewhere in Bullet documentation that they guarantee "loose determinism". Basically, the system is guaranteed to behave "not very much differently". Based on my admittedly limited tests, lockstepping is a effective solution in a real world context.

I agree with C0lumbo however, if this is to be used as cheat prevention, you're better off with something else.

Share this post


Link to post
Share on other sites
Okay; thank you for the replies.

I'm targeting PC architectures, so AMD and Intel processors. Operating systems are Windows XP, 7, 8; and for the server: Some flavor of Linux, I'm not sure.

I will explore the fixed-point arithmetic and other physics libraries. Once I have done thorough research (as well as exploring other solutions), I'll write a demo for volunteer testers to try... Edited by fastcall22

Share this post


Link to post
Share on other sites

fwiw, I was able to achieve (apparent) simulation parity between the .net platform on the PC and the .net CF on the (PowerPC) Xbox 360. I am able to record player inputs on the Xbox which control objects in a physics-based world, and replay it with exactly the same results on the PC.

 

It wasn't always trivial though, and is easy to break if I make changes to the physics code.

Share this post


Link to post
Share on other sites

This topic is 1505 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this