Immersive AI Engine by Gavin Bunney discussion
by Fyodor -bank- Osokin · in Torque Game Engine · 02/27/2007 (4:46 am) · 191 replies
Let's discuss the iAI engine here, not spamming the .blog is good :)
The first question - is it based on standard AIPlayer.cc from SDK?
May be it's written in documents, but I haven't read all of them yet..
The first question - is it based on standard AIPlayer.cc from SDK?
May be it's written in documents, but I haven't read all of them yet..
About the author
Game developer.
Recent Threads
#42
add this to "engine\game\main.cc" around line 297
06/11/2007 (6:37 pm)
Ok one more important changeadd this to "engine\game\main.cc" around line 297
Con::setIntVariable("$TypeMasks::iAIAgentObjectType", iAIAgentObjectType);
Con::setIntVariable("$TypeMasks::iAIPathObjectType", iAIPathObjectType);
Con::setIntVariable("$TypeMasks::iAIPathGridObjectType", iAIPathGridObjectType);With this change they will be able to recognize each other and thus be able to fight each other using the existing scripts.
#43
How to make the grid show:
How to fix the getAgentType and setAgentType functions:
and changing the consoleMethods at the bottom of iAIAgent.cc resemble this:
I'm sure there was a reason for using dSprintf(...) but it wasn't working for me, and I'm not familiar enough with the engine to know if there's a problem with using strcpy(...). About the only thing I can think of is due to crossplatform reasons? Is strcpy only for windows? or did the dSprintf function to more than copying a char array? I'm unfamiliar with dSprintf, and pretty clueless programming for cross-platform although I'm learning.
With Stephen's changes and with J.Erick's bugfix I've gotten it functional.
Observations:
1. "Patrol Area" sends the NPC off to the far corner of the map...I don't know why, or where to change it so that certain NPCs will patrol a smaller area (like say...wandering around a small portion of the town rather than the opposite end of the map. I'm sure it's there somewhere, I just haven't seen it.
2. The grid draws on the bottom floor in interiors, but they seem to ignore it.
3. For fighting, the AI usually stands there stupidly. Seems to be it'll just fire, and if it gets blown out of its position, it'll path back to it. But otherwise it'll mostlystand still.
4. Many of the actions have hard coded coords. If you want to use it in your map, be sure to change the coords for the goals: "goHome", "Dance", "buyFood", "stealFood", "buyHealth", "stealHealth"
5. As-is, they spawn at the same spawnpoint as the player.
6. Make sure you change the built-in character models, to your own
7. None of the enemies currently attack the player. The only enemies currently hostile to eachother are the soldiers and the bandits. Entertainers don't fight, they just want to have fun for the most part.
8. You need to turn down the things that degrade in the player cycle, otherwise the things determining how they act will happen extremely fast (they'll be "sleeping, relaxing, buying food, etc..." every minute or 2)
A big thanks to Gavin for making all this available, and Stephen for doing so much work to get it fuctional for the rest of us. It's definitely not something you just drop into a project, but it is something you can start with for some awesome pathfinding and a great example of having a very dynamic AI.
I'm thinking about adapting it for my castle siege game. Things like having the invaders retreat if they get low on health, or regroup...having the defenders call for ammo if they get low, giving chase to invaders if they get into the castle, or running to a healer if they're near death.
Now I've gotta figure out how to adapt the pathMap to work on interiors. Can you load the surfaces from an interior into the code and have it generate nodes on each exposed-upward-facing face and attach them if the Z values are low enough and lacking obstruction? I'm sure it can be done, just don't know where to start, or if that's a reasonable option....thinking outloud here...opinions? other options?
06/12/2007 (8:39 am)
Okay, things I've learned:How to make the grid show:
iAIPathGrid::iAIPathGrid()
{
this->setPosition(Point3F(0,0,0));
this->mTypeMask |= iAIPathGridObjectType;
this->mCompiled = false;
this->mDensity = 0.0f;
this->mGridBox = Box3F(0,0,0, 0,0,0);
this->mShow = false; // <<< Change this bool right here to be true, and it'll show the grid
this->mNodesCountX = 0;
this->mNodesCountY = 0;
}How to fix the getAgentType and setAgentType functions:
void setAgentType(const char* agentType) { strcpy(mAgentType, agentType); }
const char* getAgentType() const { return mAgentType; } in iAIAgent.h ~line 85. At the top you'll also need to add #include "string.h"
and changing the consoleMethods at the bottom of iAIAgent.cc resemble this:
ConsoleMethod( iAIAgent, setAgentType, void, 3, 3,
"void iAIAgent.setAgentType(string agentType) - Set the type of agent.")
{
object->setAgentType(argv[2]);
}
ConsoleMethod( iAIAgent, getAgentType, const char*, 2, 2,
"string iAIAgent.getAgentType() - Get the type of agent.")
{
const char *agentType = object->getAgentType();
return agentType;
}I'm sure there was a reason for using dSprintf(...) but it wasn't working for me, and I'm not familiar enough with the engine to know if there's a problem with using strcpy(...). About the only thing I can think of is due to crossplatform reasons? Is strcpy only for windows? or did the dSprintf function to more than copying a char array? I'm unfamiliar with dSprintf, and pretty clueless programming for cross-platform although I'm learning.
With Stephen's changes and with J.Erick's bugfix I've gotten it functional.
Observations:
1. "Patrol Area" sends the NPC off to the far corner of the map...I don't know why, or where to change it so that certain NPCs will patrol a smaller area (like say...wandering around a small portion of the town rather than the opposite end of the map. I'm sure it's there somewhere, I just haven't seen it.
2. The grid draws on the bottom floor in interiors, but they seem to ignore it.
3. For fighting, the AI usually stands there stupidly. Seems to be it'll just fire, and if it gets blown out of its position, it'll path back to it. But otherwise it'll mostlystand still.
4. Many of the actions have hard coded coords. If you want to use it in your map, be sure to change the coords for the goals: "goHome", "Dance", "buyFood", "stealFood", "buyHealth", "stealHealth"
5. As-is, they spawn at the same spawnpoint as the player.
6. Make sure you change the built-in character models, to your own
7. None of the enemies currently attack the player. The only enemies currently hostile to eachother are the soldiers and the bandits. Entertainers don't fight, they just want to have fun for the most part.
8. You need to turn down the things that degrade in the player cycle, otherwise the things determining how they act will happen extremely fast (they'll be "sleeping, relaxing, buying food, etc..." every minute or 2)
A big thanks to Gavin for making all this available, and Stephen for doing so much work to get it fuctional for the rest of us. It's definitely not something you just drop into a project, but it is something you can start with for some awesome pathfinding and a great example of having a very dynamic AI.
I'm thinking about adapting it for my castle siege game. Things like having the invaders retreat if they get low on health, or regroup...having the defenders call for ammo if they get low, giving chase to invaders if they get into the castle, or running to a healer if they're near death.
Now I've gotta figure out how to adapt the pathMap to work on interiors. Can you load the surfaces from an interior into the code and have it generate nodes on each exposed-upward-facing face and attach them if the Z values are low enough and lacking obstruction? I'm sure it can be done, just don't know where to start, or if that's a reasonable option....thinking outloud here...opinions? other options?
#44
Here was my solution. Replace the entire function first with this.
at server\scripts\immersiveAI\goals\doRest\sleep.cs line(49)
and \server\scripts\immersiveAI\goals\goHome\seekHome.cs line(50)
Then I made room in the engine code for my new functions setHome() and getHome(). In iAIAgent.h I added
Then in iAIAgent.cc I added
and I added this bit with the other accessor functions about line 177
With that done all that remains is to assign a new home location for you AI in your scripts whenever you feel like it. I started out by modifying their spawn routine to set their home to their starting location. In file "server\scripts\immersiveAI\agent\iAIAgentManager.cs" I added to function iAIAgentManager::spawn() right before the return the following code.
Ok now just modify your $iAIWanderRadius to control how wide an area you want your bots to explore and patrol, if you want it to be individual to each bot i recommend adding a new variable to the class with new accessors and all, the same way I did getHome() and setHome()
06/13/2007 (1:51 am)
Quote:1. "Patrol Area" sends the NPC off to the far corner of the map...I don't know why, or where to change it so that certain NPCs will patrol a smaller area (like say...wandering around a small portion of the town rather than the opposite end of the map. I'm sure it's there somewhere, I just haven't seen it.This is kind of hard-coded into the function getRandomPoint() in "server\scripts\immersiveAI\immersiveAI.cs"
Here was my solution. Replace the entire function first with this.
function getRandomPoint(%pos,%rad,%height)
{
%x = getWord(%pos, 0) + mFloor(getRandom(%rad * 2) - %rad);
%y = getWord(%pos, 1) + mFloor(getRandom(%rad * 2) - %rad);
//%z = getWord(%pos, 2) + mFloor(getRandom(%rad * 2) - %rad);
%z = getTerrainHeight(%z SPC %y) + %height;
%position = %x @ " " @ %y @ " " @ %z;
return %position;
}up at the top I added new globals.$iAIWanderRadius = 150; $iAIHeight = 5;Then I replaced all calls to getRandomPoint() with
getRandomPoint(%agent.getHome(),$iAIWanderRadius,$iAIHeight)Also I replaced both references to $HomeLocation with %agent.getHome()
at server\scripts\immersiveAI\goals\doRest\sleep.cs line(49)
and \server\scripts\immersiveAI\goals\goHome\seekHome.cs line(50)
Then I made room in the engine code for my new functions setHome() and getHome(). In iAIAgent.h I added
Point3F mHome;to the protected variables and
//Stephen New functions
void setHome( const Point3F &location );
Point3F getHome() const { return mHome; } to the public functions.Then in iAIAgent.cc I added
this->mHome.set( 0.0f, 0.0f, 0.0f );to iAIAgent::iAIAgent()
and I added this bit with the other accessor functions about line 177
//stephen new set home location function
void iAIAgent::setHome( const Point3F &home )
{
mHome = home;
}
//get function in .hFinally I added this at about line 299ConsoleMethod( iAIAgent, setHome, void, 3, 3, "(Point3F home)"
"Sets a new home location for the AI.")
{
Point3F v( 0.0f,0.0f,0.0f );
dSscanf( argv[2], "%g %g %g", &v.x, &v.y, &v.z );
object->setHome( v );
}
ConsoleMethod( iAIAgent, getHome, const char *, 2, 2, "()"
"Returns the point the AI considers its home.")
{
Point3F movePoint = object->getHome();
char *returnBuffer = Con::getReturnBuffer( 256 );
dSprintf( returnBuffer, 256, "%g %g %g", movePoint.x, movePoint.y, movePoint.z );
return returnBuffer;
}With that done all that remains is to assign a new home location for you AI in your scripts whenever you feel like it. I started out by modifying their spawn routine to set their home to their starting location. In file "server\scripts\immersiveAI\agent\iAIAgentManager.cs" I added to function iAIAgentManager::spawn() right before the return the following code.
//set home location %newAgent.setHome(%newAgent.getPosition());
Ok now just modify your $iAIWanderRadius to control how wide an area you want your bots to explore and patrol, if you want it to be individual to each bot i recommend adding a new variable to the class with new accessors and all, the same way I did getHome() and setHome()
#45
06/13/2007 (2:17 am)
Oh one more discovery. To make the grid show requires no engine changes. Just enter into the console $iAIPathMap.toggleDisplay(); in order to toggle visual rendering of the pathmap. It slowed my computer to a crawl though and made torque lock up after a while for me.
#46
06/13/2007 (3:06 am)
I'm noticing lockups now kind of frequently and I've looked at the console logs and the last thing it says is always Quote:starter.fps/server/scripts/immersiveAI/agent/iAIAgent.cs (110): Unknown command hasNextNode.Is anyone else experiencing this? I'm going to start working on a fix.
#47
I ran into this once and only once. I couldn't figure it out.
This seems to be a very rare error whatever it is. Are you sure the function change you made fixes it? Unless I'm mistaken, the logic in the function before and after your change is the same similar to when you changed { return this->mAgentType; }
Heh, I missed that one.
I like your changes to random point and home, I'll implement those and see what other improvements can be made based on how they act from there. I haven't done any work on it today. I've been working on problems with the theora control.
During a lecture today my wife had to give I jotted down some actions and basic logic for how I wanted a few of my bots to add. I'll see later what can be done and how much success I'll have. I won't be able to implement them all since some of the actions will be in interiors, but I'll start where I can.
06/13/2007 (11:25 am)
Quote:starter.fps/server/scripts/immersiveAI/agent/iAIAgent.cs (110): Unknown command hasNextNode.
I ran into this once and only once. I couldn't figure it out.
This seems to be a very rare error whatever it is. Are you sure the function change you made fixes it? Unless I'm mistaken, the logic in the function before and after your change is the same similar to when you changed { return this->mAgentType; }
Quote:Oh one more discovery. To make the grid show requires no engine changes. Just enter into the console $iAIPathMap.toggleDisplay(); in order to toggle visual rendering of the pathmap. It slowed my computer to a crawl though and made torque lock up after a while for me.
Heh, I missed that one.
I like your changes to random point and home, I'll implement those and see what other improvements can be made based on how they act from there. I haven't done any work on it today. I've been working on problems with the theora control.
During a lecture today my wife had to give I jotted down some actions and basic logic for how I wanted a few of my bots to add. I'll see later what can be done and how much success I'll have. I won't be able to implement them all since some of the actions will be in interiors, but I'll start where I can.
#48
Also my change to { return this->mAgentType; } earlier avoided the use of any pointer which shouldn't really matter, but I tried changing it out of curiousity because I hadn't seen that style of function return elsewhere in tge. Lo and behold it fixed the errors I was having with .getAgentType() in the script.
06/14/2007 (8:17 pm)
Quote:This seems to be a very rare error whatever it is. Are you sure the function change you made fixes it?Did torque crash for you following that script error? It really shouldn't crash over an invalid function call in the scripts, but I had a number of crashes in torque and they were always preceded by that script error. Equally indicative, torque also crashed every time I had that script error that I saw. There were never any other error statements like that except for the very last line of my console log after each crash.
Quote:Unless I'm mistaken, the logic in the function before and after your change is the same similar to when you changed { return this->mAgentType; }I thought it would no longer call %agent.getCurrentPath().hasNextNode() if %agent.getCurrentPath() is not an object. That would in fact be the case, but I didn't noticed that was also a condition of the if statement that one is nested in, making "isObject(%agent.getCurrentPath())" completely redundant in the nested if statement in the original scripts. So I'm deleting my change from the previous post until I figure out what's going on.
Also my change to { return this->mAgentType; } earlier avoided the use of any pointer which shouldn't really matter, but I tried changing it out of curiousity because I hadn't seen that style of function return elsewhere in tge. Lo and behold it fixed the errors I was having with .getAgentType() in the script.
#49
I get the following errors:
Fixed! I forgot to add this in console.h:
06/15/2007 (5:08 am)
Hey guys, i followed the tips above but it still not compiling.I get the following errors:
..\engine\console\console.cc(563) : error C2039: 'iAIMessage' : is not a member of 'ConsoleLogEntry'
../engine\console/console.h(33) : see declaration of 'ConsoleLogEntry'
..\engine\console\console.cc(563) : error C2065: 'iAIMessage' : undeclared identifier
..\engine\console\console.cc(571) : error C2039: 'iAIMessage' : is not a member of 'ConsoleLogEntry'
../engine\console/console.h(33) : see declaration of 'ConsoleLogEntry'Fixed! I forgot to add this in console.h:
enum Level
{
Normal = 0,
Warning,
Error,
iAIMessage,
NUM_CLASS
} mLevel;
#50
06/15/2007 (6:09 am)
Ok, now it compiles with no errors, everything seems ok. So, how can i use that? Is there a way to test that or a doc explaining how to?
#51
This crash only occurs when iAIPathMap() is initialized, but the exception isn't thrown until after the pathmap is built when it starts adding players. If I add iAIPathMap() but don't initialize it, the game locks up without an error, or if I'm running it from msvc debug, msvc gives me
EDIT: Ok I've noticed about line 65 of "engine\immersiveAI\seek\path\iAIPathMap.cc" reads
06/17/2007 (1:00 am)
I haven't run my game in debug mode for a while, and now when I do it throws this fatal exception Quote:Error, not a physical zone!Exception is being thrown by the function physicalZoneFind(SceneObject* obj, void *key) in the shapebase class. According to MSVC The exception is coming from player::updatePos() calling ShapeBase::updateContainer() which calls Container::findObjects() which calls findRouter() which calls physicalZoneFind(). Does anyone have a better idea of what this means?
This crash only occurs when iAIPathMap() is initialized, but the exception isn't thrown until after the pathmap is built when it starts adding players. If I add iAIPathMap() but don't initialize it, the game locks up without an error, or if I'm running it from msvc debug, msvc gives me
Quote:Unhandled exception in torqueDemo_DEBUG.exe: 0xC0000005: Access Violationwhich it blames on iAIPathMap::getClosestNode() That part makes some sense to me. I'm still working on the other exception.
EDIT: Ok I've noticed about line 65 of "engine\immersiveAI\seek\path\iAIPathMap.cc" reads
// set the type of the terrain grid to just a zone type;
// needed to optimise the getClosestNode function
// (so we don't always get the terrain grid as the collided grid!)
terrainGrid->mTypeMask |= PhysicalZoneObjectType; This must be what's causing the fatal exception I experienced. Here's a solution to stop that error from being thrown. Replace the following function in "engine/game/shapeBase.cc" at about line 1289 with this updated versionvoid findRouter(SceneObject* obj, void *key)
{
[b]if (obj->getTypeMask() &iAIPathGridObjectType)
return;[/b]
if (obj->getTypeMask() & WaterObjectType)
waterFind(obj, key);
else if (obj->getTypeMask() & PhysicalZoneObjectType)
physicalZoneFind(obj, key);
else {
AssertFatal(false, "Error, must be either water or physical zone here!");
}
}I'm still not sure what purpose making the terrainGrid a PhysicalZoneObjectType served, but if it was working before, this change shouldn't stop it.
#52
Have you added all of the scripts into your game and made sure to execute them? If you have, several ai players should spawn after a few seconds whenever you start a map.
06/17/2007 (1:02 am)
@GustavoHave you added all of the scripts into your game and made sure to execute them? If you have, several ai players should spawn after a few seconds whenever you start a map.
#53
Yes, it did crash. Unfortunately I only had it happen once. I was in release so the information I had was limited. It was the only time I had the error so I put it on the backburner temporarily (It was rare...plus the whole out-of-town thing)
06/17/2007 (7:38 am)
I haven't been able to work on anything for a bit. My wife and I took a trip to Changsha for three days.Quote:
Did torque crash for you following that script error? It really shouldn't crash over an invalid function call in the scripts, but I had a number of crashes in torque and they were always preceded by that script error. Equally indicative, torque also crashed every time I had that script error that I saw. There were never any other error statements like that except for the very last line of my console log after each crash.
Yes, it did crash. Unfortunately I only had it happen once. I was in release so the information I had was limited. It was the only time I had the error so I put it on the backburner temporarily (It was rare...plus the whole out-of-town thing)
Quote:Unhandled exception in torqueDemo_DEBUG.exe: 0xC0000005: Access ViolationI've been planning on doing some heavy debugging in a bit anyway. Mine was throwing exceptions from a clean install, so for now I've been running in release till I could make a little headway and then was going to switch back. I know this is probably a bad practice, but my priority was learning how the engine worked a bit from a user standpoint. I thought it might be best since I really hadn't had that much experience with torque yet. Anyway, back to my point. Usually when I see this exceptions it's either a dirty pointer or a bounds issue. I'll try your fix and hopefully that'll do it. It makes sense, but being a bug that there doesn't seem to be any way to re-produce, I don't think we'll know for sure for a while whether it's truly disappeared or not (or maybe it was more common for you?).
#54
After a few hours of work I finnaly got the engine to compile, thanks to the numerous tips listed above, but I seem to be having some trouble with the scripts. Really there is only one thing I'm stuck on. The call to initialize the immersiveAI, the script says it is called when the game is started so I added the call to the onMissionLoaded function. Now, this compiles and loads all the scripts needed but when it gets to creating the pathMap the engine freezes. It might be just lagging because of the crappy processor in my laptop (1.4ghz, sad isn't it), I haven't had a chance to run it on my home PC yet it's a bit better. I would appreciate any thoughts you may have, thanks.
Just a thought I had, if the iAI gets initialized each time a new game is started or a new mission is loaded, then all the goal scipts are constantly being reloaded. Is that really needed? Or, do you have to create a new goalLibrary for each mission.
06/18/2007 (11:21 pm)
Hi All!!After a few hours of work I finnaly got the engine to compile, thanks to the numerous tips listed above, but I seem to be having some trouble with the scripts. Really there is only one thing I'm stuck on. The call to initialize the immersiveAI, the script says it is called when the game is started so I added the call to the onMissionLoaded function. Now, this compiles and loads all the scripts needed but when it gets to creating the pathMap the engine freezes. It might be just lagging because of the crappy processor in my laptop (1.4ghz, sad isn't it), I haven't had a chance to run it on my home PC yet it's a bit better. I would appreciate any thoughts you may have, thanks.
Just a thought I had, if the iAI gets initialized each time a new game is started or a new mission is loaded, then all the goal scipts are constantly being reloaded. Is that really needed? Or, do you have to create a new goalLibrary for each mission.
#55
06/19/2007 (3:26 am)
My pc is a 1.3 ghz athlon and the pathmap takes under a second to build on my computer. I added immersiveAI_Initialize(); at the end of function function startGame() in server/scripts/game.cs
#56
06/19/2007 (7:49 am)
Getting any errors in console.log?
#57
EDIT:
No luck. I'm not sure what is wrong. It all seems to be fine but when it gets to the point of initializing the pathMap it freezes.
EDIT: update
I've run some more test and I believe the code is fine. It seems to be sucking all the juice from my CPU, not sure why though. When I get a chance this weekend I'm going to try running it on my home PC. It's got a 3.5 ghz, I think that should suffice.
06/19/2007 (11:31 pm)
Thanks for the responses Stephen and Aaron. I'll check again to see if I missed any error messages and I'll try moving the immersiveAI_Initialize(); to the startGame function and see what happens.EDIT:
No luck. I'm not sure what is wrong. It all seems to be fine but when it gets to the point of initializing the pathMap it freezes.
EDIT: update
I've run some more test and I believe the code is fine. It seems to be sucking all the juice from my CPU, not sure why though. When I get a chance this weekend I'm going to try running it on my home PC. It's got a 3.5 ghz, I think that should suffice.
#58
@ Stephen - I'm finding I'm having some trouble with the random points but I think it has something to do with it giving points that are within my interiors.
I also think you've got a mistake in your getRandomPoint
Your code
Shouldn't it be?
I was getting points below/above my terrain with the first code block.
I hope to spend some time soon working on the navgraph for interiors. I know there's been talk on the forums here about an AI pack, but this talk has gone on for nearly 3 years now with nothing. I'm familiar with many different forms of AI and the A* algorithm and all that, but I'm pretty green when it comes to dealing with interiors. I'm trying to figure out how best to do it. Whether to have the engine detect upward-facing surfaces, mark the surfaces with some sort of special texture and then parse the DIF, or manually place the nodes in quark, I'm not sure which direction to go. I'm mainly working on researching the best option at the moment. Opinions or other options would be appreciated.
06/25/2007 (10:07 am)
@Ryan - Any luck? Can you paste the last bit of your console.log before it freezes?@ Stephen - I'm finding I'm having some trouble with the random points but I think it has something to do with it giving points that are within my interiors.
I also think you've got a mistake in your getRandomPoint
Your code
%z = getTerrainHeight(%z SPC %y) + %height;
Shouldn't it be?
%z = getTerrainHeight(%x SPC %y) + %height;
I was getting points below/above my terrain with the first code block.
I hope to spend some time soon working on the navgraph for interiors. I know there's been talk on the forums here about an AI pack, but this talk has gone on for nearly 3 years now with nothing. I'm familiar with many different forms of AI and the A* algorithm and all that, but I'm pretty green when it comes to dealing with interiors. I'm trying to figure out how best to do it. Whether to have the engine detect upward-facing surfaces, mark the surfaces with some sort of special texture and then parse the DIF, or manually place the nodes in quark, I'm not sure which direction to go. I'm mainly working on researching the best option at the moment. Opinions or other options would be appreciated.
#59
Well, I've had good luck and bad luck. I found out the iAI code won't run on my laptop. The CPU doesn't seem to be able to handle the path building, infact even just have Torque open at the menu screen makes it run at 95%. I think it's time for an upgrade. I run it on my home PC and it seemed to work, for about 5 seconds. The pathMap works fine, I used the toggle command to make sure it was built. Looks nice but it brought the frame rate down to a crawl. Good thing it runs in the background. Now, back to my problem area. After the game loads and the player is spawned, an error is pushed. It has something to do with the iAIAgentManager.cs script.
I went to that file but all there is there is error command. Also after the error is a bunch of odd engine garble.
I'm not quite sure what is happening yet I haven't had time to check into that much. Just thought I would see if anybody new anything I didn't. Also, this seems to be happening before the iAI Agents are spawned.
06/26/2007 (2:26 am)
@AaronWell, I've had good luck and bad luck. I found out the iAI code won't run on my laptop. The CPU doesn't seem to be able to handle the path building, infact even just have Torque open at the menu screen makes it run at 95%. I think it's time for an upgrade. I run it on my home PC and it seemed to work, for about 5 seconds. The pathMap works fine, I used the toggle command to make sure it was built. Looks nice but it brought the frame rate down to a crawl. Good thing it runs in the background. Now, back to my problem area. After the game loads and the player is spawned, an error is pushed. It has something to do with the iAIAgentManager.cs script.
Fatal: (e:\freshtorque\sdk\engine\platformwin32\winstrings.cc @ 301) dSprintf wrote to more memory than the specified buffer size - Stack Corruption Possible
I went to that file but all there is there is error command. Also after the error is a bunch of odd engine garble.
keyboard0 input device unacquired. DirectInput deactivated. Activating the OpenGL display device... Killing the texture manager... Making the rendering context not current... Deleting the rendering context ... Releasing the device context... Destroying the window... Setting screen mode to 1280x1024x16 (fs)... Changing the display settings to 1280x1024x16... Creating a new full-screen window... Acquiring a new device context... Pixel format set: 16 color bits, 24 depth bits, 8 stencil bits Creating a new rendering context... Making the new rendering context current... Activating DirectInput... keyboard0 input device acquired. OpenGL driver information: Vendor: ATI Technologies Inc. Renderer: RADEON X1600 Series x86/SSE2 Version: 2.0.5819 WinXP Release Resurrecting the texture manager... Successfully loaded mission lighting file: 'starter.fps/data/missions/stronghold_f901c6b8.ml' OpenGL Init: Enabled Extensions ARB_multitexture (Max Texture Units: 8) EXT_blend_color EXT_blend_minmax EXT_compiled_vertex_array EXT_texture_env_combine EXT_packed_pixels EXT_fog_coord ARB_texture_compression EXT_texture_compression_s3tc (ARB|EXT)_texture_env_add EXT_texture_filter_anisotropic (Max anisotropy: 16) WGL_EXT_swap_control OpenGL Init: Disabled Extensions EXT_paletted_texture NV_vertex_array_range 3DFX_texture_compression_FXT1
I'm not quite sure what is happening yet I haven't had time to check into that much. Just thought I would see if anybody new anything I didn't. Also, this seems to be happening before the iAI Agents are spawned.
#60
What version are you using?
Also, is the 5 second pause where the error is thrown? My comp is a 2.2 GHz athon 3200+ x64 and it builds the pathmap in the blink of an eye. If yours is taking 5 seconds and it's not something to do with that particular error, I'd say there's more things going wrong here.
06/26/2007 (8:35 am)
Hmm...sounds like it could possibly be a problem with the setAgentType? I know it uses dSprintf and it happens when it's initializing a new bot to spawn (so right before it actually spawns one). I had problems with it spitting garbage into the variable. I'm unfamiliar with how the function works and I was a bit impatient at the time so I threw in a strcpy instead of dSprintf and it works fine. My build is in release and it didn't throw the error you got.What version are you using?
Also, is the 5 second pause where the error is thrown? My comp is a 2.2 GHz athon 3200+ x64 and it builds the pathmap in the blink of an eye. If yours is taking 5 seconds and it's not something to do with that particular error, I'd say there's more things going wrong here.
Torque Owner Stephen Lujan