D
Drepple
Guest
Hello,
I'm working on a project with a random room renerator. I created a second project to see how I would go about loading/generating and make sure it's optimised, by which I mean the game will perform as much calculations as it can untill the fps drops below 60, after which the game will wait till the next step to continue generating the world.
To do this, I used "while true". The break statement would only be called if the fps drops below 60 or the game has finished generating the world. here's the problem: game maker only gets the fps once per step (same thing goes for fps_real). So the while statement sees the fps is above 60 and generates the whole world in one step, because even if the game is lagging, the fps will return the same number during every cycle of the while loop untill the next step. I don't want to use the repeat function because it limits the amount of calculations per step.
Is there any way for game maker to get the fps at any given time, perhaps with the asynchronous event?
Here's the code I'm using:
thanks in advance
I'm working on a project with a random room renerator. I created a second project to see how I would go about loading/generating and make sure it's optimised, by which I mean the game will perform as much calculations as it can untill the fps drops below 60, after which the game will wait till the next step to continue generating the world.
To do this, I used "while true". The break statement would only be called if the fps drops below 60 or the game has finished generating the world. here's the problem: game maker only gets the fps once per step (same thing goes for fps_real). So the while statement sees the fps is above 60 and generates the whole world in one step, because even if the game is lagging, the fps will return the same number during every cycle of the while loop untill the next step. I don't want to use the repeat function because it limits the amount of calculations per step.
Is there any way for game maker to get the fps at any given time, perhaps with the asynchronous event?
Here's the code I'm using:
Code:
while true {
if !complete {
if (fps >= room_speed) {
board[# j_or, i_or] = choose(0,1);
j_or ++;
if j_or >= width {
j_or = 0;
i_or ++;
}
if i_or >= height {
complete = true;
}
} else {
break;
}
} else {
break;
}
}
Last edited by a moderator: