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..
#81
09/24/2007 (1:57 pm)
.... GoalManagerCore.cpp part 3 max post 8192
ConsoleMethod( iAIGoalManagerCore, requestNewGoal, bool, 3, 5,
			  "bool iAIGoalManagerCore.requestNewGoal(iAIAgent agent, [optional] bool avoidCurrentGoal, [optional] bool avoidCurrentSolution) - Request a new goal for the specified agent. Optionally avoiding the current goal.")
{
	// ensure agent parsed
	if (dStrlen(argv[2]) != 0)
	{
		// get the parsed agent & ensure valid
		iAIAgent *agent = dynamic_cast<iAIAgent*>(Sim::findObject(argv[2]));

		if (agent)
		{
			// see if avoidCurrentGoal is parsed
			if (dStrlen(argv[3]) != 0)
			{
				// request a goal for the agent
				object->requestNewGoal(agent, dAtob(argv[2]));
			} else
			{
				// request a goal for the agent
				object->requestNewGoal(agent);
			}
			return true;
		} else
		{
			Con::errorf("Immersive AI :: GoalManager :: Unable to locate parsed agent!");
			return false;
		}
	} else
	{
		Con::errorf("Immersive AI :: GoalManager :: No Agent parsed to add!");
		return false;
	}
}

ConsoleMethodGroupEnd(iAIGoalManagerCore, ScriptFunctions);
#82
09/24/2007 (3:12 pm)
Awesome!

Ok, I've been thinking on how to implement the master control brain and I'm still trying to wrap my head around it, but here's what I'm thinking:

The master brain would simply be a tickable script object. Only, using the code found on this forum thread: www.garagegames.com/mg/forums/result.thread.php?qt=39389 to ensure that the ticks happen on the server. (it's an iTickable interface capable of doing either client or server ticking). Using this resource www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=9584 (combined with the earlier iCSTickable interface) to build the server "ai manager" on. The master brain would do ALL thinking, pathfinding, whatever. Using this resource Subscription Based Message Router to communicate all of the master brain's wishes to each agent. You could (as you said about the thumb and index finger) have the master brain transmit messages to different queues like "ai high priority" or "ai low priority" and the agents would merely need to be subscribed appropriately.

Of course this is all just theory at the moment, but I think that it might work and perhaps allow the previous goal of 500 agents to be achieved.
#83
09/28/2007 (1:40 pm)
@ Aaron Moore || Stephen Lujan || or anyone else

Bravo on the work that you've done to get things going for the rest of us. I have managed to compile my code and get my bots spawning and whatnot. My big dilemma is that some of my levels are with interiors only. Have you or anyone else figure out how to map node points onto interiors? Any help would be greatly appreciated.
Thx.
#84
09/29/2007 (10:49 am)
Hmmm, unfortunately studies/exams have crept in. October month and beginning of November is out:

@Ben, been through your posted links. Makes sense keeping a server tick. Of course messaging !!

Although studies are top priority, thought will definately be given to all this.
#85
09/30/2007 (7:55 am)
I have no problem using iAI using 1.42 TGE. I have been doing this for serveral months. I just tried to port my work to 1.52 TGE. I did all the updates that I did for 1.4. Everything did compile but when I ran the script I didnot get any path map and there was no solution list. Is there anything more required to update to 1.52. Thanks for any help.
#86
10/01/2007 (8:33 am)
Did you include: immersiveAI_Initialize(); in your game.cs file?
#87
10/01/2007 (11:13 am)
Yes I did. I am getting only 3 characters returned for the getAgentType function. That is, soldier is returning sol, etc.. Never finds any solutions. I can find no problem with the engine code as the variable is defined greater then 3 characters. The getAgentType fix presented on this ppost has no effect in 1.5 and I never used it with 1.42; which works great.
#88
10/01/2007 (1:07 pm)
Take a look at Aaron's post about the agent type handling ...

void setAgentType(const char* agentType) { strcpy(mAgentType, agentType); }

const char* getAgentType() const { return mAgentType; }
#89
10/02/2007 (5:55 am)
Thank you I will try this. My 1.5 does work when using only 3 characters is used to define the agent type. I get all the paths. etc. I have no problem with 1.42.
.
#90
10/02/2007 (4:36 pm)
First of all: Thanks a lot Gavin. You've saved me a lot of work.
Stephen and all others who helped with the implementation, thanks.

Anyone have an idea how to make the nodes selectable so that you can tweak them in the editor?
#91
10/25/2007 (8:24 pm)
Hello,
Ok So I've decided to tackle the interior node mapping question and feel that I'm pretty close to a solution. Here are some pics: www.chaoticstudios.com/kothImages/path1.jpgThere are some questions that I'm hoping that someone will be able to shed some light on for me.
1. What exactly is the purpose of createPathMap
2. When connecting nodes, what is the purpose of this: check 4 points around clearance box (located in this function iAIPathNode::isNeighbourValid). What are the 4 points and what are they for? I took them out.
Ah, that's it for now, will probably have more in a bit.
Thanks for any help.
#92
10/31/2007 (6:19 pm)
I know I'm getting into this very late and I've tried reading through this thread but, at least at the moment, I'm not seeing anyone defining on where to put anything (ie includes, execs, etc). Has some one done this yet? If not, would some one email me at my profiles email and give me the generic instructions and I will write out a small tutorial on how to implement this.

I've been told this is the best Ai resource out there by other people I trust, so please help me make this something that everyone can use eventually.
#93
10/31/2007 (6:59 pm)
Is the implementation PDF not enough (see second post in thread)?
#94
10/31/2007 (7:47 pm)
Actually Brian, no offense, not really.
It could be that I'm missing something and at this point after the frustration I've had with several other Ai resources, I wouldn't doubt it. I know I'm missing an exec call somewhere, but I guess that's not my point.

The thing is many, many people forget that not everyone knows how to do this. I can use the example of the AIGuard resource here on the site. The original person who posted it forgot to tell anyone where to put the includes and by the sounds of his posts hasn't used it in years and no longer remembers himself. Supposedly it works, but only for those that know exactly where to put everything.( I actually did finally get it working myself, but only after hours and hours of trial and error)
So, as I've heard this is a very, very good resource I would like to put down some very simple instructions for implementation here. Remember over time links get broken, people forget, etc, etc.
#95
10/31/2007 (8:17 pm)
Did it compile for you? Once compiled, in the whatever/server/scripts/game.cs folder near the top you need to basically make the scripts active and ready to go so add this:

exec("./immersiveAI/immersiveAI.cs");

Then you need to start the system, so in the same file, games.cs, in the startGame function, call it:

immersiveAI_Initialize();

And that's it for getting it started, it's up to you to customize it to your liking. Hope this is what your lookin for.
#96
11/01/2007 (12:55 am)
@DALO

createPathMap - initializes the path map to the mission area ( called in immersiveAI.cs - immersiveAI_Initialize )

checking for 4 points - when creating a grid for pathing, no use linking unreachable nodes, a reachability test is done, in this case a simple line of sight for prospective neighbour nodes
#97
11/01/2007 (4:21 am)
@Brian & DALO, thanks very much for the info. The problem I was having is I was breaking up the folders and hence things were not where they should have been.

Edit: Ok everything seems to compile ok, but I'm getting these console log errors:

starter.fps/server/scripts/immersiveAI/immersiveAI.cs (50): Unable to instantiate non-conobject class iAIGoal Library.
Set::add: Object "0" doesn't exist.
starter.fps/server/scripts/immersiveAI/immersiveAI.cs (52): Unable to find object: '0' attmpting to call function 'initialize'
starter.fps/server/scripts/immersiveAI/immersiveAI.cs (60): Unable to instantiate non-conobject class iAIPathMap
Set::add: Object "0" doesn't exist.
starter.fps/server/scripts/immersiveAI/immersiveAI.cs (64): Unable to find object: '0' attmpting to call function 'initialize'

Ok, I have not made any changes to the source or scripts except to initialize the iAI scripts and for model locations with in my folder structure. I wasn't sure if any of the above changes had already been implemented into the source download.

This is on a fresh install of TGE 1.5.2.

Any one give me a hand please?
#98
11/01/2007 (5:34 am)
Does anyone have any "demo" missions or a litttle video showing the Immersive AI Engine in use ?
#99
11/01/2007 (5:36 am)
Alienforce, if I can get this working today, I can do a quick video.
#100
11/05/2007 (2:48 pm)
Here's a quick question about damage:

In the player.cs file the playerData datablock uses the "Armor" class to detect all damage done on AI bots, so how does iAIAgent::onDamage ever get called? It will always call the Armor::onDamage function instead. Which stops my bots from fighting. Hmmmmm, would it be worth copying the player.cs file and making it aiPlayer.cs renaming all "Armor" to "iAIAgent" or just copying the tasks in iAIAgent::onDamage into Armor::onDamage.
Anyone else come across this?
p.s. thanks Greg, I didn't realize until after that you need room for the player to move.