basic architecture for a simulation

Started by
0 comments, last by hawkeye_de 12 years ago
Hi,

I'm currently into developing a simulation game (no 3D, it is a tactical 2D 'map-centric' simulation for Android tablets in C# (Mono).

Since I am new to game development (but not to development in general) I'd have a basic question how to align the simulation engine and the UI.

According to the Android development model I have an own thread for rendering the 2D canvas (view, representing the map and later may be also other graphical stations), a GUI thread(which takes care about rendering the overall UI and reacts on user input).

My plan is now run the simulation engine in an own thread (game loop), which, let's assume, updates the simulation world every 1/60 seconds.

I'm currently struggeling now how to align the thread, which draws the map (by using objects, which are updated by the simulation engine) with the simulation thread.

My basic concern is how to sync them...I mean when the UI thread starts to draw the stuff, the simulation thread might already be in the next 'game cycle', thus the game world is not consistent since it is currently in the process of being updated.

I think there must be already well defined patterns available but I did not succeed to find them in the net.
Can anybody help me here ? smile.png

Thanks a lot.
Advertisement
Ok, I found this interesting arcticle: http://altdevblogaday.com/2011/07/03/threading-and-your-game-loop/

This topic is closed to new replies.

Advertisement