Which AS3 physics engine can replay a simulation consistently?

489 views Asked by At

I'm currently using the Nape physics engine for a "Peggle" style game in ActionScript 3.0.

enter image description here

It is very easy to use, and runs smoothly. However, The only difficulty I'm running into with Nape is replaying the exact same simulation.

Even if I supply it the same timestep value throughout the entire gameplay, it seems to have enough "error" in the calculations that the ball hits different pegs every once in a while (starting the round from scratch), sometimes even resulting more or less lit pegs.

So my question is:

Is there any other physics engines for Flash that can reproduce a given simulation EXACTLY the same each time it is relaunched?

EDIT: The idea of "recording" the data on every-frames and playing it back was tossed around other forums I've asked this question. But unfortunately, the "replay" feature is not so much for the same user to view his/her own ball-drop scenario. It would be used for sharing between players on different machines (ex: client reports a bug with ball drop seeded a value 1234, we punch in 1234 and should be able to see the same issue). So if we pre-record a bunch of scenarios (and by that, I mean ENOUGH to give the player the illusion they are actually running a physics simulation), randomly pick one, and use that random ID as our way to identify a particular scenario, that means we'll need to embed tons of data in the game - that could be otherwise saved if the physics engine was deterministic.


And just to check-off anything I've already tried in Nape:

  • The ball is reset to the same position & rotation at the beginning of the game.
  • The ball's initial velocity is set on user click, therefore this should override any velocity that carried-over from the last round.
  • The pegs don't move (they are static), so no point of resetting those.
  • The part that catches the ball consists of only static boxes and sensors, so no point in resetting those either.
1

There are 1 answers

2
Jesus Boadas On

The Citrus Engine provide a similar functionality with the TimeShifter you can check it running the demo Braid (pressing [SHIFT] to back in time), the TimeShifter API