Progress Bar for Loading Screen
by Abhinav Chokhavatia · in Torque Game Builder · 07/23/2008 (3:53 am) · 7 replies
Hey guys,
I was trying to create a loading screen with a progress bar for the start of my game. I was wondering if anyone could tell me how to use the guiProgressControl profile? Or if there is some kind of tutorial or forum post explaining the theory of how to create a progress bar, could you please direct me towrads that?
Thanks!
I was trying to create a loading screen with a progress bar for the start of my game. I was wondering if anyone could tell me how to use the guiProgressControl profile? Or if there is some kind of tutorial or forum post explaining the theory of how to create a progress bar, could you please direct me towrads that?
Thanks!
About the author
#2
08/02/2008 (4:11 am)
Well I have been able to figure out how to use the GuiProgressControl to act as my progress bar showing the amount a level has loaded. What I am not able to understand is how to set the value of this progress bar in proportion to the amount of level loaded into the computer? In clearer terms, I have to use the setValue() function to set the value of the progress bar (ie - the amount it will get colored), and this value has to be betwenn 0 and 1. How do I attain this value with respect to the amount of the level loaded into the computers memory?
#3
Now I'm not entirely sure how much of that info you actually get inside the scripts, or if there are callbacks in the loading functions, but that's the gist of it.
08/02/2008 (7:59 am)
It's just a simple percentage calculation. 1.0 is 100%, 0.5 is 50% etc. Either you calculate by progress in bytes loaded, or you could assign percentages according to how many files you have loaded, if you need to load more than one.Now I'm not entirely sure how much of that info you actually get inside the scripts, or if there are callbacks in the loading functions, but that's the gist of it.
#4
08/26/2008 (11:25 pm)
As far as I know, without engine modifications TGB doesn't report any loading in callbacks. In other words - you can't do a loading progress bar. The neatest solution is to fade to black, then call your next level, then fade up from black. All loading happens on a black screen.
#5
08/26/2008 (11:43 pm)
Well it might "sortof" report loading if you implement t2dSceneObject::onAdd, that will get called for each object it loads. You'd have to try it to be sure.
#6
As all of this happens in between an advance in time, the UI isn't refreshed.
The only thing that I could think of in this respect is to have a loading screen where you have a text control displaying what elements of the level are being loaded.
Loading Scripts...
Loading Datablocks...
etc
The advantage of TGE's loading script is that it recieves packets of information from the server which are broken over multiple ticks in the engine (at least thats how I understand it to work).
08/26/2008 (11:57 pm)
James, I don't think that would work as the loadLevel function does something like this:for (%i = 0; %i < %objectList.getCount(); %i++)
%sceneGraph.addToScene(%objectList.getObject(%i));As all of this happens in between an advance in time, the UI isn't refreshed.
The only thing that I could think of in this respect is to have a loading screen where you have a text control displaying what elements of the level are being loaded.
Loading Scripts...
Loading Datablocks...
etc
The advantage of TGE's loading script is that it recieves packets of information from the server which are broken over multiple ticks in the engine (at least thats how I understand it to work).
#7
08/27/2008 (12:28 am)
You are correct the UI doesn't get refreshed, BUT you can do the same thing TGE does to updating load progress, which is manually call Canvas.repaint(). So, it may occur all during a single tick, but addToScene -> onAdd -> repaint, and on to the next object.
Associate James Ford
Sickhead Games