Racer AI ????.....

ok I know how to do this with the logic bricks but I thought it
would be cool if I knew how to do it with python, before I start
the code I thought out the method I want the parent object of
the script to fallow a series of empties, like go to E1 --> E2 to
E3 then E4, back to E1 and do it all over again. how would i
acomplish this with python in blender?

plz Oo I need help!

If I understand you correctly, you need to create waypoints for oponents in racing game. I also currently develop racing game and I use following method for waypoints: Every waypoint is empty and has init and order property. Order property defines its position in set of waypoints, init property is used for initialization purpose. In initialization I set init to 1 (to do it only once) and then add waypoint to ordered list of waypoints.
When race begins, AI gets first waypoint and aims car to it. When car reaches waypoint, AI shifts to next waypoint in list. When end of list is reached, AI returns back to first.

hmm… going to preset empties on the road, thats a good idea, kind of complex though and u’d have to create new positions for each track

i think ive a got a simlier and more basic way of making AI for racing games

check out this zipped .blend file for my 3 AI cars
http://www.geocities.com/ineedanewbike/RACEBLEND.zip

the graphics are brutal but the AI is intellegent enough to run around the track

i never used python, and the brick logic is SO SIMPLE
just create a left and right wall, then give them each a property of “left wall” and “right wall”, and when an object touches prop “left wall” it will cause the car to turn right and when another object touches prop “right wall” it will turn left…

i had invisible ghost objects extend from the AI car to detect the walls so the car turns before hitting the wall, check out the .blend, its easy

i hope this helps

ineedanewbi: thanks man that is a great aproch that I hadn’t thought of yet?
very usfull and acurate, but like I said before I know how to do a Logic Brick racer AI, I realy want to learn how to do it in python…:wink:

ashsid: thanks for the info :D… is there any chance you could send me the code for an example? my email is alhanzo@shaw.ca

Heay Hanzo, got what your searching for, http://space.tin.it/clubnet/arbenom/simpleai.htm had some sparetime, because I’m finished with my homework and now my summer holiday is started. I’ll hope you can use it :stuck_out_tongue: , but let me see it when you used the tutorial 8)

ineedanewbike, your way works well except does your example work when the turn are 90 degrees and the track uses corners instead of curves? cause if you make a turn that resembles a square then the “ghost cars” won’t be able to always touch the side, would it still work?

JD-multi: ow this burns somebody makes a tut and I can’t get it the links dead man could you send me the tut zipped in an email?

plzzzz JD-multi = :Z

strange it dosn’t work in netscape I tried it in IE and it worked thanks JD-multi…

snowy_duck

hmm… i “think” the AI would still work if it hits a 90 degree angle

the car is one object, and the wall detectors are children objects that spread out from the front of the car in “Y” like shape. a square track would still have two sides, a left and right wall, one of the Y branches will eventually touch a wall and choose to turn a certain direction if u know what i mean.

im not 100% possitive, u can try it with the AI already there and just make a square turn. just study the objects and brick logics and test it to find out.

Hanzo,

sorry, at this moment my AI is still in development stage, so it isn’t useable and looks really ugly.

JD-multi: ow this burns somebody makes a tut and I can’t get it the links dead man could you send me the tut zipped in an email?

-Try this : http://space.virgilio.it/arbenom/
(Tutorials section).Anyway,this is an old tut.
So if you want something new, must get this game

http://members.xoom.virgilio.it/glabro1/MountainRace.zip

-I try to explain the concept because have no time to
write a tut(sorry).There are two scripts in that game
The first one"ExtractPath" if connected with a dyn. object
that moves,gets its coords and put them in a txt file.Then
these coords if inserted in the “FollowPath” script makes
the car to move where the first one moved.I did this because
the numeric coords can be controled better(for ex. ifyou have
an obstacle in front of you,increment the x or y coord).I hope
it will be useful.

Ben

Ok, fine that it works for you in IE. I almost e-mailed you the tutorial, because when I find a tutorial which is very usefull, I save it most of the time on my pc. So e-mailing it, is possible. 8)