Activity while loading datablocks
by Jason McIntosh · in Torque Game Builder · 05/10/2006 (5:41 am) · 5 replies
Is there any way to show a "loading" screen as datablocks are loaded?
It seems like the engine locks up the display system while datablocks are loading. I am doing function calls (which succeed since I have console output), but nothing is onscreen. I even have the debug panel turned on for the scenegraph but nothing shows during startup.
Any hints?
It seems like the engine locks up the display system while datablocks are loading. I am doing function calls (which succeed since I have console output), but nothing is onscreen. I even have the debug panel turned on for the scenegraph but nothing shows during startup.
Any hints?
About the author
#2
No doubt you could do something similar on a datablock-by-datablock basis too, but if you have a really slow computer combined with one individual asset that is overly large, you'll still have the stutters and pauses so it isn't a perfect solution.
05/10/2006 (11:39 am)
One fairly quick and dirty solution I made in the past for this was to create a file exec queue script that takes a list of .cs script filenames and iterates through it exec'ing each one with a time delay between each. During this delay I can update a progress bar animation (and other processing like display/animation continues to happen too). The datablock files being loaded are broken up in small enough chunks so no one exec'd file locks the display/processing for more than a half-second or so.No doubt you could do something similar on a datablock-by-datablock basis too, but if you have a really slow computer combined with one individual asset that is overly large, you'll still have the stutters and pauses so it isn't a perfect solution.
#3
05/10/2006 (12:04 pm)
Not a bounty or anything, but if some enterprising TGE owner wants to see how TGE does this (it's all script), it should be pretty easy to do a TDN article on the topic.
#4
@Luke: Maybe I'll defer the scripts and give the engine time to "catch up". A couple seconds later I'll start exec'ing scripts.
@Stephen: Are you reffering to how TGE handles initialization or do you mean that there is already some script for showing a loading screen?
Thanks for the replies, everyone. :)
05/10/2006 (4:52 pm)
@Marc: Doesn't seem to make any difference.// .gui's are all exec'd before this point, so baseGui exists Canvas.setContent( baseGui ); exec( "./globals.cs" ); // set up the baseGui scenegraph, sprite for progress, etc Canvas.pushDialog( baseGui ); exec( "./datablocks-audio.cs" ); exec( "./datablocks.cs" );At the end of each datablock definition, I have a call to a function that updates progress, moves the indicator sprite, etc. But nothing appears on the screen. Is it because the engine is initializing? The log indicates that this stuff all happens after the system specs etc are done. So I assumed I was free to display things. I also noticed that if there's music (looping/streaming) it gets reset/restarted once this brief period is done.
@Luke: Maybe I'll defer the scripts and give the engine time to "catch up". A couple seconds later I'll start exec'ing scripts.
@Stephen: Are you reffering to how TGE handles initialization or do you mean that there is already some script for showing a loading screen?
Thanks for the replies, everyone. :)
#5
The datablocks are all loaded as the datablocks.cs file is executed, thus there are no video updates happening in between them because the engine loop doesn't cycle until the script is done executing/compiling. Well, at least now I know.
Time for some sleep..........
05/10/2006 (5:37 pm)
I just realized it's my own dumb fault. :) My logic is screwed (hey, I've been coding for 13 hours today!).The datablocks are all loaded as the datablocks.cs file is executed, thus there are no video updates happening in between them because the engine loop doesn't cycle until the script is done executing/compiling. Well, at least now I know.
Time for some sleep..........
Torque 3D Owner Marc Dreamora Schaerer
Gayasoft