Game Development Community

gotta be missing something with AI

by Nathan Morton · in Game Design and Creative Issues · 07/11/2010 (1:28 am) · 4 replies

I'm helping a friend out, trying to add AI to his game.

I've successfully spawned the bot I'd like to spawn in a single location, however, can't figure out how to get it to follow the path I've created.

get the following message in the console.log

Compiling bin/server/Aichase.cs...
bin/server/Aichase.cs Line: 155 - parse error
>>> Advanced script error report. Line 155.
>>> Some error context, with ## on sides of error halt:
if(%thisObj.path $= PATHNAME)
{
%thisObj.targetNode = getrandom(0, %thisObj.path.getCount()-1);
}
^^%node = %thisObj.path.GetObject(%thisObj.targetNode).getTransform();
^^%thisObj.setMoveDestination(%node, false);
^}
}
##f##unction AIPlayer::think(%this, %time)
{
^%target = LocalClientConnection.player;
^if ( %this.canSee(%target) )
^{
^^%this.state = $STATE_CHASE;
^^%this.lastSeenAt = %target.getPosition();
^^%this.lastSeenTime = getSimTime();
^^%this.chase();
^}
>>> Error report complete.

The big question is, what do I need to make sure he has done for the pre-requisites to get this to work?
Like including files etc?

Unfortunately I have no idea what version of torque he's using, and I don't know if it matters.

The preferred end result would be bots that spawn in, chase his butt down, and kill him.

Any help is greatly appreciated.

Nate

#1
07/11/2010 (1:42 am)
Looks like there is a bracket imbalance. Try checking to see if there is an extra opening/closing bracket or if there is one missing
#2
07/11/2010 (6:28 am)
Nathan, well i'm not sure how you would make the enemy bots attack you, that would require "thinking" processes like "Scan", "chase", "attack" etc

There is a really cool resource here: www.torquepowered.com/community/resources/view/15320 which has some really great stuff on AI, all within TorqueScript, and it works with TGE and TGEA. It has also now been added and improved a lot into the UAISK, here: www.torquepowered.com/products/ai-starter-kit but it costs $60...so i'd look at the resource first.

And in terms of the issue with what you've written, i'd just go through and check you haven't made any typos in words like "function" and check you haven't got extra brackets and braces, like Scooby suggested. Their normally the issues I find i my own work.
#3
07/11/2010 (6:46 am)
if ( %this.canSee(%target) )

What's missing on the end? (hint.. ; )
#4
07/11/2010 (10:05 am)
got it working, there was a bracket imbalance once i went through the whole thing.

thanks for all the help.

Thanks for the resource info Maximillian, I'm sure I'll be back with more questions on implementation for it. I know nothing of how torque works, just messing with his .CS scripts right now.