Game Development Community

Different Game Types

by N · in Torque Game Engine · 01/30/2008 (8:53 am) · 5 replies

What is the best way to have multiple game types?

Here's what I've been doing so far for DM TDM and KotH. :
My mission file has normal spawn points, team spawn points, and king of the hill triggers.
In the startMissionGui, there is a place to select the game type. From there, either deathmatch.cs, teamdeathmatch.cs, or kingofthehill.cs is loaded. There isn't a game.cs anymore.

Does this sound like a good way to do this?

#1
01/30/2008 (10:21 am)
This is a good way to do different game types imo. Check out the Multi-Gametype Starter by Zod, this is how he did it, and also how I do it.
http://www.garagegames.com/mg/snapshot/view.php?qid=1326
#2
01/30/2008 (12:30 pm)
I have this in the startMissionGui::onWake() function in startMissionGui.gui
SM_MissionType.add("Deathmatch", $Server::MissionType = "Deathmatch");
SM_MissionType.add("Team Deathmatch", $Server::MissionType = "Team Deathmatch");
SM_MissionType.add("King of the Hill", $Server::MissionType = "King Of The Hill");
SM_MissionType.add("Capture the flag", $Server::MissionType = "Capture The Flag");

Then I have this in ./server/scripts/init.cs, under function initServer()

// Load up game server support scripts
   exec("./scripts/commands.cs");
   exec("./scripts/centerPrint.cs");
	if($Server::MissionType $= "Deathmatch")
	{
		exec("./scripts/deathmatch.cs");
	}
	else
	if($Server::MissionType $= "Team Deathmatch")
	{
		exec("./scripts/teamdeathmatch.cs");
	}
		else
	if($Server::MissionType $= "King Of The Hill")
	{
		exec("./scripts/kingOfTheHill.cs");
	}
		else
	if($Server::MissionType $= "Capture The Flag")
	{
		exec("./scripts/captureTheFlag.cs");
	}



So the popupmenu should save the game type as $Server::MissionType, then the corresponding .cs file should load.

Mission loading stops at 100%
#3
01/30/2008 (2:18 pm)
Why did you comment out the else statement? Shouldn't it read

else if ...

instead of:
// else
if ...
#4
01/30/2008 (2:48 pm)
IDK. I just tried without the comments, and it still doesn't work.
#5
01/30/2008 (3:01 pm)
My second block, in ./server/init.cs now looks like this:
// Load up game server support scripts
   exec("./scripts/commands.cs");
   exec("./scripts/centerPrint.cs");
	
	if($Server::MissionType $= "Deathmatch")
	{
		exec("./scripts/deathmatch.cs");
	}
	else if($Server::MissionType $= "Team Deathmatch")
	{
		exec("./scripts/teamdeathmatch.cs");
	}
		else if($Server::MissionType $= "King Of The Hill")
	{
		exec("./scripts/kingOfTheHill.cs");
	}
		else if($Server::MissionType $= "Capture The Flag")
	{
		exec("./scripts/captureTheFlag.cs");
	}