AI Guard Unit
by Mark Holcomb · 11/27/2004 (5:18 pm) · 335 comments
Download Code File
This is my second attempt at making an AI controlled character. The first was an
AIPlayer that would follow paths. This character is a guard unit. The guard will
wait at it's post (spawn point) until it sees a target. It will then attack that
target while trying to close with it.
If the target is lost the bot will wait at the last place it saw the character and
look around for a little bit, and then it will try to return to it's post.
There is a chance the bot will get stuck trying to return, but there is a simple
routine that has the bot try to move in random directions to try and clear itself
of any obstacles between it and it's post. It's not perfect.
The thinking routine is a simple state machine - which can be expanded on to give the bot more responses and actions.
As with my first ai character, I am using a simple system that allows the designer to drop
markers in the game map that will mark where the bots will start out. When the mission is loaded, the markers are detected and bots are spawned at the marker locations. The markers are then hidden from view. (The markers can be left visible to help in map editing.)
The markers for the guards can be given a dynamic variable called respawn. (Assigned to the marker during map editing.) 'Respawn' will determine whether a bot respawns or not upon death.
The bots have an attention setting. How often they scan is determined by their attention level. The bots get more sluggish (freeing up processor time) when targets are too far away. Conversely, the bot becomes incrementally more attentive as targets come within range, and further aware as targets come into sight.
When a target is found in range and in sight the bot will shoot at the target. The firing sequence is a step of scheduled calls that call for a firing cycle, a trigger down cycle, and a firing delay to control bot rate of fire.
When a bot is attacked it will attempt to sideatep and it's field of vision is temporarily increased to a 360deg field of vision - to emulate looking around to see what happened. The bot's attention level is also set to make it think at it's fastest rate when attacked.
To use the AIGuard...the following changes need to be made.
1. Back up your original game.cs, player.cs, and your current build of Torque. To install AIGuard will require a recompile, since I have created a new class cloned by copying AIPlayer.cc and AIPlayer.h and renaming all references to AIPlayer to AIGuard.
(I did this because I wanted to be able to run both my AIPatroller and AIGuards in the same maps and did not want to have any confusion between them.)
2. Add the files AIGuard.cc and AIGuard.h to your Torque project. (In my instance I saved them to my c:\Torque\engine\game directory and then added them into my project.)
3. Recompile your project and copy your new executable to the appropriate directory for your app.
4. Copy the file AIGuard.cs into your server/scripts directory.
5. Modify game.cs to add the line
to the function onServerCreated().
6. Also in game.cs: The section for function StartGame needs to modified the following ways:
Below the lines that read:
add this:
(If you followed my previous resource you may not have any reference to AImanager. Don't fret... just look for the place in game.cs where you have
and put in
right underneath it.
7. In player.cs in the code for Armor::Damage modify the lines
to read:
*** If you followed my previous resource there should be no need to change this code.
8. Load your map - Stronghold as an example.
9. Go into the map editor. (F11) Then go into the Editor Creator (F4)
10. Under Shapes there should be a drop down called AIMarker, under that a new item called AIGuard.
11. Create a new AIGuard marker.
12. Select your marker, position it where you like and hit (F3) to modify the marker.
13. If you want to override the default respawn value - create a dynamic variable called respawn and set it's value to true or false.
14. Update your item by clicking 'APPLY'- very important and easy to miss step.
15. Save your mission and reload it.
A bot called Guard1 should appear at the spot of your marker.
If you come within range of the guard he should shoot at you and try to hunt you down.
If you get away, or when you die, he should return to his post.
I hope the resource helps other people get up and running with some AI code in their game.
And again, I'd like to thank the other members of this website whose code has been used in several places in the scripting to make this all work.
Mark H.
P.S. I've also included my AIPatrol class files with this - to install it follow the same instructions as for AIGuard, just substitute AIPatrol where AIGuard appears in the instructions. They can both be run at the same times with no problems.
P.S.S. 11/28/04 - I modified the AIPatrol.cs file to correct for a couple of typos.
P.S.S.S 12/3/04 - Added ammo and health seeking capabilities and fixed some errors. (Read posts below - or file in .zip for full details.)
This is my second attempt at making an AI controlled character. The first was an
AIPlayer that would follow paths. This character is a guard unit. The guard will
wait at it's post (spawn point) until it sees a target. It will then attack that
target while trying to close with it.
If the target is lost the bot will wait at the last place it saw the character and
look around for a little bit, and then it will try to return to it's post.
There is a chance the bot will get stuck trying to return, but there is a simple
routine that has the bot try to move in random directions to try and clear itself
of any obstacles between it and it's post. It's not perfect.
The thinking routine is a simple state machine - which can be expanded on to give the bot more responses and actions.
As with my first ai character, I am using a simple system that allows the designer to drop
markers in the game map that will mark where the bots will start out. When the mission is loaded, the markers are detected and bots are spawned at the marker locations. The markers are then hidden from view. (The markers can be left visible to help in map editing.)
The markers for the guards can be given a dynamic variable called respawn. (Assigned to the marker during map editing.) 'Respawn' will determine whether a bot respawns or not upon death.
The bots have an attention setting. How often they scan is determined by their attention level. The bots get more sluggish (freeing up processor time) when targets are too far away. Conversely, the bot becomes incrementally more attentive as targets come within range, and further aware as targets come into sight.
When a target is found in range and in sight the bot will shoot at the target. The firing sequence is a step of scheduled calls that call for a firing cycle, a trigger down cycle, and a firing delay to control bot rate of fire.
When a bot is attacked it will attempt to sideatep and it's field of vision is temporarily increased to a 360deg field of vision - to emulate looking around to see what happened. The bot's attention level is also set to make it think at it's fastest rate when attacked.
To use the AIGuard...the following changes need to be made.
1. Back up your original game.cs, player.cs, and your current build of Torque. To install AIGuard will require a recompile, since I have created a new class cloned by copying AIPlayer.cc and AIPlayer.h and renaming all references to AIPlayer to AIGuard.
(I did this because I wanted to be able to run both my AIPatroller and AIGuards in the same maps and did not want to have any confusion between them.)
2. Add the files AIGuard.cc and AIGuard.h to your Torque project. (In my instance I saved them to my c:\Torque\engine\game directory and then added them into my project.)
3. Recompile your project and copy your new executable to the appropriate directory for your app.
4. Copy the file AIGuard.cs into your server/scripts directory.
5. Modify game.cs to add the line
exec("./aiGuard.cs"); to the function onServerCreated().
6. Also in game.cs: The section for function StartGame needs to modified the following ways:
Below the lines that read:
// Start the AIManager
new ScriptObject(AIManager) {};
MissionCleanup.add(AIManager);
AIManager.think();add this:
AIGuard::LoadEntities();
(If you followed my previous resource you may not have any reference to AImanager. Don't fret... just look for the place in game.cs where you have
AIPlayer::LoadEntities
and put in
AIGuard::LoadEntities();
right underneath it.
7. In player.cs in the code for Armor::Damage modify the lines
// Deal with client callbacks here because we don't have this
// information in the onDamage or onDisable methods
%client = %obj.client;
%sourceClient = %sourceObject ? %sourceObject.client : 0;
if (%obj.getState() $= "Dead")
%client.onDeath(%sourceObject, %sourceClient, %damageType, %location);to read:
// Deal with client callbacks here because we don't have this
// information in the onDamage or onDisable methods
%client = %obj.client;
%sourceClient = %sourceObject ? %sourceObject.client : 0; if (%obj.isbot == true)
{
%obj.attentionlevel=1;
%obj.enhancefov(%obj);
}
if (%obj.getState() $= "Dead")
{
if (%obj.isbot == true)
{
if (%obj.respawn == true)
{
%obj.delaybeforerespawn(%obj.botname, %obj.markerpos, %obj.marker);
%this.player=0;
}
}
else
{
%client.onDeath(%sourceObject, %sourceClient, %damageType, %location);
}
}*** If you followed my previous resource there should be no need to change this code.
8. Load your map - Stronghold as an example.
9. Go into the map editor. (F11) Then go into the Editor Creator (F4)
10. Under Shapes there should be a drop down called AIMarker, under that a new item called AIGuard.
11. Create a new AIGuard marker.
12. Select your marker, position it where you like and hit (F3) to modify the marker.
13. If you want to override the default respawn value - create a dynamic variable called respawn and set it's value to true or false.
14. Update your item by clicking 'APPLY'- very important and easy to miss step.
15. Save your mission and reload it.
A bot called Guard1 should appear at the spot of your marker.
If you come within range of the guard he should shoot at you and try to hunt you down.
If you get away, or when you die, he should return to his post.
I hope the resource helps other people get up and running with some AI code in their game.
And again, I'd like to thank the other members of this website whose code has been used in several places in the scripting to make this all work.
Mark H.
P.S. I've also included my AIPatrol class files with this - to install it follow the same instructions as for AIGuard, just substitute AIPatrol where AIGuard appears in the instructions. They can both be run at the same times with no problems.
P.S.S. 11/28/04 - I modified the AIPatrol.cs file to correct for a couple of typos.
P.S.S.S 12/3/04 - Added ammo and health seeking capabilities and fixed some errors. (Read posts below - or file in .zip for full details.)
#282
I smoothly ported to TGEA. No errors but some issues are there though.
Did you added aipattrol.h and cpp into VS too?
01/24/2008 (11:43 pm)
@JoshuaI smoothly ported to TGEA. No errors but some issues are there though.
Did you added aipattrol.h and cpp into VS too?
#283
It also doesnt help that I havent worked with Torque or programmed in c++ for almost a year now.
01/25/2008 (8:46 am)
No, just the AIGuard at this point. I like taking these things in small steps so I dont have alot to undo when errors occur. I'm actually finding very little helpful documentation on TGEA. I am actually using the default game.cs file that came with TGEA which I see is different from the one used by TGE. I believe I am at a point where I will need to sit down for a couple days and disect all of the differences between the two engines. I was under the assumption when purchasing TGEA, that the upgraded terrain engine and shader capabilities were the major changes, but so many of the server scripts were changed. I havent even looked into the actual c++ files to see what changes may have been made to other game realted files.It also doesnt help that I havent worked with Torque or programmed in c++ for almost a year now.
#284
My post is apparently too long to be posted on this comments page.
Please anyone who can help me with the AIGuardUnit please download the documentation file, i posted all my problems with the AIGuardUnit there:
http://cyrofila.net/AIGuardUnitError.doc
One major problem i face is: starter.fps/server/scripts/aiGuard.cs(350): Unable to instantiate a non-conoobject class AIGuard
Hope theres someone out there who can help me.
You may email me back if you wish at : cyrofila@yahoo.com or cyrofila@hotmail.com
Thank you
01/29/2008 (3:54 am)
Thank you Mark for the wonderful resource.My post is apparently too long to be posted on this comments page.
Please anyone who can help me with the AIGuardUnit please download the documentation file, i posted all my problems with the AIGuardUnit there:
http://cyrofila.net/AIGuardUnitError.doc
One major problem i face is: starter.fps/server/scripts/aiGuard.cs(350): Unable to instantiate a non-conoobject class AIGuard
Hope theres someone out there who can help me.
You may email me back if you wish at : cyrofila@yahoo.com or cyrofila@hotmail.com
Thank you
#285
01/29/2008 (3:56 am)
#286
Richard Blumenstein
02/12/2008 (5:34 pm)
I have been having a problem with AI Guard and patrol. I use Kork or one of my custom models and it works great, those little guys come running to me from all the way across the board, but I have this one model that they will not see until I turn around and then they shoot me in the back. Does anybody know what this is about?Richard Blumenstein
#287
I don't have an exact answer, but the issue has something to do with the bounding box and how the ai shoot a trace to the target object. I haven't solved it myself... but what I think is happening is that the point that the bounding box of the ai that I have is being pushed below the terrain somehow. I have some mechs that if I scale them to the size I'd like them to be, they only see me when my back is turned, but if I leave them at about 1/4 the scale they see me fine.
I know this isn't exactly an answer, but maybe it will give you something to go on.
02/12/2008 (6:08 pm)
@Richard, I don't have an exact answer, but the issue has something to do with the bounding box and how the ai shoot a trace to the target object. I haven't solved it myself... but what I think is happening is that the point that the bounding box of the ai that I have is being pushed below the terrain somehow. I have some mechs that if I scale them to the size I'd like them to be, they only see me when my back is turned, but if I leave them at about 1/4 the scale they see me fine.
I know this isn't exactly an answer, but maybe it will give you something to go on.
#288
Looked into auGuard.cs and aiGuard.cc but cannot find any hint though.
Give me some light! :-)
02/21/2008 (5:16 am)
wonder underlying mechanism how the AI guard changes its animations? e.g. Idle -> Run etc.Looked into auGuard.cs and aiGuard.cc but cannot find any hint though.
Give me some light! :-)
#290
Thank you, it was stupid on me how I can missed the point. :/
BTW, is there any other AI related resource whcih does not derive Player class or any other way to use a model which only has root, run, attack and death animations?
02/21/2008 (7:33 am)
@GianfrancoThank you, it was stupid on me how I can missed the point. :/
BTW, is there any other AI related resource whcih does not derive Player class or any other way to use a model which only has root, run, attack and death animations?
#291
When I load the mission file up as a standalone-single player, everything works great. But if I start up a dedicated server mission, then join that mission, the AIGuard animations do not play. The main player's animations play, just not the bot's. Any ideas? I have spun my wheels on this for a while and haven't been able to make any sense of it yet.
-Jason
03/09/2008 (6:23 am)
Hey guys... got a question for ya... I have integrated the resource, and it is working fabulously... except for one issue.When I load the mission file up as a standalone-single player, everything works great. But if I start up a dedicated server mission, then join that mission, the AIGuard animations do not play. The main player's animations play, just not the bot's. Any ideas? I have spun my wheels on this for a while and haven't been able to make any sense of it yet.
-Jason
#292
03/09/2008 (6:33 am)
Okay, this just in..... if I use the same exact model that my player character uses, then the problem goes away.... it is only when I use another model for AIGuard that the problem arises.
#293
Instead of putting the following code in my aiguard.cs file:
// Load dts shapes and merge animations
exec("~/data/shapes/wulf/wulf.cs");
I put it right with the player's animation merge execution within player.cs. That worked fine. Now my bots animations are playing fine on a dedicated server.
Thanks!
03/09/2008 (7:02 am)
Okay, I fixed the problem. Here it is for you guys, FYI.....Instead of putting the following code in my aiguard.cs file:
// Load dts shapes and merge animations
exec("~/data/shapes/wulf/wulf.cs");
I put it right with the player's animation merge execution within player.cs. That worked fine. Now my bots animations are playing fine on a dedicated server.
Thanks!
#295
Here are the error I am getting.
1>------ Build started: Project: TGEDemoAdvanced, Configuration: Release Win32 ------
1>Compiling...
1>aiPatrol.cpp
1>c:\Documents and Settings\Administrator\Desktop\TGEA BUILD 5.8.08 ver. 1.1\engine\source\core\realComp.h(18) : error C2084: function 'bool isEqual(F32,F32)' already has a body
1> c:\Documents and Settings\Administrator\Desktop\TGEA BUILD 5.8.08 ver. 1.1\engine\source\math/mMathFn.h(337) : see previous definition of 'isEqual'
1>c:\Documents and Settings\Administrator\Desktop\TGEA BUILD 5.8.08 ver. 1.1\engine\source\core\realComp.h(23) : error C2084: function 'bool isZero(F32)' already has a body
1> c:\Documents and Settings\Administrator\Desktop\TGEA BUILD 5.8.08 ver. 1.1\engine\source\math/mMathFn.h(342) : see previous definition of 'isZero'
1>..\..\..\..\..\engine\source\AI\aiPatrol.cpp(138) : warning C4551: function call missing argument list
1>..\..\..\..\..\engine\source\AI\aiPatrol.cpp(138) : warning C4551: function call missing argument list
1>..\..\..\..\..\engine\source\AI\aiPatrol.cpp(138) : error C3861: 'isZero': identifier not found
1>..\..\..\..\..\engine\source\AI\aiPatrol.cpp(138) : error C3861: 'isZero': identifier not found
1>..\..\..\..\..\engine\source\AI\aiPatrol.cpp(144) : warning C4305: '-=' : truncation from 'double' to 'F32'
1>..\..\..\..\..\engine\source\AI\aiPatrol.cpp(146) : warning C4305: '+=' : truncation from 'double' to 'F32'
1>..\..\..\..\..\engine\source\AI\aiPatrol.cpp(154) : warning C4305: '+=' : truncation from 'double' to 'F32'
1>..\..\..\..\..\engine\source\AI\aiPatrol.cpp(156) : warning C4305: '-=' : truncation from 'double' to 'F32'
1>..\..\..\..\..\engine\source\AI\aiPatrol.cpp(160) : warning C4305: '-=' : truncation from 'double' to 'F32'
1>..\..\..\..\..\engine\source\AI\aiPatrol.cpp(162) : warning C4305: '+=' : truncation from 'double' to 'F32'
1>..\..\..\..\..\engine\source\AI\aiPatrol.cpp(204) : error C3861: 'isZero': identifier not found
1>..\..\..\..\..\engine\source\AI\aiPatrol.cpp(207) : error C3861: 'isZero': identifier not found
1>..\..\..\..\..\engine\source\AI\aiPatrol.cpp(297) : error C2665: 'Con::executef' : none of the 20 overloads could convert all the argument types
1> c:\Documents and Settings\Administrator\Desktop\TGEA BUILD 5.8.08 ver. 1.1\engine\source\console/console.h(532): could be 'const char *Con::executef(const char *,const char *,const char *,const char *)'
1> c:\Documents and Settings\Administrator\Desktop\TGEA BUILD 5.8.08 ver. 1.1\engine\source\console/console.h(560): or 'const char *Con::executef(SimObject *,const char *,const char *,const char *)'
1> while trying to match the argument list '(GameBaseData *, int, const char *, const char *)'
1>aiGuard.cpp
1>c:\Documents and Settings\Administrator\Desktop\TGEA BUILD 5.8.08 ver. 1.1\engine\source\core\realComp.h(18) : error C2084: function 'bool isEqual(F32,F32)' already has a body
1> c:\Documents and Settings\Administrator\Desktop\TGEA BUILD 5.8.08 ver. 1.1\engine\source\math/mMathFn.h(337) : see previous definition of 'isEqual'
1>c:\Documents and Settings\Administrator\Desktop\TGEA BUILD 5.8.08 ver. 1.1\engine\source\core\realComp.h(23) : error C2084: function 'bool isZero(F32)' already has a body
1> c:\Documents and Settings\Administrator\Desktop\TGEA BUILD 5.8.08 ver. 1.1\engine\source\math/mMathFn.h(342) : see previous definition of 'isZero'
1>..\..\..\..\..\engine\source\AI\aiGuard.cpp(138) : warning C4551: function call missing argument list
1>..\..\..\..\..\engine\source\AI\aiGuard.cpp(138) : warning C4551: function call missing argument list
1>..\..\..\..\..\engine\source\AI\aiGuard.cpp(138) : error C3861: 'isZero': identifier not found
1>..\..\..\..\..\engine\source\AI\aiGuard.cpp(138) : error C3861: 'isZero': identifier not found
1>..\..\..\..\..\engine\source\AI\aiGuard.cpp(144) : warning C4305: '-=' : truncation from 'double' to 'F32'
1>..\..\..\..\..\engine\source\AI\aiGuard.cpp(146) : warning C4305: '+=' : truncation from 'double' to 'F32'
1>..\..\..\..\..\engine\source\AI\aiGuard.cpp(154) : warning C4305: '+=' : truncation from 'double' to 'F32'
1>..\..\..\..\..\engine\source\AI\aiGuard.cpp(156) : warning C4305: '-=' : truncation from 'double' to 'F32'
1>..\..\..\..\..\engine\source\AI\aiGuard.cpp(160) : warning C4305: '-=' : truncation from 'double' to 'F32'
1>..\..\..\..\..\engine\source\AI\aiGuard.cpp(162) : warning C4305: '+=' : truncation from 'double' to 'F32'
1>..\..\..\..\..\engine\source\AI\aiGuard.cpp(204) : error C3861: 'isZero': identifier not found
1>..\..\..\..\..\engine\source\AI\aiGuard.cpp(207) : error C3861: 'isZero': identifier not found
1>..\..\..\..\..\engine\source\AI\aiGuard.cpp(297) : error C2665: 'Con::executef' : none of the 20 overloads could convert all the argument types
1> c:\Documents and Settings\Administrator\Desktop\TGEA BUILD 5.8.08 ver. 1.1\engine\source\console/console.h(532): could be 'const char *Con::executef(const char *,const char *,const char *,const char *)'
1> c:\Documents and Settings\Administrator\Desktop\TGEA BUILD 5.8.08 ver. 1.1\engine\source\console/console.h(560): or 'const char *Con::executef(SimObject *,const char *,const char *,const char *)'
1> while trying to match the argument list '(GameBaseData *, int, const char *, const char *)'
1>Generating Code...
1>Creating browse information file...
1>Microsoft Browse Information Maintenance Utility Version 9.00.21022
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>Build log was saved at "file://c:\Documents and Settings\Administrator\Desktop\TGEA BUILD 5.8.08 ver. 1.1\GameExamples\FistFullofWontons\buildFiles\VisualStudio 2008\Link\VC2k8.Release.Win32\TGEDemoAdvanced\BuildLog.htm"
1>TGEDemoAdvanced - 14 error(s), 16 warning(s)
========== Build: 0 succeeded, 1 failed, 8 up-to-date, 0 skipped ==========
Any help would be great.
Thank you
Rick
05/09/2008 (12:55 am)
I am trying to import the aiguard into the TGEA 1.7 engine but I run into a little problem.Here are the error I am getting.
1>------ Build started: Project: TGEDemoAdvanced, Configuration: Release Win32 ------
1>Compiling...
1>aiPatrol.cpp
1>c:\Documents and Settings\Administrator\Desktop\TGEA BUILD 5.8.08 ver. 1.1\engine\source\core\realComp.h(18) : error C2084: function 'bool isEqual(F32,F32)' already has a body
1> c:\Documents and Settings\Administrator\Desktop\TGEA BUILD 5.8.08 ver. 1.1\engine\source\math/mMathFn.h(337) : see previous definition of 'isEqual'
1>c:\Documents and Settings\Administrator\Desktop\TGEA BUILD 5.8.08 ver. 1.1\engine\source\core\realComp.h(23) : error C2084: function 'bool isZero(F32)' already has a body
1> c:\Documents and Settings\Administrator\Desktop\TGEA BUILD 5.8.08 ver. 1.1\engine\source\math/mMathFn.h(342) : see previous definition of 'isZero'
1>..\..\..\..\..\engine\source\AI\aiPatrol.cpp(138) : warning C4551: function call missing argument list
1>..\..\..\..\..\engine\source\AI\aiPatrol.cpp(138) : warning C4551: function call missing argument list
1>..\..\..\..\..\engine\source\AI\aiPatrol.cpp(138) : error C3861: 'isZero': identifier not found
1>..\..\..\..\..\engine\source\AI\aiPatrol.cpp(138) : error C3861: 'isZero': identifier not found
1>..\..\..\..\..\engine\source\AI\aiPatrol.cpp(144) : warning C4305: '-=' : truncation from 'double' to 'F32'
1>..\..\..\..\..\engine\source\AI\aiPatrol.cpp(146) : warning C4305: '+=' : truncation from 'double' to 'F32'
1>..\..\..\..\..\engine\source\AI\aiPatrol.cpp(154) : warning C4305: '+=' : truncation from 'double' to 'F32'
1>..\..\..\..\..\engine\source\AI\aiPatrol.cpp(156) : warning C4305: '-=' : truncation from 'double' to 'F32'
1>..\..\..\..\..\engine\source\AI\aiPatrol.cpp(160) : warning C4305: '-=' : truncation from 'double' to 'F32'
1>..\..\..\..\..\engine\source\AI\aiPatrol.cpp(162) : warning C4305: '+=' : truncation from 'double' to 'F32'
1>..\..\..\..\..\engine\source\AI\aiPatrol.cpp(204) : error C3861: 'isZero': identifier not found
1>..\..\..\..\..\engine\source\AI\aiPatrol.cpp(207) : error C3861: 'isZero': identifier not found
1>..\..\..\..\..\engine\source\AI\aiPatrol.cpp(297) : error C2665: 'Con::executef' : none of the 20 overloads could convert all the argument types
1> c:\Documents and Settings\Administrator\Desktop\TGEA BUILD 5.8.08 ver. 1.1\engine\source\console/console.h(532): could be 'const char *Con::executef(const char *,const char *,const char *,const char *)'
1> c:\Documents and Settings\Administrator\Desktop\TGEA BUILD 5.8.08 ver. 1.1\engine\source\console/console.h(560): or 'const char *Con::executef(SimObject *,const char *,const char *,const char *)'
1> while trying to match the argument list '(GameBaseData *, int, const char *, const char *)'
1>aiGuard.cpp
1>c:\Documents and Settings\Administrator\Desktop\TGEA BUILD 5.8.08 ver. 1.1\engine\source\core\realComp.h(18) : error C2084: function 'bool isEqual(F32,F32)' already has a body
1> c:\Documents and Settings\Administrator\Desktop\TGEA BUILD 5.8.08 ver. 1.1\engine\source\math/mMathFn.h(337) : see previous definition of 'isEqual'
1>c:\Documents and Settings\Administrator\Desktop\TGEA BUILD 5.8.08 ver. 1.1\engine\source\core\realComp.h(23) : error C2084: function 'bool isZero(F32)' already has a body
1> c:\Documents and Settings\Administrator\Desktop\TGEA BUILD 5.8.08 ver. 1.1\engine\source\math/mMathFn.h(342) : see previous definition of 'isZero'
1>..\..\..\..\..\engine\source\AI\aiGuard.cpp(138) : warning C4551: function call missing argument list
1>..\..\..\..\..\engine\source\AI\aiGuard.cpp(138) : warning C4551: function call missing argument list
1>..\..\..\..\..\engine\source\AI\aiGuard.cpp(138) : error C3861: 'isZero': identifier not found
1>..\..\..\..\..\engine\source\AI\aiGuard.cpp(138) : error C3861: 'isZero': identifier not found
1>..\..\..\..\..\engine\source\AI\aiGuard.cpp(144) : warning C4305: '-=' : truncation from 'double' to 'F32'
1>..\..\..\..\..\engine\source\AI\aiGuard.cpp(146) : warning C4305: '+=' : truncation from 'double' to 'F32'
1>..\..\..\..\..\engine\source\AI\aiGuard.cpp(154) : warning C4305: '+=' : truncation from 'double' to 'F32'
1>..\..\..\..\..\engine\source\AI\aiGuard.cpp(156) : warning C4305: '-=' : truncation from 'double' to 'F32'
1>..\..\..\..\..\engine\source\AI\aiGuard.cpp(160) : warning C4305: '-=' : truncation from 'double' to 'F32'
1>..\..\..\..\..\engine\source\AI\aiGuard.cpp(162) : warning C4305: '+=' : truncation from 'double' to 'F32'
1>..\..\..\..\..\engine\source\AI\aiGuard.cpp(204) : error C3861: 'isZero': identifier not found
1>..\..\..\..\..\engine\source\AI\aiGuard.cpp(207) : error C3861: 'isZero': identifier not found
1>..\..\..\..\..\engine\source\AI\aiGuard.cpp(297) : error C2665: 'Con::executef' : none of the 20 overloads could convert all the argument types
1> c:\Documents and Settings\Administrator\Desktop\TGEA BUILD 5.8.08 ver. 1.1\engine\source\console/console.h(532): could be 'const char *Con::executef(const char *,const char *,const char *,const char *)'
1> c:\Documents and Settings\Administrator\Desktop\TGEA BUILD 5.8.08 ver. 1.1\engine\source\console/console.h(560): or 'const char *Con::executef(SimObject *,const char *,const char *,const char *)'
1> while trying to match the argument list '(GameBaseData *, int, const char *, const char *)'
1>Generating Code...
1>Creating browse information file...
1>Microsoft Browse Information Maintenance Utility Version 9.00.21022
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>Build log was saved at "file://c:\Documents and Settings\Administrator\Desktop\TGEA BUILD 5.8.08 ver. 1.1\GameExamples\FistFullofWontons\buildFiles\VisualStudio 2008\Link\VC2k8.Release.Win32\TGEDemoAdvanced\BuildLog.htm"
1>TGEDemoAdvanced - 14 error(s), 16 warning(s)
========== Build: 0 succeeded, 1 failed, 8 up-to-date, 0 skipped ==========
Any help would be great.
Thank you
Rick
#296
Although mine compiled, I never got it working completely correct.
05/09/2008 (4:12 am)
Didi you use the files above or copy your player.c and .h files from 1.7 and use them? I was doing the same a few weeks ago and it compiled, but I copied over the player files and change player to aiguard. I do not think you can use the above files in 1.7Although mine compiled, I never got it working completely correct.
#297
05/09/2008 (10:28 pm)
I used the player.cpp and .h form 1.7 and I also went into the coding for the aiguard.h and cpp and made sure every thing was pointing to the right location. However I did add realComp.h form the older version of the engine 1.5.2 because the 1.7 did not have it. I think this is want is causing my problem but when I take it out I still can not complie correctly.
#298
"2. Add the files AIGuard.cc and AIGuard.h to your Torque project. (In my instance I saved them to my c:\Torque\engine\game directory and then added them into my project.)"
After i saved to my c:\Torque\engine\game directory, how would i add them to my project?
"3. Recompile your project and copy your new executable to the appropriate directory for your app."
How do i recompile? and then can someone explain this last part of the step to me?
thanks i've always had trouble with those kind of things, even though i get everything else.
05/11/2008 (8:47 am)
so i know nothing about .h and .cc files... "2. Add the files AIGuard.cc and AIGuard.h to your Torque project. (In my instance I saved them to my c:\Torque\engine\game directory and then added them into my project.)"
After i saved to my c:\Torque\engine\game directory, how would i add them to my project?
"3. Recompile your project and copy your new executable to the appropriate directory for your app."
How do i recompile? and then can someone explain this last part of the step to me?
thanks i've always had trouble with those kind of things, even though i get everything else.
#299
05/13/2008 (8:45 am)
I have a problem, They work, but they don't shoot me, (and they not holding a weapon) and i can't hurt them
#300
05/14/2008 (7:32 am)
can anyone help me? (second post up from this) 
Torque Owner Joshua Parker
Default Studio Name