I am working on a simulation software for basic physics using WPF. In my software I want to be able to show a simulation based on the input the user has provided (some shapes moving around). I need to implement some kind of simulation (game) loop but I need help figuring out how to do this properly. These are my requirements:
- Run with the same speed independently of the hardware.
- Multiple runs of the simulation, given the same input, shall yield the same visual output.
- Ability to start, stop, pause and resume at any time.
Not required but would be great:
- Adjustable simulation speed: 0.5x real-time, 2x real-time, 10x real-time for example.
I guess this can be split up into two questions: How do I create a simulation loop which meets my requirements? and how do I integrate it into my WPF software? Any help would be greatly appreciated.