Single Player Campaign Mode
by Collins College (#0074) · in Torque Game Engine · 01/19/2008 (11:49 pm) · 7 replies
Hello. Im kinda new to the site but I've been studying the TGE for a few months and I think its awesome. However, i'm not a master coder but if anyone has an idea to create a single player mode, like say Half Life 2 for example that loads the map with mission objectives, ect I would greatly appreciate it. The Game Programmers Guide to Torque helped start on building the level but not for having it load or goto another level once its finished, which is the main question I have. Not trying to sound like a noob or anything but if anyone has any ideas i'd appreciate it greatly!
#2
01/20/2008 (4:08 am)
Id have to look into how to use triggers and loading the details of the player onward but that does give me an idea of how to code it. As for the AI ill have to research that, but thanks for the advice! Better to have an idea than to rush in blind ^_^
#3
For example,
There are some syntax and mathematical problems in that, but you get the basic idea.
01/20/2008 (9:16 am)
In terms of AI, what I'm doing for my RPG is using thousands of script objects.(One for each AI) Using this method, you can simply update variables in your script objects and then spawn an AI once the player is within x distance from the script object's numeric position.For example,
new ScriptObject(dlakjfdla)
{
Position = "100, 300, 500";
}
function TestPlayerPos(%player)
{
if((%player.getPosition() - dlakjfdla.Position) < 30 && !dlakjfdla.isReal) //Only spawn him if doesn't already exist
{
dlakjfdla.Actor = SpawnAI(dlakjfdla);
dlakjfdla.isReal = 1;
}
else if(isObject(dlakjfdla.Actor))//If he's past our view range and already exists, delete him
{
dlakjfdla.isReal = 0;
dlakjfdla.Actor.delete();
}There are some syntax and mathematical problems in that, but you get the basic idea.
#4
01/20/2008 (2:56 pm)
@Matt You stop using AIM? Haven't seen you on in forever.
#5
01/20/2008 (10:18 pm)
Yeah, I use MSN more. (eternaldark112@gmail.com)
#6
01/20/2008 (11:31 pm)
I think I understand it. Reading the code isn't that hard its getting it implemented that gives me headaches T_T. But I get the basic concept of what its doing though and this can come in handy :). Anything is of a big help so thanks! ^_^
#7
it clears my client's information doesn't it? All the data it contains is reset as the script is re-executed. Now, how about global variables? if the global variable is inside of player.cs and player.cs is re-executed during the mission load it gets reset as well correct?
If that is the case, than the best option to do would be to dump out your information to a temp file, load the mission and reload that temp file and assign your values?
04/05/2008 (7:48 pm)
Triggers are a great feature, my project uses them pretty heavily. I have a quick question regarding loading missions though, when I load a new mission using the following code// make sure we are not connected to a server already
disconnect();
// Create the server and load the mission
createServer("SinglePlayer", expandFilename("./data/missions/prototype.mis"));
// Make a local connection
%conn = new GameConnection(ServerConnection);
RootGroup.add(ServerConnection);
%conn.setConnectArgs("Player");
%conn.setJoinPassword("None");
%conn.connectLocal();it clears my client's information doesn't it? All the data it contains is reset as the script is re-executed. Now, how about global variables? if the global variable is inside of player.cs and player.cs is re-executed during the mission load it gets reset as well correct?
If that is the case, than the best option to do would be to dump out your information to a temp file, load the mission and reload that temp file and assign your values?
Torque 3D Owner Edward Smith
The mission objectives would be handled by you of cause as well, make like a PAD gui and load up the information of the mission, from the mission object. Look around at how to add a GUI that displays an image of the selected mission and you'll get the idea of how you can store and access the information that you can fill your PAD with as you start the mission.
The main thing you'll have to do I think for a single-player game is the AI, there are quite a few ones around and you may have to take a look at them all to see which works best for you and your type of bad dudes.
I hope this gives you an idea of how you can accomplish your means.