Game Development Community

Loading Screen

by Do Not Delete · in Torque X 2D · 08/23/2007 (12:23 pm) · 10 replies

Anybody knows the best way to create a loading screen using Torque X?

#1
08/23/2007 (12:30 pm)
The Splash Screen tutorial should help with the basics.
#2
08/23/2007 (1:07 pm)
Btw, there is currently no way to show loading progress of a single level file. Although if your loading consists of multiple steps you could update progress between them.
#3
08/23/2007 (1:55 pm)
I wrote that tutorial. It needs some updating which I will do sometime later. I want to do something like the loading screen the Game State Management sample from the XNA Creators Club site.
#4
08/23/2007 (1:57 pm)
That's what I get for not looking at the names while I post.

You could create a procedural progress bar. Add all level items into a list and then callback as they are successfully loaded and update the bar. I did a text one in a Java class years ago.
#5
08/23/2007 (3:59 pm)
This would work with Torque X right? If so I'll try it and write up a tutorial on the the TDN. Right now onto fixing the Splash Screen tutorial.
#6
08/24/2007 (9:33 am)
In TorqueBase there is a public virtual OnLoaded(), but in order to use this for anything you would have to derive a new class or make changes to the engine code, so a better change could be to add a OnLoaded delagate to TorqueBase which is called by the function OnLoaded, or even an additional static onloaded delagate which is also called. Then if you are about to load a level you would specify the static torquebase OnLoaded delagate to incriment your progress bar, load the level, then unassign the delagate. However, you would not know how many objects are in the level you are loading, so you'd end up with a progress bar that gets full before loading is finished or never gets to the end.
#7
08/24/2007 (10:31 am)
That is why you would have to add the objects you are loading to a list and parse the list. Then update the bar as the load function returns success.
#8
08/24/2007 (10:57 am)
Sure if you want to keep a list of every single object in your scene which is hard coded and has to be changed every time you edit your level then you can know how close you are to finished.

So every time you load an object you add it to a list or just increment a counter, that will tell you how many you have loaded so far not how many you have left, there is no way to tell that I know of.
#9
08/24/2007 (11:11 am)
That's where a well organized directory structure and a parsing algorithm come into play. No need for it to be static.

EDIT:
First pass, scan the required directories for the "load" items. Add to the list. Once the "load" items are in the list, you have the bounds of the loading scheme. Since it is created dynamically, you can add in updates, assets, etc.

Second pass, start the loading process and update the progress bar accordingly.

I haven't done it in TorqueX or XNA, but I don't know why it wouldn't be possible.
#10
08/24/2007 (4:00 pm)
That would work well in a situation where you have multiple files to load, like on your games startup, if you have different level files containing templates, particles, etc, but once that is done you will likely be loading level files one at a time (thats how TorqueX works your levels ARE a single file), since these are actual game-levels. Putting a loading screen in this situation would be useful because, especially on the 360, it can take a while even loading this one file (game-level files can be quite big).