Game Development Community

Vehicle AI

by Daniel Neilsen · in Torque Game Engine · 05/08/2002 (1:15 pm) · 82 replies

Hey guys,

Just wondering if anyone out there has done anything in relation to vehicle ai?

Has anyone tried to get this working?

When I try and give my bots commands to move (my bots are hover vehicles) the dont seem to wanna go anywhere :/

Anyone had any luck with this?
Page «Previous 1 2 3 4 5 Last »
#1
05/08/2002 (5:35 pm)
I had been working on *racing* AI, for a racing game. Nothing complete yet, though. Is that what you're looking for?
#2
05/09/2002 (3:35 am)
Well

Currently I have written code to make my bots detect powerups and detect threads and determine what they should do.

This seems to be working correctly except that I cant get them to move...lol or shoot for that matter

I know where I want them to go too....just cant get them there :/
#3
01/28/2003 (1:49 pm)
Has anyone made any progress on bots using vehicles? Having them run around in circles is funny but not that useful.
#4
01/29/2003 (1:13 am)
oh yeah I got some cool racers here ..
was pretty easy to add..

what was needed was they dont calculate a valid steering angle
based on thier destination point ..
it works fine when walking but oversteering is the problem
as the vehicle's rely on this.

what I did was write a function that built a triangle
based on vehicle center, front and point of interest
then using the desired angle and current steering angle chose the next new angle to apply works sweet.

but to figure out if it was positive of negative turn
I had to rotate the point of interest around the vehicle center
and was allowed then to do a simple x plane test of left right.

as well I added a simple AIObjective class
and gave the AIPlayer a Vector of pointers to them manipulated thru the script.

so I have some simple racers ready and all the event driven objective handling is thru the script.
Edit:
oh yea well if you want to look at how ive done it it shouldnt be too much trouble.
#5
01/29/2003 (3:30 am)
Badguy, I'd be very intereted in seeing that. I don't think I need anything too elaborate for what I'm doing, but making bots at least move the vehicles around somewhat reasonable would be a huge help :)
#6
01/30/2003 (6:29 am)
I too am developing a racer. (Seemed the easyest to get my feet wet) and would like to take a look at what you got done badguy. If its not to much trouble. It would at least give me a direction to start in.
#7
01/30/2003 (11:31 am)
Ok,
do you want the code?
or the algorythm I used?

should I paste it Right here?

is One function
I needed a couple class variables and I stole the extractEuler function from the editor
(it should be a Matrix function)

as well I had to add a function to the Vehicle class
so I could access the mSteering variable.

and then a simple isMounted() test in the getAIMove and call my function.

Edit:
I'll Paste it in here when I get back if no reponse.
#8
01/31/2003 (6:46 am)
Well is it complete enough to submit as a resource? So everyone can take advantage of it. If not Pasting it here would be good for me. Thx badguy...i just started getting into programming and need all the help i can get :OP this stuff can give you a brain hemerage.
#9
01/31/2003 (1:27 pm)
I'd be really interested in taking a look at your function also. And most grateful for it as well. Thanks!
#10
01/31/2003 (6:33 pm)
Well, I'd apreciate to see this too. AI are crazy racers maniac actually :)
#11
02/01/2003 (4:52 am)
Ok here goes nothing ,
tis complete for the most part .. I will submit as a resource when I complete the simple z handling for flight
[code]F32 AIPlayer::getSteeringAngle()
{
// Build a Triangle .. calculate angle of rotation required to meet target..
// man there has to be a better way! >:)
Point3F desired;
if(mAvoidObject)
desired=mAvoidLocation;
else
desired=mMoveDestination;
MatrixF mat = getObjectMount()->getTransform();
Point3F center,front;
Point3F wFront;
Box3F box=getObjectMount()->getObjBox();

box.getCenter(
#12
02/02/2003 (6:55 am)
Sweet thx alot. your hard work is appreciated. :O)
#13
02/02/2003 (11:55 am)
Very Cool :) tx

Edit:
im wondering if anyone else is plugging on this?
im thinking of adding Flying Vehicle support now.
#14
02/27/2003 (5:06 am)
Badguy,

Thanks much for sharing this. I will try it soon.
#15
03/04/2003 (4:19 pm)
Badguy,
I would be very interested in flying vehicle ai
#16
03/05/2003 (5:54 am)
Yeah. Flying vehicle AI is one of the major pieces I need to either do or wait for Badguy ;)
Really my lack of openGL and what I believe are physics components(mass, inertia, turning radius based on speed, etc ) needed to work in conjuction with any FV AI has saturated my drive (to do it) attempts. I hacked at the aiMove stuff and could never get it to act as needed so I did other stuff.
My binary build of the Space Environment effort would be an ideal place for universe deployments of flying vehicles.
@Badguy - If you want some collaboration on the FV AI, I would be glad to finally rollup my sleeves and go at it.
#17
03/07/2003 (12:30 pm)
Ok .. I can play with this .. really it will be simple as I will take the same plan you see above and work it for the z
what I would like is someone smarter to come in here and say whether or not this is an effecient way to do this.

:)
is there an easier way to find this information in the wide world of Matrices?

Edit :
Wendell if you would like to add it great Paste it here!

simply study the above see where i've used the find angle from side triangle trick.

you'll notice that i've transferred the plan to 2d.
(ignored the z)
what is here is a triangle laying on the x,y plane with one angle right at the front of the vehicle.
what is needed is the same thing except laying on the z,y plane
and then the angle calculate for it applied as pitch.
this can be added to this code to simplify the math needs

the fact that this vehicle has all the physics applied and we are only stickin in a driver simplifies alot for us.
#18
03/07/2003 (1:19 pm)
I'm not really having any trouble with the Current Code
but I am wondering if there is a more effecient way to code the math portion by maybe using the dot product somehow.

I'm thinking this might be a little expensive.
#19
03/07/2003 (1:37 pm)
Badguy,

I'm a bit short of time at the moment so can you sum-up what you're doing in the code descriptively as I know little to nothing about the vehicle code?

Are you trying to determine steering angles (within limits) for a vehicle in 2D space to meet a target in 2D space? Could you give me the problem with example parameters so that I can give you a cancelled solution (optimised)?

- Melv.
#20
03/07/2003 (2:06 pm)
yea that is exactly what im doing :
Quote:Are you trying to determine steering angles (within limits) for a vehicle in 2D space to meet a target in 2D space? Could you give me the problem with example parameters so that I can give you a cancelled solution (optimised)?


so I chose to create the Triangle and use the side side side formula to get the desired angle,
using the front and center of the vehicle and the destination point.

but then to calculate left or right you can see I rotate the point of interest around the vehicle to simplify the test
that part im ok with tho.

is there not an easier way to get this angle?
Page «Previous 1 2 3 4 5 Last »