This project has moved and is read-only. For the latest updates, please go here.

Calculating 1 minute of physics in 5 seconds.

Topics: Developer Forum, User Forum
Nov 9, 2012 at 10:24 AM


I have previously gone about making a few small games with Farseer and have been very happy with it.

For a new little game project I want to make a turn based multiplayer game where all the physics are calculated on the server and the results are sent to the clients to display. In order for this to work well I need to speed up the physics, alot.

A guesstimation at this point is that one turn might take, at most, one minute in real time. 

So my question is if any of you have any pointers or ideas as to how I should run 1 minute of simulation time in about 5 seconds?

Any special considerations I need to take?

Nov 9, 2012 at 1:52 PM

Depends how fast your PC/platform can perform one iteration of a Farseer world update.

When you ask the world to complete an update step you provide for it the time step. Ignoring processing time for non-Farsser related code, if your PC is able to run at 60fps, then you would normal provide Farseer a time step of 1/60th of a second. Therefore, to run a simulation forward 1 minute in 5 seconds, at 60FPS, you would have to multiply the time step by 12.

However, the longer the time step you ask Farseer the process, naturally the less accurate the simulation will become. It may become unrealistic with the large time steps you require. You will have to test this.

Although your implementation does not suggest this. Note also that although Farseer will provide similar results from the same initial conditions, it is not guaranteed to always follow the same path, especially if you are using different / longer length of timesteps you will almost certainly get slightly, if not majorly different results. I make this comment as some people wish to include things in their games that plot ahead paths of objects (for say a graphical overly in angry birds) and then watch it play out.

I've always found that just solving the SUVAT equations of motion under gravity do fine for trajectory plotting before collision :) and are easy and quick to calculate without needing to try and run your simulation forward. Of course, will not handle collisions or other forces but are fine for say a dotted line that show where your projectile will fly intiially.

Marked as answer by genbox on 10/10/2013 at 12:52 PM