How do I Make a Progress Bar For extensive event?

Just started using Construct 2? Post your questions here

Post » Mon Aug 21, 2017 11:35 pm

I have a 100,000 tiles that get formed into ground, underground, caves ect that stops the game solid for about 10 seconds straight when the level first gets generated. How do I put some type of visual up during this process that serves as a "loading screen" because the traditional loading screen are for loading the game not heavy handed parts within the game?

Thank you to anyone replying.
B
8
S
2
Posts: 24
Reputation: 548

Post » Tue Aug 22, 2017 4:17 am

Maybe you could use a percentage bar:

progress = (n / 100,000) * 100

(In this case, if you loaded 50,000 tiles, progress is 50%)

You could use percentage to make a Progress Bar... There are a lot of tutorials on these bars around there. But is as simple as setting the width of the Fill part to the: Maximum_Width / 100 * progress

Hope I helped you.
Howdy, I'm HenryPK! I love helping people and making games... Hope we can be friends. (Also check my game: Blue)
B
10
S
2
G
1
Posts: 60
Reputation: 1,233

Post » Tue Aug 22, 2017 5:00 pm

Thanks for your reply! So you are saying simply load a visual before I begin the process and inside of my loops just update the progress bar? Wonderful Idea I didn't even think of that! I was assuming that I needed to use some special implementation that would calculate cpu usage I didn't even think of just implementing something myself. You see I am doing everything on layout start so I am looking at this initial freeze thinking hmmm how do I keep it from stopping like this. It is freezing because I am doing everything at one time and not stopping to update the user with visuals.

Thanks again for bringing this to my attention. When you said the 50k tiles part it turned a lightbulb on.
B
8
S
2
Posts: 24
Reputation: 548

Post » Tue Aug 22, 2017 6:37 pm

^^ I'm glad I helped, good luck!
Howdy, I'm HenryPK! I love helping people and making games... Hope we can be friends. (Also check my game: Blue)
B
10
S
2
G
1
Posts: 60
Reputation: 1,233

Post » Mon Sep 11, 2017 6:43 am

I can't seem to make a progress bar work the game just freezes I don't know how to make it wait long enough to update the visual.
B
8
S
2
Posts: 24
Reputation: 548

Post » Wed Sep 13, 2017 6:46 pm

If updating the visuals within the generation isn't working (because the screen freezes), maybe the html/javascript system itself is just overloaded. However, if it's ok waiting a little more, you could do a natural pause while generating.

What I mean is, for example... Minecraft.
Minecraft generate thousand of tiles (and doesn't have a progress bar), however, the game generates in a interesting way... it loads chunk by chunk, instead of block by block... (a chunk is an area of 16x16x256 blocks) also, it generates the chunks only when needed. It doesn't generate all the blocks in the world, just the "visible" ones.

With that, you can not to load the entire world with 100,000 tiles at once. Maybe what you need is a slower process loading on groups of tiles (a cave or a biome, etc) and on those intervals refresh the information to the user on the UI. After all, 100,000 tiles...! I can't even count on my fingers!
Howdy, I'm HenryPK! I love helping people and making games... Hope we can be friends. (Also check my game: Blue)
B
10
S
2
G
1
Posts: 60
Reputation: 1,233


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests