I'm building a simple game engine (yes I know...) but it's more for personal experience. I'm up to the stage where I have built a simple wrapper for directx and win32. Anyway, all is going great so far. Now, here's something I am a little bit confused on... FPS. Currently my game loop rotates (funny way of saying it) at 30 FPS. Every frame I call the RenderFrame function (directx) as well as do AI calculations & other bits. Now here is where I am confused:
If I increase the FPS limit, say from 30 to 60, off course all the AI code etc executes twice as fast. Is there some way to execute game code at the same speed no matter how fast the FPS (for rendering the image in directx) is? I'm assuming I may need 2 loops, one that controls the speed of the rendering and another for the gamecode, but that means threading... and I'm not sure if that's they way to do it.