3 ms·
You have to explicitly write your code to prevent this from happening. You typically have an engine that is executing all of your logic (rendering, game logic,
by peripitea 7y ago
You have to explicitly write your code to prevent this from happening. You typically have an engine that is executing all of your logic (rendering, game logic, AI, etc.) in cycles. By default, it will execute these cycles as quickly as possible. So for anything with real-time components, faster CPU = enemies move faster.
I forget which game first introduced a fix for this, but the solution is to have the engine run on time-based ticks -- you wait to execute the next cycle until the requisite time has passed.
- repsilat 7y agoAnother alternative is to say, "How much time has passed since the last frame?" and update the game state based on that. When your computer can't hold a constant framerate, the game doesn't slow down.