# Game running with fewer steps than desired (game created in GameMaker)

I tested my game on 4 different computers and got some results.

PC 1 => AMD A4-6300 APU with Radeon HD Graphics / 2,0 GB RAM / AMD Radeon HD 8370D

In this computer I tested a few stages and I noticed a loss of 1 second in 10, ie ... In the game 10 seconds passed while here in the real world 11 seconds passed.

I calculate the time in the game based on the step event.

I set the speed of the room by default as 30.

Time code:

Step Event: currentTime+=1;

Draw Event: draw_text(x,y,string(currentTime/30));

On my computer I never had problems. Hence the need to test the game on other computers.

PC 2 => Pentium Dual-core CPU E5700 @ 3.00GHz / 4,0GB RAM / Intel G41 Express Chipset

On this computer, I performed the same tests and I detected a slightly smaller loss. Less than 1 second every 10 seconds, ie ... In the game 10 seconds passed while here in the real world 10.7 / 10.8 seconds passed.

PC 3 => Intel core i3-3217U CPU @ 1.80GHz / 4GB RAM Intel HD Graphics 4000

Worked perfectly! It's a core i3 right? I did not detect any apparent losses.

PC 4 => Intel Core 2 Duo CPU e8200 @ 2,66GHz 2,66GHz / 4GB RAM

Worked perfectly! I did not detect any apparent losses.

Detail that in this computer the game lost enough in resolution (it seems that the monitor is too large for the components of the computer).

Post with the problem => Game was resized incorrectly for no apparent reason (GameMaker)

Important!

I put a function on the shift key to accelerate the game (it would be a function for the players who wanted to analyze all the course of the stage, just playing to understand) and I defined that when clicking on the shift key the speed of the room goes to 3000 steps. On my PC the game is super fast, but I doubt it reaches exactly 3000 steps. Even so, a few hours pass in a few minutes here at home.

On PC 1 I tested this same function and accelerated by approximately 20%. In the game it was 11 seconds while 10 seconds passed in the real world.

Solutions:

1=> Stop measuring time through the steps.

I imagine there is some way to do time measurement based on another type of argument, just like unity timeDeltaTime.

That way, I imagine that a player with a GTX 1080 the game works correctly and phase 1 finishes in exact 11.23 seconds (real time).

But a player with a humbler computer that same phase finishes with 13 or 14 seconds (real time). It turns out that the same phase that lasted 11.23 seconds on the computer with a GTX 1080, it would take longer to be finalized on that more humble computer. The time was going to be measured correctly (13/14 seconds in the game), but the game was going to be running in different ways (different speeds).

2 => Based on the boost (shift key) I tested on PC 1 (the humblest computer I tested) I see that it is possible to force the game to rotate in a number of steps even on that weaker computer.

I think that using solution 2, when I make the online mode available, I may have problems (just like Fallout 76), people with a good computer could change the steps of the game and make the game work in a much larger number of steps.

The ideal would be to join the two solutions, so that time is measured regardless of the number of steps, but that the operation of the game is the same on any computer.

delta_time is the time that passes between one step and another. In a room with 30 steps per second on a computer that supports such speed, delta_time will be equal to 33333.33333333... . Knowing this:

Step Event (clock): currentTime+=1*(delta_time/33333.333);

With this equation the time will be calculated regardless of how many steps the game is executing.

Step Event (object car): speed=carSpeed*(delta_time/33333.333);

Where carSpeed is the variable that defines the speed of the car previously.

Where the speed is a property that all instances in the gamemaker have. Which can modify the speed of an instance at any time.