Game Development Community

Splash screen rules for gg

by Allan Seguin · in Game Design and Creative Issues · 04/16/2008 (10:33 pm) · 6 replies

I would love to follow splash screen rules for gg but i can't even get a splash screen to work does any know what i am doing wrong here?

#1
04/16/2008 (10:34 pm)
/-----------------------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------

// Load up common script base
loadDir("common");

//-----------------------------------------------------------------------------

// Load up default console values.
exec("./client/defaults.cs");
exec("./server/defaults.cs");

// Preferences (overide defaults)
exec("./prefs.cs");


//-----------------------------------------------------------------------------
// Package overrides to initialize the game
package ttb {

function onStart()
{
// Initialize the client and the server
Parent::onStart();
initServer();
initClient();
$Editor::newMissionOverride = "DarkSkies/data/missions/flat.mis";
}

function onExit()
{
// Save off our current preferences for next time
echo("Exporting prefs");
export("$Pref::*", "./prefs.cs", False);
Parent::onExit();
}

}; // Client package
activatePackage(ttb);


//-----------------------------------------------------------------------------

function initServer()
{
echo("\n--------- Initializing TTB: Server ---------");

// The common module provides the basic server functionality
initBaseServer();

// Load up game server support scripts
exec("./server/game.cs");
}


//-----------------------------------------------------------------------------

function initClient()
{
echo("\n--------- Initializing TTB: Client ---------");

// The common module provides basic client functionality
initBaseClient();

// InitCanvas starts up the graphics system.
// The canvas needs to be constructed before the gui scripts are
// run because many of the controls assume the canvas exists at
// load time.
initCanvas("DarkSkies");

// Load client-side Audio Profiles/Descriptions
exec("./client/audioProfiles.cs");

// Load up the shell and game GUIs
exec("./client/ui/PlayGui.gui");
exec("./client/ui/mainMenuGui.gui");
exec("./client/ui/optionsDlg.gui");
exec("./client/ui/loadingGui.gui");
exec("./client/ui/StartGui.gui");
exec("./client/ui/ChooseGui.gui");

// Client scripts
exec("./client/optionsDlg.cs");
exec("./client/missionDownload.cs");
exec("./client/serverConnection.cs");
exec("./client/loadingGui.cs");
exec("./client/playGui.cs");

// Default player key bindings
exec("./client/default.bind.cs");

// Copy saved script prefs into C++ code.
setShadowDetailLevel( $pref::shadows );
setDefaultFov( $pref::Player::defaultFov );
setZoomSpeed( $pref::Player::zoomSpeed );

// Start up the main menu...
Canvas.setContent(MainMenuGui);
Canvas.setCursor("DefaultCursor");
}


//-----------------------------------------------------------------------------
// LOAD MY MISSION

function loadMyMission()
{
// make sure we are not connected to a server already
disconnect();

// Create the server and load the mission
createServer("SinglePlayer", expandFilename("./data/missions/flat.mis"));

// Make a local connection
%conn = new GameConnection(ServerConnection);
RootGroup.add(ServerConnection);
%conn.setConnectArgs("Player");
%conn.setJoinPassword("None");
%conn.connectLocal();
}
#2
04/16/2008 (10:35 pm)
I know i dont have the code in there for a splash screen but i dotn even now what to put
#3
04/17/2008 (3:43 am)
Try looking in client/ui for StartupGui.cs - have a quick look through the code, it's all fairly self-explanatory. I've never touched a GUI before but worked it out last night.

You can also go into the GUI editor in-game (F10) and select StartupGui.
#4
04/17/2008 (5:39 am)
@Allan - You can also follow this tutorial: GUI Tutorial
#5
04/17/2008 (8:59 am)
I tryed .... but yet agian faild

here is my new main.cs how ever i think my loadSplashScreen(); fuctions does not work with the schedual command

function loadSplashScreen()

{

canvas.setContent(ggSplash);

schedule(100,0,checkSplashTime);

}

I think this is correct ... for syntex does any one know better?




//-----------------------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------

// Load up common script base
loadDir("common");

//-----------------------------------------------------------------------------

// Load up default console values.
exec("./client/defaults.cs");
exec("./server/defaults.cs");

// Preferences (overide defaults)
exec("./prefs.cs");


//-----------------------------------------------------------------------------
// Package overrides to initialize the game
package ttb {

function onStart()
{
// Initialize the client and the server
Parent::onStart();
initServer();
initClient();
$Editor::newMissionOverride = "DarkSkies/data/missions/flat.mis";
}

function onExit()
{
// Save off our current preferences for next time
echo("Exporting prefs");
export("$Pref::*", "./prefs.cs", False);
Parent::onExit();
}

}; // Client package
activatePackage(ttb);


//-----------------------------------------------------------------------------

function initServer()
{
echo("\n--------- Initializing TTB: Server ---------");

// The common module provides the basic server functionality
initBaseServer();

// Load up game server support scripts
exec("./server/game.cs");
}


//-----------------------------------------------------------------------------

function initClient()
{
echo("\n--------- Initializing TTB: Client ---------");

// The common module provides basic client functionality
initBaseClient();

// InitCanvas starts up the graphics system.
// The canvas needs to be constructed before the gui scripts are
// run because many of the controls assume the canvas exists at
// load time.
initCanvas("DarkSkies");

// Load client-side Audio Profiles/Descriptions
exec("./client/audioProfiles.cs");

// Load up the shell and game GUIs
exec("./client/ui/PlayGui.gui");
exec("./client/ui/mainMenuGui.gui");
exec("./client/ui/optionsDlg.gui");
exec("./client/ui/loadingGui.gui");
exec("./client/ui/StartGui.gui");
exec("./client/ui/ChooseGui.gui");
exec("./client/ui/ggSplash.gui");

// Client scripts
exec("./client/optionsDlg.cs");
exec("./client/missionDownload.cs");
exec("./client/serverConnection.cs");
exec("./client/loadingGui.cs");
exec("./client/playGui.cs");

// Default player key bindings
exec("./client/default.bind.cs");

// Copy saved script prefs into C++ code.
setShadowDetailLevel( $pref::shadows );
setDefaultFov( $pref::Player::defaultFov );
setZoomSpeed( $pref::Player::zoomSpeed );

// Start up the main menu...
loadSplashScreen();
Canvas.setCursor("DefaultCursor");
}


//-----------------------------------------------------------------------------
// LOAD MY MISSION

function loadMyMission()
{
// make sure we are not connected to a server already
disconnect();

// Create the server and load the mission
createServer("SinglePlayer", expandFilename("./data/missions/flat.mis"));

// Make a local connection
%conn = new GameConnection(ServerConnection);
RootGroup.add(ServerConnection);
%conn.setConnectArgs("Player");
%conn.setJoinPassword("None");
%conn.connectLocal();
}
function loadMyMission2()
{
// make sure we are not connected to a server already
disconnect();

// Create the server and load the mission
createServer("SinglePlayer", expandFilename("./data/missions/flat2.mis"));

// Make a local connection
%conn = new GameConnection(ServerConnection);
RootGroup.add(ServerConnection);
%conn.setConnectArgs("Player");
%conn.setJoinPassword("None");
%conn.connectLocal();
}
function loadSplashScreen()

{

canvas.setContent(ggSplash);

schedule(100,0,checkSplashTime);

}

function checkSplashTime()

{

if (ggSplash.done)

startGame(expandFilename($Game::DefaultScene));

else

loadSplashScreen();

}
#6
04/17/2008 (10:13 pm)
You are putting your code for Your splash screen in the wrong place.

Open client/scripts/ui/Startup.gui and look at the very bottom of the file. That's where you would load your new splash screen.

//--- OBJECT WRITE END ---

function loadStartup()
{
   StartupGui.done = false;
   Canvas.setContent( StartupGui );
   schedule(100, 0, checkStartupDone );
   alxPlay(AudioStartup);
}
   

//-------------------------------------
function StartupGui::click()
{
   StartupGui.done = true;
}


//-------------------------------------
function checkStartupDone()
{
   if (StartupGui.done)
   {
   	  echo ("*** Load 3Dcentral Splash");
      //loadMainMenu();    //comment out for startup2 to work.
      loadStartup2(); // [b]This starts MY splash screen after GGs splash is done.[/b]

   }
   else
      schedule(100, 0, checkStartupDone );
}