Windows Proper Progress Display Within Loop?



Hope you're all comfy and safe at home.

I'm working on a project that exports like a thousand images upon clicking a button in-game. The game freezes until all images are exported, which takes about 15 seconds. As of now, I keep track of the exportation's progress by writing to the output window, but there won't be an output window in the final release of the game.

All of this happens in a single step (that's why it freezes) through a single loop of a thousand iterations, so I am not able to draw the progress as you normally would with Draw functions. The only workaround I can think of is to export a single image per Step so I can use Draw functions but that would reasonably extend the completion time to at least 1000/30=33.33 seconds, which is over double the time.

What would be a proper way to do this?

Coded Games

Do as many frames as you can until you get close to your desired frame rate.

get_timer returns microseconds since gamestart. So 1/60th of a second (60 fps) is 16666 microseconds. I'm leaving a 1666 microsecond buffer.

var startTime = get_timer();

while (get_timer() - startTime < 15000) {
    //draw a image or a batch of images

//Update progress bar
I have a level loader that works similarly. When it's created it stores the current game speed, sets it to 9999, loads assets step by step, then restores game speed to it's original value.

May or may not work for your situation depending on what else is going on while you're doing your export.


Code the exporter to process only N images each step. I had a similar problem with a dungeon proc-genning drunkard walk generator. It had to run at least T steps to create an acceptable quality layout and might spawn a good number of walkers while doing so. This would cause a little hitch, more noticable if I upped value of T. Didn't like that, so I rewrote Step event to only handle N walkers a step, and only increase T progress once the walker DS had been looped through. Then I added a progress bar saying "GENERATING" and made N a rather low number so the player actually has time to read what it says.