Physics for Flash Games

Presented at

In this session I described some of the basic and not so basic aspects of developing a physics system for use in Flash games.

Here are the slides from the presentation at LFPUG on 31 May 2007.

8 thoughts on “Physics for Flash Games

  1. This must be an older post, but I wanted to say thanks—it’s very good!

  2. Hi, I know it’s useless to bring up, but I think there is a typo in the Vector class code. The function get length() should be getlength() right?

  3. I had been led to believe that verlet was the best. But from your demonstration it appears that Improved Euler Integration would be the best. Can you clarify?

  4. Those who tout Verlet as best tend to do so because it is less inclined to blow up out of control. But in general I think the improved Euler is the best balance between performance and accuracy, and I use 4th order Runge-Kutta if I need more accuracy and Verlet if the improved Euler is unstable.

  5. Hi Richard. An interesting presentation, thank you for posting it.
    I tried implementing the Gravity and Compute Position after Velocity examples in C# (XNA) and found that they both behave exactly the same, with each bounce being of equal height. In your animation the gravity example has an increasing velocity and int he other example velocity decreases. I also saw a comment on gamedev.stackexchange from a user that experienced the same. Can you think of any reason why your examples would behave differently from the one I’ve written in C#. I have already checked and double-checked everything including the implementation of the Vector class and everything is identical.


  6. Me again :)

    In case anyone else sees the same behaviour as I described above…
    I changed the game to run at a fixed 60fps and initialised the time variable to zero on the first execution of the update method. This resulted in the framerate (and hence the velocity and acceleration) being zero on the first update which in turn caused the simulations to run in the same manner as the examples above.

    I tried watching the video of this presentation but the audio is too quiet so maybe the author explains the problem as being an issue with the starting framerate/time variable. I’m happy I found the answer though and look forward to following along with the rest of the presentation.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>