Game Development Community

Understanding bots...

by Kirby Webber · in Torque Game Engine · 01/15/2006 (12:50 pm) · 3 replies

Greetings~

Before I get into specifics here, let me throw a few caveats out there...

First, I'm hoping that this will become a "teach a man to fish" kind of post, although there are a few erratic behaviors I'm currently trying to eliminate.

Second, I'm working with vehicles, and for what it's worth, bot scripting for vehicles doesn't appear t be quite the same as scripting bots that derive from the player() class.

Currently, I'm trying to do two things -

1) get the bot to follow a simple path, which is currently made up of four nodes.

Currently, the bot spawns on the path and immediately heads for node 1. So far so good, but there is something odd here.

At first, the bot travels past the node, turns around and performs a loop to make contact with the node before moving on to node 2.

At node 2, things get really weird. First the bot begins circling the node as before, but he doesn't stop. He simply continues to circle the node, somewhat indefinitely - occasionally moving on to node 3. When he does move to node three, he'll circle that one semi-indefinitely and so forth.

Basically, the bots doesn't seem to register when it's reached it's destination. =\

Any insight here would be greatly appreciated - again, I'm looking for some insight into the overall navigation of AIPlayers, so don't be afraid to get technical, if you go over my head (a likely scenario) I'll do some homework to try and get up to speed.=)

The second issue is that the bot takes no damage. From anything.

Currently it is deriveing from a custom vehicle datablock that inherits from a parent datablock, which has all the functions necessary to damage the object.

The player object derives it's damage()/ onDamage() etc. in the same way, and it takes damage, so I'm a bit confused as to why the vehicle bot doesn't behave the same way?

At any rate, thanks for reading through this and thanks in advance for any and all advice.

#1
01/16/2006 (10:56 am)
For your issue with arriving at destination, make sure that your "has arrived at destination" tolerance (how close they have to be at the point) is an appropriate threshold for the vehicle doing the moving.

For your damage issue, make sure that the underlying damage methods are derived as virtual in the parent class (not the console methods, but the helper functions themselves).
#2
01/16/2006 (1:39 pm)
Using Basic AI Commands

Doesn't cover everything you are wanting to do but might help you get started. The bot pathing system in the demo is just a layer of script sitting on top of this basic functionality so learning about it will help you in modifying the pathing system to meet your needs.

Also, did you look at the AI Guard Unit resource?
#3
01/21/2006 (9:22 am)
Wow, I missed both your responses for all this time...

Stephen - upping the value in setMoveTolerance() certainly did the tirick, thank you very much. What's amusing is that I had assumed that particular function call was setting an acceptable variable range with regards to speed. I have no idea how I got THAT in my head. =)

Matt - I have indeed read (and use for referenc) both of the resources in question. It's odd though, some things aren't quite the same when working with vehicles, but it's certainly close enough for trial and error to suffice in most situations.

I'm off to change my damage methods to virtuals now. Cheers! =)