Sign in to follow this  
hawkeye_de

basic architecture for a simulation

Recommended Posts

hawkeye_de    211
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 ? [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img]

Thanks a lot.

Share this post


Link to post
Share on other sites
hawkeye_de    211
Ok, I found this interesting arcticle: [url="http://altdevblogaday.com/2011/07/03/threading-and-your-game-loop/"]http://altdevblogaday.com/2011/07/03/threading-and-your-game-loop/[/url]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this