Zen and the art of accurate Progress Indicators...

Started by
9 comments, last by gimp 20 years, 11 months ago
I currently have a well formed engine. My levels load from XML files. Typical entities loaded from the level file would be like Terrain, Models, Sky. Each entity could of course load in more files, like a model may load surface definition files which may in turn load textures. This is all handled inline, as in If I load the model, it''ll look after loading the surfaces files and in turn the textures those surfaces need. All of this works nicely. Now, my levels load times are increasing with the more entities I add. I thought about adding a progress bar. Some thoughts that came to mind: -Use the XML parsers byte index file as a kind of progress bar. Use the current byte index to indicate how far though the file I am. This idea bites as it doesn''t reflect the actual texture\ model\terrains etc -Time the loading of terrains and replay the loading times. This bites because it won''t be reliable between machines, even on the same machine. -Load all files at the same time, XML loader just marks actual external files for later loading. I previously discounted this idea as it would complicate the engine but it''s the only thing left that''s viable. if I loaded 200 files for a level it would be ~reasonably~ accurate even though the files are different sizes. (NOTE : I guess I could query the files size and scale it''s weight against the progress bar) Any other idea''s? Many thanks, Chris Brodie http:\\fourth.flipcode.com
Chris Brodie
Advertisement
Perhaps have separate (small) progress bars for terrain, models, sky, etc? You''re not going to get a single metric that works well for all types of resources so I think it might be better to have separate ones that are internally consistent.

[ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]
Just curious, how can you still do rendering operation (ie drawing a splash screen with progress bar) while loading files? I mean say you have a function LoadLevel(char* levelPath), that function takes care of loading everything into memory, it wont exit until everything is loaded, so you cant do anything else meanwhile no????

One way I thought around the problem would be to use multi threads.
You could load small segments of the file at a time.. almost an artificial multithreading..
Disclaimer: "I am in no way qualified to present advice on any topic concerning anything and can not be held responsible for any damages that my advice may incurr (due to neither my negligence nor yours)"
Loading small parts of the file and updating the progress bar is how I do it, although right now it is a 1.4 second process. *flash*
you could just have the progress bar fill to about 95% really fast, and leave it there until you are done, no matter how long it takes. this is how it works when Windows 2000 loads on my PC.
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
quote:Original post by dopeflow
Just curious, how can you still do rendering operation (ie drawing a splash screen with progress bar) while loading files? I mean say you have a function LoadLevel(char* levelPath), that function takes care of loading everything into memory, it wont exit until everything is loaded, so you cant do anything else meanwhile no????

One way I thought around the problem would be to use multi threads.

Another way would be to pass a reference to the progress meter to the function.

A third way would be to treat file-reading like network reading and do a bit each frame.


[ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]
Kylotan, thats an interesting idea I''ve never thought of. I actually saw something similar to this recently in a demo of something I downloaded. The demo starts out fully fogged up then ''unfogs'' as the data is paged in. An interesting effect that hides the mechanics behind the scenes(it was a roam implementation)

Chris Brodie
http:\\fourth.flipcode.com
Chris Brodie
Can''t you get a byte-count of all the files that need loading, then update your progress bar appropriately after each file has been taken care of? Of course, this would require you to traverse the load tree you mentioned, counting bytes. Perhaps you could set a flag, telling the load function to iterate through all the files, but count the bytes in each one instead of load it. Then just turn the flag off and call the function again.
Tolerance is a drug. Sycophancy is a disease.
you could always take the easy way out and do somethign like this:

loading game data...done
loading textures...done
loading sound...done
loadong level...

if you break these up into small enough separations, then no particular one will take very long (more then 2 seconds, say), and anyone playing your game will have a very good idea of how long to expect to wait after playing it just one time. After all, this is the whole point of indicating progress to the user- to let them know that its not long now.

This way, if they upgrade their computer by getting more ram or a faster processor, then this will still work.

This topic is closed to new replies.

Advertisement