Loading screen

BlitzMax Forums/BlitzMax Programming/Loading screen

Gavin Beard(Posted 2008) [#1]
Hi ALL,

What would be the most efficient way to display a loading screen whilst everything backend loads and configures? I'm just looking at a simple animated loading icon on a black screen. but alot of the stuff loading is in loops etc so dont see how to animate the icon at a steady rate?

Many thanks


Winni(Posted 2008) [#2]
I have to be mean now: Use multithreading, that's one of its uses.

A doable BlitzMax option probably involves CreateTimer().


Gavin Beard(Posted 2008) [#3]
Many thanks winni, so maybe a compination of a timer with event hooks?


GfK(Posted 2008) [#4]
I cheat.

I load something, then animate the progress bar for a bit, load some more, animate the progress bar, and so on.

Pseudocode might be something like:
Set progress bar to 0%
Load graphics
Set progress bar to 20%
Load sounds
Set progress bar to 50%
Load level
Set progress bar to 90%
Load music
Set progress bar to 100%


That way you get around the need for multithreading.


Gavin Beard(Posted 2008) [#5]
:-D

many thanks, another great suggestion.


Czar Flavius(Posted 2008) [#6]
Assuming you have procedures to check whether data was loaded correctly or not, just call the screen update function at the end of the "data loaded ok, next bit" section :D


ImaginaryHuman(Posted 2008) [#7]
I liked GrayAlien's progress bar in his golf/solitaire game - basically the golfer is on the putting green and he takes his shot trying to get pot the ball, and the relatively slow progress of the ball across the green is updated every few frames or whatever as files are loaded, and as such you're more interested in whether the ball is going to end up in the hole than worried that you're having to wait around for files - it puts the attention where it should be, on being interested and excited, right when you would otherwise be disinterested and bored. I think that was very well done.


Retimer(Posted 2008) [#8]
Get the size of all the files, store that size into a variable, begin loading the files, after each file is loaded, divide the loaded size by the total size = accurate percentage of loaded data.

If you have tons of files, it will almost look seamless...not to mention you can read streams by a specific data size at a time, while it might be slower, you could update the load progress perfectly if you wanted to do some kind of smooth animation.


Blueapples(Posted 2008) [#9]
Keep your application hidden, then use CreateProcess to launch a separate loading screen, kill it after you create the real window and you're done loading. You should be able to send process updates to the loading screen via the pipes (it will get the text as standard input).

I don't know if this would really work very well but a lot of games in the past used external loading screens / media players so some people have gotten it to work.


ImaginaryHuman(Posted 2008) [#10]
That's a fairly good idea.