Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / i need help with AI (turning and moving toward a target)

Author
Message
Ag3ntSm1th
22
Years of Service
User Offline
Joined: 13th May 2003
Location:
Posted: 30th Jul 2003 10:04
i need some pointers on an efficient way to turn a computer controlled racer toward a taget location (on a matrix landscape) using y angle and coords of player (and target location coords). i never was good at anything beyond algebra so this sin cos tan business just confuses the hell outta me. if anyone can send me in the right direction, it would be much appreciated. meanwhile i'll be hard at work with my face in a trig book i picked up from b&n 2day. thanx alot in advance.
"The secret to creativity is knowing how to hide your sources." - Einstein
my DarkBasic creations - http://www.sixurbanninjas.tk
Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 30th Jul 2003 10:44
I'm not sure how you want to implement this, because racing games tend to have angular momentum and friction and other strange aspects. I'll give you the basic idea though:

ATAN( (comp_y#-dest_y#) / (comp_x#-dest_x#) )
This will return the angle between the computer car and the destination.

With this, the rest is simple. Keep rotating the computer car until its angle of rotation is roughly that of the calculated value above. It's easier to use a variable to keep track of the car rotation in addition to YROTATE OBJECT, rather than using TURN OBJECT LEFT/RIGHT.

Ag3ntSm1th
22
Years of Service
User Offline
Joined: 13th May 2003
Location:
Posted: 30th Jul 2003 23:14
thank a million
with what you told me, and what i found in the tutorials section, it shouldn't take more than a few minutes to get it working properly.

btw, off subject, have you got an ETA on 1.10? see, i've got all these cool ideas that i can't try, and i'll probably forget them ->

"The secret to creativity is knowing how to hide your sources." - Einstein
my DarkBasic creations - http://www.sixurbanninjas.tk
Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 31st Jul 2003 04:21
Hopefully less than 2 weeks left before 1.10. Practically everything is implemented, except the ship earning portion is still under development.

Ag3ntSm1th
22
Years of Service
User Offline
Joined: 13th May 2003
Location:
Posted: 31st Jul 2003 08:10
sweet

"The secret to creativity is knowing how to hide your sources." - Einstein
my DarkBasic creations - http://www.sixurbanninjas.tk
Ag3ntSm1th
22
Years of Service
User Offline
Joined: 13th May 2003
Location:
Posted: 3rd Aug 2003 09:05
i'm still having troubles with the ATAN method of turning the AI players...


ad#(players) should go from 0 to 359 as i turn my car around one whole turn, right? well it's not happening. i still don't know all i need to know about trig so bear with me... i'll study the tutorials some more until someone sets me straight.

"The secret to creativity is knowing how to hide your sources." - Einstein
my DarkBasic creations - http://www.sixurbanninjas.tk
UnderLord
21
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 3rd Aug 2003 09:48
the tutorials do cover this i believe i remember reading a little bit about it but im not exactly at the AI part of my game yet =\

http://www.freewebs.com/independant/
Ag3ntSm1th
22
Years of Service
User Offline
Joined: 13th May 2003
Location:
Posted: 3rd Aug 2003 11:47
actually i just figured it out. thanx
i'll have a beta soon. can't release details, must...keep...top..........secret
my first solid release

"The secret to creativity is knowing how to hide your sources." - Einstein
my DarkBasic creations - http://www.sixurbanninjas.tk
UnderLord
21
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 3rd Aug 2003 19:32
haha nice agent now only if i could find a solution to my problem!! argh

http://ww.freewebs.com/independant
Ag3ntSm1th
22
Years of Service
User Offline
Joined: 13th May 2003
Location:
Posted: 3rd Aug 2003 19:51
this is all i needed to find the amount of degrees any given character would need to turn to face the target location:


you will have to chop it up to get it working with your code, but it will work if you want this kind of AI.

"The secret to creativity is knowing how to hide your sources." - Einstein
my DarkBasic creations - http://www.sixurbanninjas.tk

Login to post a reply

Server time is: 2025-05-19 19:24:39
Your offset time is: 2025-05-19 19:24:39