What happens during a "loading" screen?

Started by
24 comments, last by DevLiquidKnight 20 years, 1 month ago
Lots of games have them those screens that say "Loading..." I know they load textures and other things. But how exactly do they do this and update a % complete control? I''ve made a few engines in direct3d and it seems like it takes forever to get the application to finish being executed after I execute it i sit there and wait about 5-10 seconds before anything even appears, which is kinda slow so I was wondering how exactly do you make one and use one in a game so that it effectively displays a screen but allows the user to know whats going on as it loads. It may be a stupid question but just wondering
Advertisement
Multi-Threading.
You''ve been duped. The only purpose of the "loading" screen is to give the player suspense - no loading is ever actually involved since loading is always instantaneous. All those screens are doing is updating the % bar with some sleeps in between inside a for loop. The really clever ones try to make you think its actually loading something by writing (which isn''t instantaneous) bits of random information to the hard drive, then deleting it just before they decide to launch into the game. The length of time a game stays in the loading screen is completely arbitrary, but most designers seem to follow a pattern of making the duration proportional to the likelyhood of the player being killed in the next screen. This adds to the suspense as the player must reload his last save game and wait excitedly during the "loading" screen.
My stuff.Shameless promotion: FreePop: The GPL god-sim.
Hi!

Like Manip said, you could use multi-threading, but I''d do it different (in fact, I know quite alot of games that do it this way, IL-2 Sturmovik, to name one). I''d go and define steps. For example, when the world is loaded, the loading is 30% done. You then interrupt the loading and update the loading screen to 30%. Then, when the next thing is loaded (for example, the vehicles), update the loading screen to 50%, and so on.

I''ve never done that, but as I said, this is the way I''d do it. Hope it helps!

cya,
Drag0n

-----------------------------
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning..." -- Rich Cook
-----------------------------"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning..." -- Rich Cook"...nobody ever accused English pronounciation and spelling of being logical." -- Bjarne Stroustrup"...the war on terror is going badly because, if you where to compare it to WWII, it's like America being attacked by Japan, and responding by invading Brazil." -- Michalson
i doubt professional games do what doc says
loading is not instantaneous

instead of a loop you do this

// draw loading screen with 0% bar
// load a file
// redraw bar at 2%
// load a file
// redraw bar at 8%
// etc...

so if your using d3d you would end up calling IDirect3DDevice9::Clear and IDirect3DDevice9:resent after every time you load one, two, or more files to update the bar

you could even take the total number of files needed to load and calculate the percentage that way
What Doc is saying is complete rubbish. As a programmer you should know it might take some time to load the maps, models, textures, script actions, etc.

These aren''t loaded into memory directly by opening the file or something. They require time to be opened, loaded into memory and then parsed into the correct memory format. Or do zip files unpack instantly and the progress bar is there because the programmer of the zip app likes to waste precious time on developing an progress dialog so it can waste the time of the user? Haha, funny man!

Back to thread:
Usually during the loading screen an extra thread is fired off which reads the files into memory and parses those. For each file it writes to nPercentage = nNewPercentage. As long as the boolean "Loading" is set to true, the load screen updates itself. When the value of loading is set to false, the thread kills itself and then the load screen jumps over into the menu/game.

Toolmaker


-Earth is 98% full. Please delete anybody you can.

What I''ve done is find the size of all the files at the beginning of the load and as each file is read in I update the bar by the appropriate percentage.
If any of you did take Doc''s post seriously, the joke''s on YOU! It was quite funny, actually.
You bank account is being hacked... they just put that screen up so you don''t get suspicious.
quote:Original post by Doc
You''ve been duped. The only purpose of the "loading" screen is to give the player suspense - no loading is ever actually involved since loading is always instantaneous. All those screens are doing is updating the % bar with some sleeps in between inside a for loop. The really clever ones try to make you think its actually loading something by writing (which isn''t instantaneous) bits of random information to the hard drive, then deleting it just before they decide to launch into the game. The length of time a game stays in the loading screen is completely arbitrary, but most designers seem to follow a pattern of making the duration proportional to the likelyhood of the player being killed in the next screen. This adds to the suspense as the player must reload his last save game and wait excitedly during the "loading" screen.


This is True! RTCW ''accidently'' forgot to do the load time for the save games and the game loaded instantaneously!

This topic is closed to new replies.

Advertisement