Loading screen / transition screen woes
by Tom Bak · in Torque Game Builder · 03/11/2007 (4:33 am) · 5 replies
Loading screen / transition screen woes
Hi everyone,
I'm trying to create animated level loading transition screen in TGB and I'm running into some difficulties. I tried checking the forums but I didn't find anything that helps... I'm sorry if this has already been answered somewhere else...
In this game new levels will be loaded every 10 seconds, so it's not acceptable to have a black screen whenever a level is loaded. There needs to always be stuff moving on screen, and the transition between levels needs to be smooth.
Before a level is loaded, I'd like to display a standard animated scene that keeps the player engaged. This animated loading scene will completely hide everything that is behind it. In the background the actual level will then get loaded and added to the scene. After the actual level has been loaded, the loading screen will move away, opening up to display the actual level beneath.
Below is the only way I can think of implementing this, and I'm running into numerous problems. Maybe there's a better way to do this?
Call loadLevel() for the loading screen level. This will display the loading screen elements in the foreground.
Call addToLevel() for the actual game level that is to be loaded.
Once everything is done loading and the level loading animation has finished, move away the loading screen graphics to reveal the game hidden beneath. Then play the actual level normally.
The main problem that I'm running into is that addToLevel() appears to be a blocking call. Therefore everything freezes while this level is being added. I need to keep the loading screen smoothly updating the whole time.
Also, it looks like there's no way of knowing when the level passed to addToLevel() is done loading. (assuming that I can make this a non-blocking call).
Is there a better way to implement a nice smooth loading transition?
Thanks to everyone for all their help... Sorry if this post is long or rambling... ;) Everything has been going very smoothly so far and TGB has been a joy to use, but this is the first serious hurdle that I've run into. Thank you! :)
Tom
Hi everyone,
I'm trying to create animated level loading transition screen in TGB and I'm running into some difficulties. I tried checking the forums but I didn't find anything that helps... I'm sorry if this has already been answered somewhere else...
In this game new levels will be loaded every 10 seconds, so it's not acceptable to have a black screen whenever a level is loaded. There needs to always be stuff moving on screen, and the transition between levels needs to be smooth.
Before a level is loaded, I'd like to display a standard animated scene that keeps the player engaged. This animated loading scene will completely hide everything that is behind it. In the background the actual level will then get loaded and added to the scene. After the actual level has been loaded, the loading screen will move away, opening up to display the actual level beneath.
Below is the only way I can think of implementing this, and I'm running into numerous problems. Maybe there's a better way to do this?
Call loadLevel() for the loading screen level. This will display the loading screen elements in the foreground.
Call addToLevel() for the actual game level that is to be loaded.
Once everything is done loading and the level loading animation has finished, move away the loading screen graphics to reveal the game hidden beneath. Then play the actual level normally.
The main problem that I'm running into is that addToLevel() appears to be a blocking call. Therefore everything freezes while this level is being added. I need to keep the loading screen smoothly updating the whole time.
Also, it looks like there's no way of knowing when the level passed to addToLevel() is done loading. (assuming that I can make this a non-blocking call).
Is there a better way to implement a nice smooth loading transition?
Thanks to everyone for all their help... Sorry if this post is long or rambling... ;) Everything has been going very smoothly so far and TGB has been a joy to use, but this is the first serious hurdle that I've run into. Thank you! :)
Tom
#2
I tried your suggestion of using multiple scene windows in a single gui... For the most part it works! :)
Determining and specifying the draw order of the scene windows is not clear to me however. It appears that calls to loadLevel() or endLevel() will swap around the draw order in unintuitive ways. For example, calling loadLevel() for the game window will cause it to start drawing on the top... I need it to stay in the background at all times. Similarly, if the transition window is being drawn on top of the game window, and then I call endLevel() on the game window, the now empty game window will apparently then get draw priority and will black out the entire screen. I'm not quite sure what's going on here. Making the transition window a child of the gui window seems to help enforce the drawing order, but it's not guaranteed...??? I wish there was some way to just keep the scene window drawing order the same at all times.
Also, can I ask why you used 3 scene windows? Is this so that you have a place to load the next game while the current game is still playing? I'm hoping that I'll have enough time to load the next game when the transition animation stuff is fully blocking the screen. The way I have it now:
(2 scene windows - transition + game)
Transition window blocks the screen with art elements.
Start loading the game into the (now hidden) game window.
Move out the transition window elements to show the game window.
Play the game.
Move in the transition window elements to hide the game window.
Repeat
Is there some other snazzy magical benefit to using three scene windows that I'm not seeing? :) The frame rate definitely drops a bit and things get choppy while the game level is loading in the background, so I'd be a little worried about playing the actual game while another level is loading in the background.
Hehe yeah my game is perhaps a little bit like wario ware... It's so easy to quickly prototype and test many different game possibilities with TGB... But I imagine a ton of time will be spent on the final polish for all these games... :P
Thanks again for all your help.
Tom
03/12/2007 (4:42 am)
Thanks so much for your response... I really appreciate it!I tried your suggestion of using multiple scene windows in a single gui... For the most part it works! :)
Determining and specifying the draw order of the scene windows is not clear to me however. It appears that calls to loadLevel() or endLevel() will swap around the draw order in unintuitive ways. For example, calling loadLevel() for the game window will cause it to start drawing on the top... I need it to stay in the background at all times. Similarly, if the transition window is being drawn on top of the game window, and then I call endLevel() on the game window, the now empty game window will apparently then get draw priority and will black out the entire screen. I'm not quite sure what's going on here. Making the transition window a child of the gui window seems to help enforce the drawing order, but it's not guaranteed...??? I wish there was some way to just keep the scene window drawing order the same at all times.
Also, can I ask why you used 3 scene windows? Is this so that you have a place to load the next game while the current game is still playing? I'm hoping that I'll have enough time to load the next game when the transition animation stuff is fully blocking the screen. The way I have it now:
(2 scene windows - transition + game)
Transition window blocks the screen with art elements.
Start loading the game into the (now hidden) game window.
Move out the transition window elements to show the game window.
Play the game.
Move in the transition window elements to hide the game window.
Repeat
Is there some other snazzy magical benefit to using three scene windows that I'm not seeing? :) The frame rate definitely drops a bit and things get choppy while the game level is loading in the background, so I'd be a little worried about playing the actual game while another level is loading in the background.
Hehe yeah my game is perhaps a little bit like wario ware... It's so easy to quickly prototype and test many different game possibilities with TGB... But I imagine a ton of time will be spent on the final polish for all these games... :P
Thanks again for all your help.
Tom
#3
If two windows is sufficient, then two is sufficient.
As for the hesitations ... not quite sure ... you may benefit from tweaking the loadLevel functionality or possibly performing a custom level into the background window ... something that doesn't require as much CPU ...
Maybe disable the 'onLevelLoaded' callback and force the call when the level is ready ...
03/12/2007 (8:10 am)
The purpose for the three was so that the next level, current level and transition animation could all load independantly of each other ... no other real reason ... If two windows is sufficient, then two is sufficient.
As for the hesitations ... not quite sure ... you may benefit from tweaking the loadLevel functionality or possibly performing a custom level into the background window ... something that doesn't require as much CPU ...
Maybe disable the 'onLevelLoaded' callback and force the call when the level is ready ...
#4
I guess I'll have to eventually dive into the source code to tweak everything, but I'd like to hold off on that until it becomes absolutely necessary...
I'm sure I'll be back with more questions... but hopefully soon I'll be able to help out here as well. ;)
Tom
03/14/2007 (6:30 am)
Thanks for all your help... It's lookin' pretty good now! ;)I guess I'll have to eventually dive into the source code to tweak everything, but I'd like to hold off on that until it becomes absolutely necessary...
I'm sure I'll be back with more questions... but hopefully soon I'll be able to help out here as well. ;)
Tom
Associate David Higgins
DPHCoders.com
Placing all three scene windows in a mainScreen.gui for example, then loading into each of them the respective levels ...
The 'TransitionSceneWindow' would store a pre-loaded animation, such as a pre-determined animated sprite, or perhaps some custom code to make objects move around and do something, or even a static background with one or a few moving objects to simulate movement (ie; Mario Ware Smooth Moves style for the Wii)
The 'PreloadSceneWindow' would be the SceneWindow that loads your next level in the background while your player is engaged in the 'GameSceneWindow' ... you would then swap the scene windows around to change there view order ... then swap your GameWindow for your PreLoadWindow ...
ie;
[code]
Game Starts
Player clicks 'Start' in Menu
mainScreen GUI is loaded
GameWindow calls loadLevel first ...
TransitionWindow calls loadLevel
PreloadWindow calls loadLevel
Player finishes game in gameWindow, TransitionWindow is moved to foreground while PreLoadWindow finishes loading or for a pre-determined period of time ... PreLoadWindow is moved to the foreground, GameWindow calls endLevel and then proceeds to call loadLevel ... process repeats
and erm ... sounds like your making a Mario Ware Smooth Moves style game ... with the 10 second levels and the transitions between that keep the player 'engaged' ... ;)
Good Luck.