You're blocking ads, which pay for BlenderNation. Read about other ways to support us.

Project Artificial Intelligence Racing - A.I.R.

4

Nycholas Weissberg presents his racing game A.I.R. - a work in progress.

Hello BlenderNation!

I bring to you all a downloadable demo of the Artificial Intelligence that I am working on (Project A.I.R). There is still much to be done, but I think the community may like my contribution. This is the first AI that I've made available for download. Hope you enjoy playing around with it.

The main idea of this project is to make an working racing game A.I. for all the blender community to use in their own projects. Although currently usable it's still a work in progress.

Here are some questions and answers from the BlenderArtists forum:

Q - cypher2012:
Nice work. Are you using a combo of path following and waypoints? I haven't made race game before, but I'm guessing that's how it's done. Looks really smooth. Well done.

A - Me:
It's more waypoints than path finding, since there are no alternative roads, using waypoints seemed more strait forward...

Q - Smoking_mirror:
Looks really interesting. How are the cars calculating their path? Are the drawlines an illustration of raycasting? They're pretty good at avoiding crashes.

A - Me:
The def controllerAI() inside the Script "carControll.py" does the controlling of the vehicle in this file you will find all the calculations.
The lines that are the SAME COLOR as the Car's Stripe are Vectors that are used in the calculation of the Path he needs to follow.
The WHITE line is used to calculate the Angle to the furthest point of the Track possible in the current speed of the vehicle.
The RED line that eventually appears is the Ray casting that verifies proximity of other vehicle, in other words, the eyes of the driver.

Q - SolarLiner:
How good/complex are the physics for the cars? IMHO they take turns a little bit faster than I would think they would.
Anyway nice AI! Smooth and enjoyable to watch. Good job on that!

A - Me:
The car is using the car constraints physics similar to the one found HERE It's quite good, also In the Motor.py Script I implementer the car's gear ratio explained HERE and HERE also the gear values in:
line 122: GearRatio = [3.78, 2.12, 1.27, 0.87, 0.66]
Are the actual value for this model of Jetta. So the speed of the vehicle for example in first gear at 2000 RPM is the actual speed that the real Jetta would go at.
line 165: maxSpeed = ((82.1 * own["RPM"]) / (GearRatio[own["GEAR"]]*3.42))/1000

The RPM can be calculated from the current speed:
line 136: own["RPM"] = ( ( (ownSpeed*1000) * (GearRatio[own["GEAR"]]*3.42) ) / 82.1 ) + power
power is the power that the driver is applying to the car, in other words, the gas.

Thank you very much for the attention, feel free to use this A.I. as you like.

About Author

Bart Veldhuizen

I have a LONG history with Blender - I wrote some of the earliest Blender tutorials, worked for Not a Number and helped run the crowdfunding campaign that open sourced Blender (the first one on the internet!). I founded BlenderNation in 2006 and have been editing it every single day since then ;-) I also run the Blender Artists forum and I'm Head of Community at Sketchfab.

4 Comments

Leave A Reply

To add a profile picture to your message, register your email address with Gravatar.com. To protect your email address, create an account on BlenderNation and log in when posting a message.