Announcement

Collapse
No announcement yet.

Blueprint Racing AI

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Blueprint Racing AI

    Hello!

    Here is a quick preview of how the system currently operates[This Is Me Racing The Ai]
    (Check Later Post To See How Updates Have Been Implemented)



    So i am creating a racing project for my last year at Uni At first I was going to use the other engine that starts with a U, but then i tried Unreal :P. This is my first Unreal Project so its all wip/learning . Anyways I was going to code the AI in C++, but i really like the easy control and debugging of blueprints, so I decided to use them . I haven't found many references for Unreal Racing AI so this system is built from the ground up.

    The AI controls the advanced car example, and uses all the same inputs a human player would use. The system currently uses just one lane. The user adds some way points along the track and then fine tunes splines between these tracks.


    THINGS TO DO
    1. Steering. Done
    2. Acceleration and Braking Based On Corner Curvature.Done
    2. Flying Balance(If the car is jumping stop it flipping over).Done
    2. Raycast Obstacle Avoidance.
    3. Random Error and Steer Target Based On Driver Skill.Done
    4. Anti-Reverse Driving(Stop the AI Driving Backwards Around the Track). Done
    5. More intelligent braking.
    7. Clean All Blueprints(Create Functions, Remove Unnecessarily Variable etc...)

    Any suggestions or tips would be greatly appreciated, please scroll down to see how the AI has been implemented.
    23
    Yes
    73.91%
    17
    No
    26.09%
    6
    Last edited by StonedRhino; 08-19-2016, 12:23 PM.

    #2
    This looks great work. Are you gonna add this someday to marketplace, because many has waited proper Car AI years. And is those things easy to add different track. I am making racing game where are tracks and cars, but need someday maybe in the end of year to learn AI or buy if there is somewhere easy system to adjust own game

    Comment


      #3
      Thanks!

      To lay out a new track you simply adds way points along the track(these way points contain a perfect apex, middle, and worst apex marker), the script then auto generates the line based on these markers
      (I am currently updating the logic so cleaner racing lines are produced and less user input is required).

      I do plan on making this available to the public, but my main priority is getting it finished for Uni(Next year) .
      Last edited by StonedRhino; 07-16-2016, 01:57 PM.

      Comment


        #4
        Okay so not coming marketplace before that. Too long time to wait next year. But still great work

        Comment


          #5
          Ray Cast Braking and The Beginning of overtaking choices

          Sorry Dude I have no reason to rush
          Last edited by StonedRhino; 08-04-2016, 09:55 AM.

          Comment


            #6
            Its been a while since I updated this post, but I have been working hard :P The project became overly complex and required to much input from the level designer(Maximum corner speed, Braking Zones, etc etc...) So I decided to take the project back to basics.

            The racing AI will now use the spline to calculate maximum cornering speed, to brake or accelerate accordingly!
            The AI uses then radius of a corner to determine how fast it can take the corner without loosing grip, the radius of a corner is calculated using the following formula:
            Click image for larger version

Name:	yay.png
Views:	1
Size:	27.8 KB
ID:	1112989

            Once the AI knows the radius of a corner it can then calculate the maximum cornering speed, so long as it knows a few other variables such as mass or down force. The maximum cornering speed is calculated using this formula:
            MaxCorneringSpeed = sqrt(((Tire-RoadCoefficient * CornerRadius) * (GravityForce + (DownForce / Mass))))
            This formula was taken from this paper, http://game.itu.dk/cig2010/proceedin...10_048_083.pdf
            Here is a video showing the formula in opertation:


            And Finally A video of the AI doing some laps on the freshly created track.
            Last edited by StonedRhino; 08-20-2016, 08:58 AM.

            Comment


              #7
              Another Day Another Update - Direction Detection and Flying Stabalisation

              LEGACY UPDATE HAS BEEN REDESIGNED

              So I have completed the logic that stops the AI driving backwards around the track, this turned out to be a little more complex that I thought as the track is made up of multiple splines. But it works now so I am going to move on, the logic compares a distance along a specific spline and the cars distance along the spline. The car is then only allowed to accept a steering target if the distance conditions are correct, if they are not then the car will attempt to drive back to the closest track point.

              Here is a video showing the system in operation.
              I started the car backwards on the track, set the tire data incorrectly and added obstacles placed to make the AI crash and flip.
              The video shows the AI crashing multiple times and then rejoining the track(in the correct direction).


              I have also completed the 'flying stabilization', this just stabilizes the car so it does not flip while in the air.
              The video below shows the same track with the obstacles removed, and tire info set correctly.


              And here is a preview of the blueprint, I don't really want to show it in full resolution just yet. (But that will come soon once it has been cleaned up :P)
              Click image for larger version

Name:	waga.png
Views:	1
Size:	401.8 KB
ID:	1113348
              Last edited by StonedRhino; 08-19-2016, 09:12 AM.

              Comment


                #8
                Nice work. I appreciate everyone who is making some car AI

                Comment


                  #9
                  Update 3: Another Complete Rebuild

                  As the subtitle suggest I have rebuilt the entire system again to give better results.
                  • Laying down the spline track is now easier than ever!
                  • Adjustments have been made so that cars more accurately determine the maximum corner speed.
                  • The racing is now made up of a single spline, allowing for simpler codes(blueprints).
                  • I have also added some better overtaking conditions, there is now a single 'race controller' object that each car references and queries to find out whether it should overtake or defend its current position.





                  A Video Of me Laying down a bran new track!


                  A Video of the AI racing the bran new track!


                  A Video Of Me Racing The Ai's (These Cars Are Front Wheel Drive Open Diff, but the Ai can handle any transmission setup)


                  A Quick Screen Shot Of the Racing AI blueprint, Im still not sure if i want to show full resolution screen shots.
                  Click image for larger version

Name:	picture.png
Views:	1
Size:	270.7 KB
ID:	1114036
                  • Next Thing's To Do : Local Obstacle Avoidance, Better Lane Changing Control (Sometimes the AI Will spin out when attempting to overtake), Better Car senses in general(Are we skidding, understeer/oversteer etc).
                  Last edited by StonedRhino; 08-20-2016, 10:25 AM.

                  Comment


                    #10
                    This looks really good

                    Comment


                      #11
                      Are you still working on it?

                      Comment


                        #12
                        Hi StonedRhino!
                        Do you plan to release this project or make a tutorial?
                        I'm in search for something like this!
                        Thank You

                        Comment


                          #13
                          You should put it up on the Marketplace. I'm sure it would sell like hotcakes.

                          Comment

                          Working...
                          X