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.)
#162
05/10/2006 (1:23 pm)
Jim: I've not heard of Code Blocks but most people use Visual Studio to build the game engine. If you have never built something in C++ I would recommend that you re-evaluate your goals with building a game from scratch. Maybe take some C++ programming courses in a community college. No one wants to hold someone else's hand every step of the way, particularly if you're starting from ground zero with little-to-no development experience. You're just going to frustrate people and yourself in the process. Take a step back, perhaps try just modding games first (ie: stick to scripting changes only) before you dive head-first into the ocean of game developement. Please do not take all this the wrong way, I'm just trying to point out that implementing C++ resource changes and building Torque is not a simple process. What if something goes wrong and you start getting compile time errors? Are you going to poke and prod the people around you until someone fixes it for you? Not a good idea.
#163
Try following the instructions to get it compiling with Visual Studio 2005 Express(free download) from Microsoft.
I, of course, use the full version of VS.2005
When you get it working, try some of the instructions on how to change some code out and see what errors you get.
If you get errors, search google, GG, etc with those error strings.
It will take some time (6 months to a year) before you are truly comfortable with C++ compiling/coding, but it is not rocket science... you can do it.
Just try to figure out some stuff on your own... even if you have to do C++ tutorials on "Hello World" etc to get an understanding of the compiling process before coming back to Torque.
While you are learning, do some script...
Good luck!
:)
Sumner
05/16/2006 (7:28 am)
While I agree with OneST8, Jim....Try following the instructions to get it compiling with Visual Studio 2005 Express(free download) from Microsoft.
I, of course, use the full version of VS.2005
When you get it working, try some of the instructions on how to change some code out and see what errors you get.
If you get errors, search google, GG, etc with those error strings.
It will take some time (6 months to a year) before you are truly comfortable with C++ compiling/coding, but it is not rocket science... you can do it.
Just try to figure out some stuff on your own... even if you have to do C++ tutorials on "Hello World" etc to get an understanding of the compiling process before coming back to Torque.
While you are learning, do some script...
Good luck!
:)
Sumner
#164
What i've done so far
www.garagegames.com/mg/forums/result.thread.php?qt=45030
05/31/2006 (5:21 am)
how could I do teams for the ai guard resource?What i've done so far
www.garagegames.com/mg/forums/result.thread.php?qt=45030
#165
06/05/2006 (7:23 pm)
Hi All, Quick question - I have my player starting as a vehicle in game.cs, I have Ai guard spawning and searching but it wont attack the vehicle.. has anyone got a quick fix for this?..
#166
I looked through this page, and couldn't find any issue that seemed similar to the problem that I'm having. AIGuard is fully implemented in my game, but there is a problem with how the guards try to return to their posts.
The guards are originally guarding, I approach them, they attack me, this is all fine. If I die or get out of their range, they lumber back towards their posts and say they are "Returning".
will
However, they never quite make it back to the post. They sometimes approach the spot, say "Holding" for a while, and then proceed to sidestep their way across the level, never returning to their post. Other times they will simply skip to sidestepping their way across the level.
Is this a common problem I just haven't found the thread for?
06/08/2006 (11:56 am)
Hi,I looked through this page, and couldn't find any issue that seemed similar to the problem that I'm having. AIGuard is fully implemented in my game, but there is a problem with how the guards try to return to their posts.
The guards are originally guarding, I approach them, they attack me, this is all fine. If I die or get out of their range, they lumber back towards their posts and say they are "Returning".
will
However, they never quite make it back to the post. They sometimes approach the spot, say "Holding" for a while, and then proceed to sidestep their way across the level, never returning to their post. Other times they will simply skip to sidestepping their way across the level.
Is this a common problem I just haven't found the thread for?
#167
If the BotMarker sits too high above the ground plane the bot will return to the x,y position close to the marker's origin, but the z-component might be too far away for the comparison to ever succeed so the bot never can return home.
So try positioning the BotMarkers as close to the ground plane as possible and see if that helps.
Otherwise look through the code and find the comparison value to see if the bot is home and increase it a little at a time and see if that helps.
06/08/2006 (6:46 pm)
It's been forever since I've looked through this code, but I believe that your problem probably comes from the fact that the BotMarker is too high above the ground plane. So what happens is this. When the guard is generated, the bot drops down to the ground level because of gravity. After the bot moves away from his spot he will go into his 'Return' routine. The bot will try to return to the original position of the bot marker. The routine checks the distance between the Guards current x,y,z position, and that of the x,y,z co-ordinates of the BotMarker. If the distance is less than an arbitrary amount (which I can't recall offhand) then the bot has returned home and re-orients itself to the BotMarkers position and orientation.If the BotMarker sits too high above the ground plane the bot will return to the x,y position close to the marker's origin, but the z-component might be too far away for the comparison to ever succeed so the bot never can return home.
So try positioning the BotMarkers as close to the ground plane as possible and see if that helps.
Otherwise look through the code and find the comparison value to see if the bot is home and increase it a little at a time and see if that helps.
#168
I want to create a number of different bots e.g. Human, Robot, Alien.
How would I go about doing this?
06/09/2006 (3:59 am)
One Quick Question, I want to create a number of different bots e.g. Human, Robot, Alien.
How would I go about doing this?
#169
I think I fixed the problem by adding a call to setMoveDestination() to the "Returning" case in Think(). Now the guards run around near their post for a couple of seconds before getting within the threshold and going back to "Guarding". This seems to be fine for most purposes, since a player would probably take more time running from and back to the guard.
I did have to push the Z component down a bit before to take care of another problem, which was that the guard would 'jump' every few seconds (probably trying to get back to the marker that was slightly above it).
Thanks
06/09/2006 (3:46 pm)
@ Mark:I think I fixed the problem by adding a call to setMoveDestination() to the "Returning" case in Think(). Now the guards run around near their post for a couple of seconds before getting within the threshold and going back to "Guarding". This seems to be fine for most purposes, since a player would probably take more time running from and back to the guard.
I did have to push the Z component down a bit before to take care of another problem, which was that the guard would 'jump' every few seconds (probably trying to get back to the marker that was slightly above it).
Thanks
#170
06/11/2006 (5:57 pm)
Well I like this recourse. I think there is a need for tweeking things though. It would be nice to combine aipatrol and gaurd. This would mean that the gaurd would be able to patrol a path and when he sees you he could leave the path and lock onto you. I think you should be able to specify wich markers he stops at and how long he waits there too. I wouldnt mind it if he wasnt soooo aware of you too. The aigaurd spins around alot so I cant sneek up on him at all, If I try to slow down how much he looks with his attention he doesnt even fire till he thinks to look around. This isnt really a problem with this code but more the tge's aithink code to begin with. If i could code Id be all over that but..I suck8p
#171
Thanks chris
07/01/2006 (11:58 am)
Chris Jones-Gill code to the Armor:damage in player.cs fixed my respawning issues. Everytime that I would kill a bot, it will respawn more plus the extra one that respawned. Kill 1, 2 will come. Kill those 2, 3 would spawn. Thanks chris
#172
Hiding Guard markers...
Loading Guard entities...
Warning: (c:\torque\sdk\engine\console\consoleobject.cc @ 62) Couldn't find class rep for dynamic class: AIGuards4
starter.fps/server/scripts/AIGuards4.cs (351): Unable to instantiate non-conobject class AIGuards4.
Set::add: Object "0" doesn't exist
starter.fps/server/scripts/AIGuards4.cs (367): Unable to find object: '0' attempting to call function 'EquipBot'
starter.fps/server/scripts/AIGuards4.cs (369): Unable to find object: '0' attempting to call function 'setShapeName'
starter.fps/server/scripts/AIGuards4.cs (371): Unable to find object: '0' attempting to call function 'setTransform'
starter.fps/server/scripts/AIGuards4.cs (373): Unable to find object: '0' attempting to call function 'schedule'
Hiding Guard markers...
can anyone tell me what is wrong? Thanks
07/05/2006 (7:51 pm)
hi guys i encountered this problem with my AiGuard:Hiding Guard markers...
Loading Guard entities...
Warning: (c:\torque\sdk\engine\console\consoleobject.cc @ 62) Couldn't find class rep for dynamic class: AIGuards4
starter.fps/server/scripts/AIGuards4.cs (351): Unable to instantiate non-conobject class AIGuards4.
Set::add: Object "0" doesn't exist
starter.fps/server/scripts/AIGuards4.cs (367): Unable to find object: '0' attempting to call function 'EquipBot'
starter.fps/server/scripts/AIGuards4.cs (369): Unable to find object: '0' attempting to call function 'setShapeName'
starter.fps/server/scripts/AIGuards4.cs (371): Unable to find object: '0' attempting to call function 'setTransform'
starter.fps/server/scripts/AIGuards4.cs (373): Unable to find object: '0' attempting to call function 'schedule'
Hiding Guard markers...
can anyone tell me what is wrong? Thanks
#173
07/07/2006 (10:56 am)
Awesome resource, thanks for submitting it.
#174
07/08/2006 (8:52 am)
How would you go about setting the AI's range. Currently they just charge in gun's a blazin, what if you want them to shoot from afar?
#175
Thanks
08/11/2006 (4:29 pm)
I am getting the same error as Temasek Polytechnic Tp8 above, any ideas? Also no bots spawn at all.Thanks
#176
RPGKIT/server/scripts/ai/aiGuard.cs (350): Unable to instantiate non-conobject class AIGuard.
Set::add: Object "0" doesn't exist
RPGKIT/server/scripts/ai/aiGuard.cs (366): Unable to find object: '0' attempting to call function 'EquipBot'
RPGKIT/server/scripts/ai/aiGuard.cs (368): Unable to find object: '0' attempting to call function 'setShapeName'
RPGKIT/server/scripts/ai/aiGuard.cs (370): Unable to find object: '0' attempting to call function 'setTransform'
RPGKIT/server/scripts/ai/aiGuard.cs (372): Unable to find object: '0' attempting to call function 'schedule'
RPGKIT/server/scripts/ai/aiGuard.cs (350): Unable to instantiate non-conobject class AIGuard.
08/12/2006 (7:35 am)
here is a start of the errors im getting.RPGKIT/server/scripts/ai/aiGuard.cs (350): Unable to instantiate non-conobject class AIGuard.
Set::add: Object "0" doesn't exist
RPGKIT/server/scripts/ai/aiGuard.cs (366): Unable to find object: '0' attempting to call function 'EquipBot'
RPGKIT/server/scripts/ai/aiGuard.cs (368): Unable to find object: '0' attempting to call function 'setShapeName'
RPGKIT/server/scripts/ai/aiGuard.cs (370): Unable to find object: '0' attempting to call function 'setTransform'
RPGKIT/server/scripts/ai/aiGuard.cs (372): Unable to find object: '0' attempting to call function 'schedule'
RPGKIT/server/scripts/ai/aiGuard.cs (350): Unable to instantiate non-conobject class AIGuard.
#177
It's been a while since I've messed with this stuff, but I think you're problem is coming from the fact that your program isn't finding the AIGuard object. You have to add the AIGuard.cc and AIGuard.h files to your program and recompile it. Until you do that, it won't do anything. So try making sure that you've done that first. If you still keep having problems, post back.
For Kyle...
Try this...
At the top of the file add...
$AI_GUARD_MINIMUM_CLOSING_DISTANCE=100 ; // This determines how close a bot will come before stopping.
This will add a global variable for how close the guard should come before stopping.
The around line 653 replace the line that reads...
%obj.setmovedestination(%dest);
with the following lines...
%tempdist = vectorDist(%dest, %botpos); //Determine the distance from the bot to the targets position
if(%tempdist < $AI_GUARD_MINIMUM_CLOSING_DISTANCE)
{
%obj.setmovedestination(%botpos);
}
else
{
%obj.setmovedestination(%dest);
}
The idea is that the bot will look to see how far away it is from it's target, and if it's within the minimum range it should stop by setting its movement destination to it's own position - stopping it in place. I have not tried this patch because I'm away from my development PC, but it should put you in the ballpark as to how to address your question. Hope it helps.
Mark
08/12/2006 (11:32 am)
For Wayne...It's been a while since I've messed with this stuff, but I think you're problem is coming from the fact that your program isn't finding the AIGuard object. You have to add the AIGuard.cc and AIGuard.h files to your program and recompile it. Until you do that, it won't do anything. So try making sure that you've done that first. If you still keep having problems, post back.
For Kyle...
Try this...
At the top of the file add...
$AI_GUARD_MINIMUM_CLOSING_DISTANCE=100 ; // This determines how close a bot will come before stopping.
This will add a global variable for how close the guard should come before stopping.
The around line 653 replace the line that reads...
%obj.setmovedestination(%dest);
with the following lines...
%tempdist = vectorDist(%dest, %botpos); //Determine the distance from the bot to the targets position
if(%tempdist < $AI_GUARD_MINIMUM_CLOSING_DISTANCE)
{
%obj.setmovedestination(%botpos);
}
else
{
%obj.setmovedestination(%dest);
}
The idea is that the bot will look to see how far away it is from it's target, and if it's within the minimum range it should stop by setting its movement destination to it's own position - stopping it in place. I have not tried this patch because I'm away from my development PC, but it should put you in the ballpark as to how to address your question. Hope it helps.
Mark
#178
Not sure what the deal is with it.
Thanks
I have also noticed these errors min my missions file from console.log
Object 'AIPatrolMarker' is not a member of the 'GameBaseData' data block class
RPGKIT/data/missions/Recaci1.mis (0): Register object failed for object Korks_Sister of class StaticShape.
Object 'AIPatrolMarker' is not a member of the 'GameBaseData' data block class
RPGKIT/data/missions/Recaci1.mis (0): Register object failed for object (null) of class StaticShape.
Object 'AIPatrolMarker' is not a member of the 'GameBaseData' data block class
RPGKIT/data/missions/Recaci1.mis (0): Register object failed for object (null) of class StaticShape.
Object 'AIPatrolMarker' is not a member of the 'GameBaseData' data block class
RPGKIT/data/missions/Recaci1.mis (0): Register object failed for object (null) of class StaticShape.
Object 'AIPatrolMarker' is not a member of the 'GameBaseData' data block class
RPGKIT/data/missions/Recaci1.mis (0): Register object failed for object (null) of class StaticShape.
08/12/2006 (11:42 am)
I have doubled checked the .h and .cc files and they are in my project.Not sure what the deal is with it.
Thanks
I have also noticed these errors min my missions file from console.log
Object 'AIPatrolMarker' is not a member of the 'GameBaseData' data block class
RPGKIT/data/missions/Recaci1.mis (0): Register object failed for object Korks_Sister of class StaticShape.
Object 'AIPatrolMarker' is not a member of the 'GameBaseData' data block class
RPGKIT/data/missions/Recaci1.mis (0): Register object failed for object (null) of class StaticShape.
Object 'AIPatrolMarker' is not a member of the 'GameBaseData' data block class
RPGKIT/data/missions/Recaci1.mis (0): Register object failed for object (null) of class StaticShape.
Object 'AIPatrolMarker' is not a member of the 'GameBaseData' data block class
RPGKIT/data/missions/Recaci1.mis (0): Register object failed for object (null) of class StaticShape.
Object 'AIPatrolMarker' is not a member of the 'GameBaseData' data block class
RPGKIT/data/missions/Recaci1.mis (0): Register object failed for object (null) of class StaticShape.
#179
So make sure you're .h and .cc files are in the folder - which you say is true.
Force your compiler to do a complete rebuild. Just dropping them in the folder won't make them part of the package.
And some part of me wants to say that there is a place somewhere to add an "include" statement somewhere in the code, but it's been way too long since I've played with this stuff to be any real help on that matter, and I don't have any development software on any of the PC's nearby.
So if forcing a recompile doesn't work, try searching through the files in your Torque directory for files that contain 'aiplyer.h'. You'd be looking for lines of code to "include" the aiplayer.h file. If you find any of these, you might try adding an include statment for ai_guard.h.
I know it's not an exact answer, but I honestly haven''t tried integrating this code into Torque in over a year. So I'm rusty as sin at it. But reading through the previous posts it was noted that someone had to alter their .mak file to get the program to not give them similar errors. So I'm sticking with it being a compiling problem.
Good luck, let me know how it goes.
Mark
08/12/2006 (12:45 pm)
It still seems to me as if the .cc and .h files are not being incorporated properly into your executable. Because as I recall the marker object is defined in the AI_Guard files.So make sure you're .h and .cc files are in the folder - which you say is true.
Force your compiler to do a complete rebuild. Just dropping them in the folder won't make them part of the package.
And some part of me wants to say that there is a place somewhere to add an "include" statement somewhere in the code, but it's been way too long since I've played with this stuff to be any real help on that matter, and I don't have any development software on any of the PC's nearby.
So if forcing a recompile doesn't work, try searching through the files in your Torque directory for files that contain 'aiplyer.h'. You'd be looking for lines of code to "include" the aiplayer.h file. If you find any of these, you might try adding an include statment for ai_guard.h.
I know it's not an exact answer, but I honestly haven''t tried integrating this code into Torque in over a year. So I'm rusty as sin at it. But reading through the previous posts it was noted that someone had to alter their .mak file to get the program to not give them similar errors. So I'm sticking with it being a compiling problem.
Good luck, let me know how it goes.
Mark
#180
Not sure if that would matter or not but thout I would say anyways lol.
Thanks
08/12/2006 (12:56 pm)
Great thanks mark, ill keep you posted. Also, forgot to say that im using TSE.Not sure if that would matter or not but thout I would say anyways lol.
Thanks

Jim Klein