Game Development Community

Game Starts before loading completes

by Matt Sanders · in Torque Game Engine · 03/22/2005 (7:56 pm) · 5 replies

I am not sure if this is a real bug or if there is a work around but I have noticed on both the starter fps and Racing the game will actually start before it is done loading the mission. I started to notice this when I started to add more DTS and Dif objects to the mission and saw that some of my AI code was being executed before lighting was complete.

I later noticed this BIG TIME when I was messing with the racer and noticed that when I put more stuff into the mission the counter will start beeping while the loading screen is still there and I will not be in the actual game until the counter hits 1???

I know that this cannot be an issue with Torque not able to handle all of the dts and DIF because the game still runs flawlessly when it is loaded.
Is this a bug?
If not how do you actually make sure that the game will not start until the mission is loaded.

#1
03/22/2005 (8:03 pm)
I have two ideas for a work around but I was just curious if there is a better way. 1) increase the wait time
2) or prompt a start gui when the players are in the game. (I am not sure but this fix may not work because the gui may pop up when the loading gui is still there.
although maby I can have it called when the loading gui is done.)
#2
03/25/2005 (6:09 am)
Ok I finally found a really good way to handle this. The trick is using the onwake function of the playgui. For the racer game I am using a gui that will let the host wait for players and start the game when they are ready.
#3
03/26/2005 (11:12 am)
Matt, thanks for bringing this up, I've also just started noticing the same thing lately, but haven't taken the time to look into fixing it.

can you go into more specifics about the fix you did for your game when you have a second?

thanks
#4
03/26/2005 (9:43 pm)
No prob Clint

Basically the gui system has a few callbacks that You can use in script to perform actions when the gui is displayed, deleted, etc. The playgui is the Gui that you are seeing when the game is playing (client\ui\playgui.gui).

What I did was opened up client\scripts\playgui.cs (basically just scripts that control different things that happen in the playgui) and in the function
function PlayGui::onWake(%this)

I added this

switch$ ($Server::ServerType) {

            case "SinglePlayer":
                 startGame();

            case "MultiPlayer":
                 ChoosePreGui();

       }

when I did this I also commented out (put // in front of) startGame(); that was in the onMissionLoaded() function in server\scripts\game.cs and common\server\game.cs files. This way the game is not being called when the mission is "so called" loaded but when the playgui is invoked.

basically you could just put startGame(); if you want the reason that I put a switch in there is because I wanted the game to start normally in single player but in multiplayer I have it call a function of mine that throughs up a gui for the server to start the game when he is ready and all of the other players are ready.

Hope this helps.
#5
03/26/2005 (11:28 pm)
Ahh ok. thanks.

I'll try it out and see if that works for me when I get a chance.