Load up objects and mount them during loading screen
by James Terry · in Torque Game Engine · 11/30/2006 (8:32 am) · 14 replies
Hello,
I am currently setting up my environment to create a bunch of objects mount them to specific points. I want to be able to hide all of this by putting it behind the loading screen.
Currently when I load up my mission, I get a very quick loading screen, then I pop into the game, see my base object and see things get mounted onto it. I've tried sticking the code for all the object creation and mounting into the mission file, into onMissionLoaded, and a few other places but to no avail, each results in me entering the mission before all the objects have been loaded.
Is there a way to add them to the load mission progress bar so the game won't start until they are loaded?
Thanks
I am currently setting up my environment to create a bunch of objects mount them to specific points. I want to be able to hide all of this by putting it behind the loading screen.
Currently when I load up my mission, I get a very quick loading screen, then I pop into the game, see my base object and see things get mounted onto it. I've tried sticking the code for all the object creation and mounting into the mission file, into onMissionLoaded, and a few other places but to no avail, each results in me entering the mission before all the objects have been loaded.
Is there a way to add them to the load mission progress bar so the game won't start until they are loaded?
Thanks
#2
11/30/2006 (9:00 am)
Hmm, now I need to figure out how to make loading GUI fade out
#3
Its in there, its already being used, im just suggesting you use it to buy yourself a few seconds after the mission loading is done, to somewhat hide this mounting problem of yours.
11/30/2006 (9:06 am)
Not the loading GUI, the uh, *scratches head* Fade bitmap GUI? Its in there, its already being used, im just suggesting you use it to buy yourself a few seconds after the mission loading is done, to somewhat hide this mounting problem of yours.
#4
I just don't know where to put my function calls.
11/30/2006 (11:23 am)
I'd much rather like to figure out a way to load things up in the mission loading routines rather then after the mission is loaded.I just don't know where to put my function calls.
#5
I'd create a fourth phase (after lighting), to do all your mounting and arranging.
Or, if you go to common\server\missionDownload.cs, there is a function called serverCmdMissionStartPhase3Ack. This is where the loading screen dies and startMission + onClientEnterGame gets called. Just do your routines before these two functions, and you are set.
11/30/2006 (11:36 am)
@James - look into common\client\missionDownload.cs and yourGame\client\scripts\missionDownload.cs.I'd create a fourth phase (after lighting), to do all your mounting and arranging.
Or, if you go to common\server\missionDownload.cs, there is a function called serverCmdMissionStartPhase3Ack. This is where the loading screen dies and startMission + onClientEnterGame gets called. Just do your routines before these two functions, and you are set.
#6
11/30/2006 (11:39 am)
Or that.
#7
11/30/2006 (11:51 am)
Hmm, I guess a proper question right now would be is there a way to lock the game so that nothing else will process while a skin is loading or an object is mounting?
#8
11/30/2006 (12:40 pm)
I'm not sure why your having this issue in the first place... What is it your doing, in detail?
#9
Each of these faces has 16 mount points to stick numbered objects on. So I have a total of 96 number objects coming in (some have numbers, some are blank) in addition to the 7 objects I initially created to mount them all to their positions
11/30/2006 (12:46 pm)
I have a Cube with 6 mount points (for each face)Each of these faces has 16 mount points to stick numbered objects on. So I have a total of 96 number objects coming in (some have numbers, some are blank) in addition to the 7 objects I initially created to mount them all to their positions
#10
Anyway, Michael Perry's post should help you out.
11/30/2006 (1:02 pm)
Im slightly confused by that description. a cube, that has 6 mount points, (confusion) that have 16 mounts each?Anyway, Michael Perry's post should help you out.
#11
here is a code snippet
rotatingcube is a cube with 6 mount points
sides1-6 are each cubes with a width of .1 to serve as faces on the rotatingcube, each side has 16 mount points
cells1-96 are each cells on a fact of the cube, each side has a 4x4 grid on it for the numbers contained within each cell, they are in arrays, such that cells[1,0] is the first cell on side 1
for (%i = 1; %i <= 6; %i++)
{
rotatingcube.mountObject(side[%i], %i);
for (%j = 0; %j <16; %j++)
{
cells[%i,%j].setSkinName(addTaggedString("number" @ getRandom(0,15)));
side[%i].mountObject(cells[%i,%j], %j);
}
}
When I run this section of code, no matter where I put it, it runs it all, then continues to the next section of code while textures and objects are still in the progress of appearing.
I'd like to put this all behind the loading screen, maybe have some progress indicator, and not show my scene until all of the mounts and texture loading are complete
11/30/2006 (1:12 pm)
Yeah, I tried Micheal Perry's suggestion and it achieved the same effecthere is a code snippet
rotatingcube is a cube with 6 mount points
sides1-6 are each cubes with a width of .1 to serve as faces on the rotatingcube, each side has 16 mount points
cells1-96 are each cells on a fact of the cube, each side has a 4x4 grid on it for the numbers contained within each cell, they are in arrays, such that cells[1,0] is the first cell on side 1
for (%i = 1; %i <= 6; %i++)
{
rotatingcube.mountObject(side[%i], %i);
for (%j = 0; %j <16; %j++)
{
cells[%i,%j].setSkinName(addTaggedString("number" @ getRandom(0,15)));
side[%i].mountObject(cells[%i,%j], %j);
}
}
When I run this section of code, no matter where I put it, it runs it all, then continues to the next section of code while textures and objects are still in the progress of appearing.
I'd like to put this all behind the loading screen, maybe have some progress indicator, and not show my scene until all of the mounts and texture loading are complete
#12
12/01/2006 (10:01 am)
Any ideas?
#13
12/01/2006 (10:16 am)
Have you tried this:[b]In common\server\missionDownload.cs, at the bottom:
// YOUR CODE[/b]
function preGameSetup()
{
for (%i = 1; %i <= 6; %i++)
{
rotatingcube.mountObject(side[%i], %i);
for (%j = 0; %j <16; %j++)
{
cells[%i,%j].setSkinName(addTaggedString("number" @ getRandom(0,15)));
side[%i].mountObject(cells[%i,%j], %j);
}
}
}
[b]// NEW FUNCTION [/b]
function preGameSetupComplete(%client, %seq)
{
%client.startMission();
%client.onClientEnterGame();
}
function serverCmdMissionStartPhase3Ack(%client, %seq)
{
// Make sure to ignore calls from a previous mission load
if(%seq != $missionSequence || !$MissionRunning)
return;
if(%client.currentPhase != 2)
return;
%client.currentPhase = 3;
[b] /* CODE CHANGE: COMMENTED THIS OUT AND REPLACED WITH MY OWN FUNCTIONS
// Server is ready to drop into the game
%client.startMission();
%client.onClientEnterGame();
*/
// NEW CODE[/b]
preGameSetup();
schedule(1000, 0, preGameSetupComplete, %client, %seq);
[b]// NEW CODE[/b]
}
#14
Just tried that out, even putting a 5-10 second pause. The loading screen waits there, then pops over to the game and all of the objects load in, nothing happened during the schedule.
12/04/2006 (8:30 am)
:(Just tried that out, even putting a 5-10 second pause. The loading screen waits there, then pops over to the game and all of the objects load in, nothing happened during the schedule.
Torque Owner AllynMcelrath