dimanche 5 novembre 2017

What could be a nice design pattern two sync two simulation loop?

I am working on a problem, where I am trying to design an application that can have two simulation loop. The application itself can be divided into two logical section, 1. the renderer and 2. the simulation.

Now, we are using a simulation engine, and my application wrap that simulation engine so that it can run a simulation inside my application. The task of the renderer to render the object position, orientation from the simulation. Now, the object representation within the renderer and the simulation engine is independent. For example, a object can added and deleted in the simulation. The rendering engine add a corresponding scene object for the object in the simulation loop and render it in the environment.

We can register observer for different events in the simulation engine and the simulation engine publish changes to the observer. Now this discussion is kind of brain storm type of question; what would be a good design to get the simulation loop and rendering loop synced together?

PS: Simulation engine tick slower than the rendering engine.

Aucun commentaire:

Enregistrer un commentaire