# Separate game clocks/intervals in XNA

I am making a real time strategy game in XNA. I have separated the Client (rendering, input, sound) code from the Sim (game logic).

I want to have features like replaying and fast forwarding. Also, I would like to give the Sim longer time intervals in its Update to finish its work without having to always implement time slicing to prevent frame rate stuttering. I imagine I can do this when the two systems become decoupled and have their own update frequency.

So, how can I run the Client and Sim at two different update intervals? How should I code it?

Currently I am running with FixedTimeStep = false and using ElapsedGameTime in Update() computations. Can I create new GameTime instances to leverage this existing code..?

• I would try something like that : *note that I normally use Managers, and manually handle the update/draw, etc, and dont use a gamecomponent iherited class. if you do it might require a little more work. simple put, I'd place an IF statement before the manager's update. If it pass the condition ( something like : if elapseGameTime%10 = 0 depending on the speed you want) you update, else you skip it. I normally have a speed variable for units movement and anima Dec 9 '13 at 16:14
• So I can create a new GameTime object with the elapsed value that I want..? I will need it for my replay feature as well because each frame has a variable duration. Dec 9 '13 at 23:19

you dont need to use another gameTime object, since its just a clock. you just have to build yourself different timer.

there might be easier/better way to do it, but since I dont know them, here how i'd try 1st.

What you want to update base on a different elapse time. just use different variable for when you want your update. lets set update speed for replay to 1/10 of normal (normal = 60 times per second, so once about each 16.66 elapseGameTime, lets say 15 to be safe. you want 10x that, roughly so about once each 150 ms )

bool replayMode = True;
double elapseTimer ;

public override void Update(gameTime GameTime)
{
elapseTimer += GameTime
if (replayMode)