Game Development Community

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..
Page «Previous 1 2 3 4 5 6 7 Last »
#1
02/27/2007 (4:56 am)
The doc links:

Research
www.irombu.net/iAI.Research.pdf
An overview of some basic AI concepts, including all those used throughout the project.

Design
www.irombu.net/iAI.Design.pdf
The design document - contains all the system component overview and everything about the implemented states/goals.

Implementation
www.irombu.net/iAI.Implementation.pdf
The main implementation document - contains all the source code as well as details description of each classes function.

Summary
www.irombu.net/iAI.Summary.pdf
Basically just a summary of what was achieved etc throughout the project.

Source Code
www.irombu.net/immersiveAI.zip
Zip file containing all the source code from the Implementation document, both C++ and TorqueScript files
#2
02/27/2007 (4:57 am)
@bank - indeed the iAIAgent class is based off the standard AIPlayer - infact is extends it. There was only a need to add the various character variable to the class, the other movement code still is the same.
#3
02/27/2007 (5:15 am)
Thank for advance Gavin!!
#4
02/27/2007 (6:58 am)
Quick question: Is it scripted or written in C++. Also how did you create the path lines?
#5
02/27/2007 (7:00 am)
Very interesting to read.
I'm myself interested in more intelligent and interesting AI uses and this pdfs are definitely a good addition to what I have found and / or read so far.

thank you very much Gavin.


PS: The two words sound good :)
Reminds me of my "theory" that there must be a way to efficiently calculate paths through potential fields on shaders.
But my shader knowledge (especially the one on the "what can not be done or should be avoided") lacks too much to follow this idea. But at some point I'll need to do semester thesis and master thesis as well :-)
#6
02/27/2007 (9:56 am)
This is excellent, thank you for posting all of the documents.

I have not had a chance to fully dig into the code yet, but I had a similar question as MB6019. What is the process for creating the nodes and path lines?

I look forward to reading this in more detail.
Thanks again.
Todd
#7
02/27/2007 (10:09 am)
MB6019 & William: if you quickly read the design (or overview don't remember where exactly) it's said, that the path points (lines) are generated automatically on mission load.
#8
02/27/2007 (12:39 pm)
Bank - Thanks...I must have missed it in my very brief scan through. I'll step through the code to understand that fully...
#9
02/27/2007 (12:52 pm)
Okay... I've managed to move all files from PDF into .cc/.h and my engine got compiled (I'm using for this the clean Stock TGE 1.5 SDK).
The changes to SDK:
Index: J:/Torque/SDK15_iAI/engine/game/objectTypes.h
===================================================================
--- J:/Torque/SDK15_iAI/engine/game/objectTypes.h	(revision 9)
+++ J:/Torque/SDK15_iAI/engine/game/objectTypes.h	(working copy)
@@ -64,7 +64,10 @@
    DamagableItemObjectType =     BIT(27),
    /// @}
 
-   ShadowCasterObjectType =	BIT(28)
+   ShadowCasterObjectType =	BIT(28),
+   iAIPathObjectType =           BIT(29),
+   iAIPathGridObjectType =       BIT(30),
+   iAIAgentObjectType =          BIT(31)
 };
 
 #define STATIC_COLLISION_MASK   (   TerrainObjectType    |  \
The files (original from PDF, ony the PROFILER_SCOPE changed into PROFILER_START()-PROFILER_END() combination, so it's compatible with Stock SDK) can be downloaded from this link (unpack into /engine/ folder with folder structure).
No changes needed to AIPlayer .. anyway, I have compiled successfully the project, but haven't run it yet, I DO NOT GUARANTEE that this will work.
The scripting move from PDF into .cs files will be done later. Need to get a break..
#10
02/27/2007 (4:23 pm)
The docs are written for a non-Torque based audience, so the explanations/details are based around general AI concepts, rather than the specifics of TGE.

I will post the source code in the individual files when I get home tonight (so bank doesn't hemerage over trying to extract the source from the PDF's).

However, please be aware that it is not really designed to be placed directly into a game and used without plenty of customisation! The system is more of a proof-of-concept design, with some nifty algorithms attached to it. Certainly the path finding map generation, binary heap and A* implementations should be easy enough to extract and plug into a system.

I don't want to post this up as a resource, for exactly that reason - it should be more viewed as a project that you can have a look at the way the algorithms are implemented to hopefully get you over any hurdles that you might be facing in a project.

I will do my best to answer any questions that you might have regarding any of the system concepts / algorithms.
#11
02/28/2007 (12:14 am)
I've updated the post with the documents, with a link to the source code files
#12
02/28/2007 (12:33 am)
Ah, thank you very much. Will take some porting.

The fact that its not designed to be placed directly into a game - thats really the attraction for me at least. Customizing it to fit your game without having to tear out hours of code is hawt :)

Thank you very much for your effort, and for giving all this to the community :D
#13
02/28/2007 (8:18 am)
Does the implementation include World edditing features?
Trying to decide whether to scrap wrok restarted on the AI Pack with Phil C.
#14
02/28/2007 (1:22 pm)
After more deeper look at the scripts and source code I found it really interesting and it could be very useful..
But, yeah, it's not "resource-ready" code, so you can't just take it and make it working in your project.
Actualy, it's really great SDK for path-finding/A* as a good start-point for your project (if you decide to make your AI based on iAI).

As for me, I found that the most scripted logic is very similar to what I've done with my own project, but I need to re-work what I have, as my code "eats" too much processor time..
with my current AI implementation I had 250 AI objects with 100 clients online, and the server (Pentium-D 3.6GHz processor running on OpenSuSE 10.2) at the peak moment gave about 250-300ms response time from game server. Decreasing AI object count from 250 to 125 made response time to be not more than 100ms with the same 100 clients online.
And, as I think (and I hope), your code, Gavin, could improve the performance in times comparing to what I have now.
I just need to finish some urgent tasks and later I'll play with your code more deeply.

And again, thanks for sharing the code!
#15
03/22/2007 (5:04 am)
I've been attempting to get the iAI to work with the current build of my game for a little while, and am having trouble. I know (from the previous posts) that iAI is not intended to just "drop" into the build and run on its own, but was hoping that there might be some kind of tutorial or basic "starting tips" that might be available somewhere. The primary code programmer on my team has already got the source integrated into the engine, and I am primarily working with the scripts.

BTW, Gavin... many thanks to you for working on something so elaborate. It really looks to hold a lot of promise, and I am very excited about checking out the workings of the iAI project.
#16
04/01/2007 (1:45 pm)
Hello , i have a clean compile of this and now how can i use this ?
#17
04/06/2007 (12:20 am)
Well, if you look at the pdf for implementation, you'll see that there are a ton of other changes that are made to the engine that aren't exactly part of the iAI Engine, but are still integral. So the best you can hope for unless he releases his whole source modifications is to just learn from it to implement your own.

@Gavin: this is still really awesome and a big help! thanks!
#18
04/06/2007 (3:13 pm)
IAIPathFind.cc seems to be corrupt in the zip file or something. I tried redownloading and unziping again but it won't open as anything but a binary.
#19
04/06/2007 (3:27 pm)
Well... I rebuilt the cc file from the pdf somewhat laboriously and I've cut the errors down to this still sizeable mess.

C:\Torque\SDK\engine\immersiveAI\iAIGoalLibrary.cc(193) : error C2039: 'iAIMessagef' : is not a member of 'Con'
C:\Torque\SDK\engine\immersiveAI\iAIGoalLibrary.cc(193) : error C2065: 'iAIMessagef' : undeclared identifier
C:\Torque\SDK\engine\immersiveAI\iAIGoalLibrary.cc(196) : error C2039: 'iAIMessagef' : is not a member of 'Con'
C:\Torque\SDK\engine\immersiveAI\iAIGoalLibrary.cc(199) : error C2039: 'iAIMessagef' : is not a member of 'Con'
C:\Torque\SDK\engine\immersiveAI\iAIGoalLibrary.cc(206) : error C2039: 'iAIMessagef' : is not a member of 'Con'
C:\Torque\SDK\engine\immersiveAI\iAIGoalLibrary.cc(212) : error C2039: 'iAIMessagef' : is not a member of 'Con'
C:\Torque\SDK\engine\immersiveAI\iAIGoalLibrary.cc(215) : error C2039: 'iAIMessagef' : is not a member of 'Con'
iAIGoalManager.cc
C:\Torque\SDK\engine\immersiveAI\iAIGoalManager.cc(64) : error C2039: 'setPreviousGoal' : is not a member of 'iAIAgent'
../engine\immersiveAI/agent/iAIAgent.h(31) : see declaration of 'iAIAgent'
C:\Torque\SDK\engine\immersiveAI\iAIGoalManager.cc(64) : error C2039: 'getCurrentGoal' : is not a member of 'iAIAgent'
../engine\immersiveAI/agent/iAIAgent.h(31) : see declaration of 'iAIAgent'
C:\Torque\SDK\engine\immersiveAI\iAIGoalManager.cc(65) : error C2039: 'setPreviousSolution' : is not a member of 'iAIAgent'
../engine\immersiveAI/agent/iAIAgent.h(31) : see declaration of 'iAIAgent'
C:\Torque\SDK\engine\immersiveAI\iAIGoalManager.cc(65) : error C2039: 'getCurrentSolution' : is not a member of 'iAIAgent'
../engine\immersiveAI/agent/iAIAgent.h(31) : see declaration of 'iAIAgent'
C:\Torque\SDK\engine\immersiveAI\iAIGoalManager.cc(68) : error C2039: 'setCurrentGoal' : is not a member of 'iAIAgent'
../engine\immersiveAI/agent/iAIAgent.h(31) : see declaration of 'iAIAgent'
C:\Torque\SDK\engine\immersiveAI\iAIGoalManager.cc(69) : error C2039: 'setCurrentSolution' : is not a member of 'iAIAgent'
../engine\immersiveAI/agent/iAIAgent.h(31) : see declaration of 'iAIAgent'
C:\Torque\SDK\engine\immersiveAI\iAIGoalManager.cc(112) : error C2039: 'getCurrentGoal' : is not a member of 'iAIAgent'
../engine\immersiveAI/agent/iAIAgent.h(31) : see declaration of 'iAIAgent'
C:\Torque\SDK\engine\immersiveAI\iAIGoalManager.cc(139) : error C2039: 'getCurrentGoal' : is not a member of 'iAIAgent'
../engine\immersiveAI/agent/iAIAgent.h(31) : see declaration of 'iAIAgent'
C:\Torque\SDK\engine\immersiveAI\iAIGoalManager.cc(155) : error C2039: 'getCurrentSolution' : is not a member of 'iAIAgent'
../engine\immersiveAI/agent/iAIAgent.h(31) : see declaration of 'iAIAgent'
iAIAgent.cc
C:\Torque\SDK\engine\immersiveAI\agent\iAIAgent.cc(16) : error C2065: 'iAIAgentObjectType' : undeclared identifier
iAIPath.cc
C:\Torque\SDK\engine\immersiveAI\seek\path\iAIPath.cc(18) : error C2065: 'iAIPathObjectType' : undeclared identifier
iAIPathFind.cc
C:\Torque\SDK\engine\immersiveAI\seek\path\iAIPathFind.cc(34) : error C2065: 'PROFILE_SCOPE' : undeclared identifier
C:\Torque\SDK\engine\immersiveAI\seek\path\iAIPathFind.cc(34) : error C2065: 'iAIPathFind_generatePath' : undeclared identifier
C:\Torque\SDK\engine\immersiveAI\seek\path\iAIPathFind.cc(115) : error C2039: 'iAIMessagef' : is not a member of 'Con'
C:\Torque\SDK\engine\immersiveAI\seek\path\iAIPathFind.cc(115) : error C2065: 'iAIMessagef' : undeclared identifier
C:\Torque\SDK\engine\immersiveAI\seek\path\iAIPathFind.cc(119) : error C2039: 'iAIMessagef' : is not a member of 'Con'
C:\Torque\SDK\engine\immersiveAI\seek\path\iAIPathFind.cc(121) : error C2039: 'iAIMessagef' : is not a member of 'Con'
C:\Torque\SDK\engine\immersiveAI\seek\path\iAIPathFind.cc(143) : error C2065: 'iAIPathFind_smoothPath' : undeclared identifier
C:\Torque\SDK\engine\immersiveAI\seek\path\iAIPathFind.cc(189) : error C2065: 'iAIPathFind_resetNodeVariables' : undeclared identifier
iAIPathGrid.cc
C:\Torque\SDK\engine\immersiveAI\seek\path\iAIPathGrid.cc(21) : error C2065: 'iAIPathGridObjectType' : undeclared identifier
C:\Torque\SDK\engine\immersiveAI\seek\path\iAIPathGrid.cc(118) : error C2065: 'dglWireCube' : undeclared identifier
C:\Torque\SDK\engine\immersiveAI\seek\path\iAIPathGrid.cc(328) : error C2065: 'PROFILE_SCOPE' : undeclared identifier
C:\Torque\SDK\engine\immersiveAI\seek\path\iAIPathGrid.cc(328) : error C2065: 'iAIPathGrid_getClosestNode' : undeclared identifier
iAIPathMap.cc
C:\Torque\SDK\engine\immersiveAI\seek\path\iAIPathMap.cc(45) : error C2039: 'iAIMessagef' : is not a member of 'Con'
C:\Torque\SDK\engine\immersiveAI\seek\path\iAIPathMap.cc(45) : error C2065: 'iAIMessagef' : undeclared identifier
C:\Torque\SDK\engine\immersiveAI\seek\path\iAIPathMap.cc(89) : error C2039: 'iAIMessagef' : is not a member of 'Con'
C:\Torque\SDK\engine\immersiveAI\seek\path\iAIPathMap.cc(121) : error C2065: 'PROFILE_SCOPE' : undeclared identifier
C:\Torque\SDK\engine\immersiveAI\seek\path\iAIPathMap.cc(121) : error C2065: 'iAIPathMap_getClosestNode' : undeclared identifier
C:\Torque\SDK\engine\immersiveAI\seek\path\iAIPathMap.cc(131) : error C2065: 'iAIPathGridObjectType' : undeclared identifier
#20
04/08/2007 (12:15 am)
EDIT: use banks link to the source files. They make some of these changes redundant.

I'll start posting some changes to get this running in the latest tge I guess. Both the goal oriented framework and the pathfinding code look very worthwhile.

in engine/game/objectTypes.h
change this

DamagableItemObjectType =     BIT(27),
   /// @}

};
[/code]
to this
DamagableItemObjectType =     BIT(27),
   /// @}

   ShadowCasterObjectType =	BIT(28),
   iAIAgentObjectType = BIT(29),
   iAIPathObjectType = BIT(30),
   iAIPathGridObjectType = BIT(31)
};

in engine\immersiveAI\seek\path\iAIPathGrid.cc
iAIPathNode* iAIPathGrid::getClosestNode(const Point3F position)
{
	PROFILE_SCOPE(iAIPathGrid_getClosestNode);

	F32 closestVec = 1000.0f;
	F32 currentVec = 1000.0f;
	iAIPathNode* closestNode = 0;

	// iterate over all nodes
	for (U32 i = 0; i < this->mNodes.size(); ++i)
	{
		// calculate the vector length
		currentVec = Point3F(position - this->mNodes[i]->mPosition).len();

		// check if its closest one found so far
		if (currentVec < closestVec)
		{
			// save as closest so far
			closestVec = currentVec;
			closestNode = this->mNodes[i];
		}
	}

	return closestNode;

}
to this
iAIPathNode* iAIPathGrid::getClosestNode(const Point3F position)
{
	[b]PROFILE_START(iAIPathGrid_getClosestNode);[/b]

	F32 closestVec = 1000.0f;
	F32 currentVec = 1000.0f;
	iAIPathNode* closestNode = 0;

	// iterate over all nodes
	for (U32 i = 0; i < this->mNodes.size(); ++i)
	{
		// calculate the vector length
		currentVec = Point3F(position - this->mNodes[i]->mPosition).len();

		// check if its closest one found so far
		if (currentVec < closestVec)
		{
			// save as closest so far
			closestVec = currentVec;
			closestNode = this->mNodes[i];
		}
	}
	[b]PROFILE_END();[/b]
	return closestNode;
}
Page «Previous 1 2 3 4 5 6 7 Last »