Search Unity

Pro Racing AI available for sale on my website (soon on Unity Asset Store)

Discussion in 'Assets and Asset Store' started by dgutierrezpalma, Nov 21, 2011.

Thread Status:
Not open for further replies.
  1. tezer86

    tezer86

    Joined:
    Jul 19, 2010
    Posts:
    90
    I have a pretty noobish question but I cant see any documentation about it on the website.
    Is there any code built in for lap counters and start finish lines? I can write this myself and not be lazy but didn’t want to if it was in there somewhere. I have seen something about checkpoints but I don’t know what im meant to be doing to implement these.

    Cheers
    Terry
     
  2. dgutierrezpalma

    dgutierrezpalma

    Joined:
    Dec 22, 2009
    Posts:
    404
    I know the documentation is lagging a little behind the code, once I release the new version I will start updating the documentation, fixing the bugs reported by the customers and release a new version with the bugfixes and updated documentation (but without new features) soon after that.

    About your question: in the current public release there are several unfinished classes (StartTimeCollider, Checkpoint, CheckpointManager and their base classes) to deal with laps, sector times and lap times, but I forgot to remove them from the project folder before making the public build [my fault]. However, in the development version of my product I've finished implementing those classes and I will include a simple example to build a Live Timing screen like in Formula1.
     
    Last edited: Mar 30, 2012
  3. screenracer

    screenracer

    Joined:
    May 9, 2011
    Posts:
    112
    Do you have an estimated release date for your next version with avoidance? Thanks!
     
  4. dgutierrezpalma

    dgutierrezpalma

    Joined:
    Dec 22, 2009
    Posts:
    404
    I wanted to release the next version of my product before the end of the month, but I found a complex bug that prevented me from finishing it on time. If I don't find other unexpected problems, it should be ready in a couple of weeks.
     
  5. dreammakersgroupAdmin

    dreammakersgroupAdmin

    Joined:
    Feb 13, 2012
    Posts:
    40
    for this you can make the same trick that i did.
    i am not at office right now , so i don't remember exactly the code , but i will give the idea
    add AI component to your main car, and be sure your car is not driving by AI make it drive by your input.
    after that you can make all racing logic for your car, you can make your car respawn if it is out side the road by specifying some parameter in AI component , you can make respawn if it is in wrong way, you can also check the trackPercentage member, which give you the current percentage of your car in the track, the value of this percentage is from 0..1 , by checking this value you can make lab counter.
    if the value step from 1 to 0 this is mean you complete one labe ....and so on
    actually i added lab counter member to AI component, and from the lab counter and track percentage you can calculate your current order between other cars.
     
  6. dreammakersgroupAdmin

    dreammakersgroupAdmin

    Joined:
    Feb 13, 2012
    Posts:
    40
    you can also make your car drive automatically by enabling AI input :)
     
  7. dgutierrezpalma

    dgutierrezpalma

    Joined:
    Dec 22, 2009
    Posts:
    404
    I'm using a slightly different approach, but I'm also doing these things for both (player AI controlled vehicles) in the development branch :)

    This approach has several problems:

    • Do you decrease the lap counter when the vehicle pass from 0 to 1 too fast? If you don't take that into account, I can start crossing the Finish Line in both ways (forwards and backwards) and increase the lap counter very fast.

    • Using the track percentage to calculate the order between cars is something specific to your game. I have a customer who is developing a racing game in which the cars don't start the race at the same time, so you should calculate sectors and lap times instead of relying in the trackPercentage to calculate the real order. For example: if the slow cars start the race first and the fast cars start the race several seconds (or minutes) later, the slow cars will have a higher trackPercentage value (so they will have better positions) even if they are much slower than the fast cars (which should have better positions in the race results).

    • You can't use the "track percentage" reliably to check if the vehicle has crossed the racing line because this percentage is calculated based on the position of the nearest node in the racing line, but a "track percentage == 1f" doesn't means that the vehicle has crossed the Finish Line, it means that the node in the Finish Line is nearest than any other node in the Racing Line. It is possible that 2 vehicles crossed the racing line almost at the same time, but the car which is lagging a little behind is detected as the 1st vehicle because it was driving closest to the ideal racing line (even if the other vehicle crossed the Finish Line in first place).

    Depending on your game, some of these problems may not be applicable, but I'm using a different approach: I'm using several colliders placed at different points of the racing line as "checkpoints", I'm checking if those checkpoints are travelled in the correct order and I'm registering how much time needed the vehicle to reach the next checkpoint, so I can calculate the sectors and lap times (this will be very useful for games where not all the vehicles start at the same time). In addition, as I am using colliders for checking if the vehicle has reached the checkpoint or not, I can check reliably which vehicle has crossed the racing line in first place.

    The only downside of my method is that the vehicle positions are only updated when the vehicle reach a checkpoint, as a work-around we could increase the number of checkpoints so we update the positions more frequently, but maybe I can modify my system to take into account the trackPercentage (in addition to the "last checkpoint" time) as a heuristic for deciding which would be the correct order if two vehicles which are in the middle of the same sector.
     
    Last edited: Apr 1, 2012
  8. dreammakersgroupAdmin

    dreammakersgroupAdmin

    Joined:
    Feb 13, 2012
    Posts:
    40
    for this at first i made one way collision plane at start line , but this way it look like has problem because it make a little stuck , i don't know why, but right now i am decreasing lap counter.
    i did not check the code how you calculate track percentage, but i did in game print for this value, and i test it while i am driving, it was very accurate, it give my position in track in millimetre , i will do check again.
    if this way require setup , i don't prefer it, i prefer to monitor track percentage because it give a lot of statistics , it help me to know almost every thing, i will do check again how this value is calculated.
     
  9. dgutierrezpalma

    dgutierrezpalma

    Joined:
    Dec 22, 2009
    Posts:
    404
    In most cases you won't notice that this method is slightly inaccurate, but I wanted to warn you about the worst case: when two vehicles cross the finish line almost at the same time, if the one vehicle is driving close to the racing line and the other vehicle is driving far away from the racing line, this system could decide that the vehicle closer to the racing line have won even if it crossed the finish line in second place.

    You will have 3 different options to configure the new system:

    • You will be able to define the colliders manually and add them to the Checkpoint Manager.

    • You will be able to assign a Racing Line to the Checkpoint Manager and tell it how many checkpoints you want. The Checkpoint Manager will create those checkpoints distributed evenly around the track.

    • You will be able to mark the nodes of the Racing Line as "checkpoint" and the Checkpoint Manager will create a checkpoint at those positions.

    The system could become a little confused if the car collides with 2 checkpoints at the same time, but it should work perfectly as long as the checkpoints aren't placed too close. By the way, what kind of statistics are you calculating from the track percentage? Maybe I can include them in the official release...
     
  10. dreammakersgroupAdmin

    dreammakersgroupAdmin

    Joined:
    Feb 13, 2012
    Posts:
    40
    right now only lap counter , car order is required, i don't know what is required in future
     
  11. dgutierrezpalma

    dgutierrezpalma

    Joined:
    Dec 22, 2009
    Posts:
    404
    Hey guys,

    Here you have crazy experiment with a flying car. I wanted to wait until tomorrow because I wanted to post this crazy test together with a more serious demo, but I have already posted that link in another thread and I thought I should post it here too. The good news are that I've started to create these demos because the new version of my product will be released very soon, I don't know the exact date but I will try to have everything ready during the weekend.
     
  12. screenracer

    screenracer

    Joined:
    May 9, 2011
    Posts:
    112
    It looks nice. It needs to lean more in the corners. Just check out the Back to the Future 2/3 films for reference. :)
     
  13. dgutierrezpalma

    dgutierrezpalma

    Joined:
    Dec 22, 2009
    Posts:
    404
    Hehehehehe, thanks for your comments, but I wasn't trying to implement a "realistic" behaviour for flying cars (can a flying car behave in a realistic way? :p).

    I have a couple of customers who wanted to develop a racing game with "flying vehicles" (probably airplanes or spaceships) so I wanted to show them that it will be possible to develop that kind of games with the next version of my product. I know the vehicle behaviour isn't very realistic, I created it in a few hours just for this demo, but I plan to integrate my product with other Vehicle Physics from the Unity Asset Store in future releases. ;)
     
    Last edited: Apr 17, 2012
  14. S0ULART

    S0ULART

    Joined:
    Jun 14, 2011
    Posts:
    131
    Very interesting. Nice done.
    Something I was looking myself for as you know.
    I wonder how this develops further ;)
     
  15. dgutierrezpalma

    dgutierrezpalma

    Joined:
    Dec 22, 2009
    Posts:
    404
    Well, the first step is finishing fixing bugs and releasing the new version. After that, the next step will be starting to integrate my product with all the Vehicle Physics available in the Unity Asset Store... or at least those Vehicle Physics that can be integrated with my product easily :D
     
  16. dgutierrezpalma

    dgutierrezpalma

    Joined:
    Dec 22, 2009
    Posts:
    404
    Here you have 2 new web demos:

    I haven't spent much time tweaking the racing line parameters for these demos and these Vehicle Physics are very different to the rest of Vehicle Physics supported by my product (so the behaviour of the vehicles in the demos could be improved if I had spent more time tweaking the values), but I only wanted to let you know that the next release of Pro Racing AI will support RapidUnity Vehicle Editor + Two-Wheeled Addon.

    We will need to wait until Greg Basset releases a new version of his products (with a couple of minor changes I've sent him), but I'm pretty sure we will be using both products together really soon.
     
    Last edited: Apr 19, 2012
  17. dgutierrezpalma

    dgutierrezpalma

    Joined:
    Dec 22, 2009
    Posts:
    404
    I have uploaded a new web build to my website, you should expect a lot of accidents in this demo because I have used it for testing the improved "Crash Recovery Maneuvers".
     
  18. tezer86

    tezer86

    Joined:
    Jul 19, 2010
    Posts:
    90
    Hey David,

    When can we expect a new version to go up with the object avoidence, lapcounters, race positions and pitting in?
     
  19. tezer86

    tezer86

    Joined:
    Jul 19, 2010
    Posts:
    90
    ok not really the place for this and I dont want to start a massive thread on Davids AI thread. However as we are all making racing games he it seems sensible to ask.

    How is everyone else here placing cars on the grid? I want to qualify and then place cars in their positions. At the moment I am assuming I place spawn points for each position on the grid? Rather stuck from there. Also to keep this in context of the thread, any plans to incorporate placing grid positions into the racing line David?
     
  20. dgutierrezpalma

    dgutierrezpalma

    Joined:
    Dec 22, 2009
    Posts:
    404
    Hi tezer86,

    I know it is taking longer than expected... I'm very busy with my day job and some features have been more difficult to implement than expected. I had to drop some planned features such as the PitStop but don't worry, I will implement them in the following release. Everything is almost ready... I only need to make some tests and build the package. The documentation is lagging behind the code and I'm far behind the planned schedule, I'm thinking in releasing the new version with the old documentation (most of the new features are self-explanatory) and updating the documentation in the next release.

    I have created a new demo for showing the collision avoidance, lap counters and race positions: all the vehicles are following the same racing line, but I have modified their "driver traits" and their "collision avoidance parameters" to change their behaviour. There can be some collisions (I will improve this system in future versions) but the AI will try to avoid collisions while overtaking and defending position. In addition, it will try to avoid obstacles with certain tag (that can be defined in the collision avoidance parameters). If possible, try to watch the demo using the fullscreen mode because you will see the Live Timing screen better.

    Don't worry, I also find this conversation interesting because I can borrow some ideas for future versions of my AI. For example, I wanted to discuss about the PitStops:

    In the next release I'm going to release a "PitLane" class that you can attach to any collider: when a vehicle enters the PitLane area it will start using the Speed Limiter (another new feature) and it will stop using the Speed Limiter when it exits the PitLane. In addition, I have implemented a system for sending events when a vehicle reaches (or misses) a checkpoint, when it completes a lap or the whole race or when it enters or exits the PitLane (that would be very useful for implementing penalties such as "Drive Through").


    However, I wanted to receive some feedback before implementing the "Pitstop action":
    • I suppose the player should stop the car completely to "start the PitStop" and should be able to "finish the PitStop" pressing the throttle button, do you agree?
    • How will the AI know if it should make a PitStop or not?
    • How many seconds should take the PitStop?
    • Should I add a hook so you can write your own function for deciding if the AI must stop (and how many seconds) or not?
    • How often should be called these functions?
    • I have already defined a hook for function that will be called when the PitStop has finished, should I add another function that will be called on Update() during the PitStop so you can update the fuel level over time?
    • Any other suggestions?

    I hadn't thought about qualifying and grid positions, but that is a feature I should add in a future release. I have fixed a bug that was only triggered with low frame rates, but I have learned with the Machine Learning feature that the accuracy of the vehicle simulation is decreased when we use high Time.timeScale values, so we may have some problems if we want to use a "fast forward" feature for AI qualifying.

    In any case, you will see in my last demo that I store all the sector and lap times, so it will very easy to calculate the position of every vehicle in the start grid. I need to develop a system for not allowing the vehicles to move until the start of the race... I will probably develop this system together with the PitStop because I also need a system for not moving until the PitStop has finished. In any case, I will appreciate any suggestion about how to implement the starting grid.
     
    Last edited: Apr 25, 2012
  21. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    i am looking to purchase this immediately and had a couple of simple questions.

    I am mainly in need of the timing and lap counting systems. I want to ad some AI cars into the game in the future but only for a little traffic on the track for now. Does the current release have the timing included?

    As for timing can it be configured for race length time and not just number of laps completed? As in, race for 20 minutes and then finish the lap that the AI is on?

    would i just need the binary script or the source for this?

    Thank you very much.
     
  22. dgutierrezpalma

    dgutierrezpalma

    Joined:
    Dec 22, 2009
    Posts:
    404
    The version available on my website doesn't have the live timing, but it will be included in the new version of my product. It was supposed to be released last weekend, but I found some unexpected problems and I preferred to postpone the release again instead of releasing buggy code. However, I will try to release the new version before the end of the week.

    It is a very good idea. I know there are some races which ends when the vehicles complete the current lap after the time runs out, but I didn't think about that when I developed my code. I won't include this feature in the next release because I'm behind the planned schedule and I don't want to add new features at this point, but I will add this feature to the following release after that.

    The source of the live timing script will be available on the binary license, so you can use it as example and adapt the code to your needs. Of course you will have a greater flexibility if you purchase the source license, but it won't be required for creating your own live timing screen.
     
  23. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    445
    Thanks very much for the reply. I am going to purchase today and start developing the racing lines (colliders) now.... and then and then worry about the timing and such when the "newwer" version is released later this week.

    Will it be a problem to "upgrade" my project to the new version when it is made available? should i just use the current version to get familiar with the product and start fresh when the latest version is released?

    Oh yeah i forget to ad...... Will it be possible to have a race recap screen? as in a way to display results of the race. possibly save them to a text file to be sent different places?

    Thanks again. I am excited to try this out.

    Kevin
     
  24. dgutierrezpalma

    dgutierrezpalma

    Joined:
    Dec 22, 2009
    Posts:
    404
    Well, there will be a minor annoyance, but it shouldn't be a big problem: I needed to change the internal structure of some classes (for example: the BaseRacingLine class) to implement certain new features and Unity doesn't like that certain properties have a different name in the new version. However, it is possible to export the racing line information to a JSON file before updating and restoring the racing line information from the JSON file after the update, you won't lose any information.

    I don't like breaking backwards compatibility, I know this kind of changes are annoying, but it was the only way to implement certain new features. This kind of changes will become rarer as the product becomes more mature, but I think they are unavoidable at this early stage in the development.

    What information would you like to display in that "race recap screen"? I have included a "Race Summary" screen in my last demo, but maybe you wanted to show some information which isn't available at this moment. About saving the information to a text file, I'm not sure about including that functionality in the official release (unless there are more customers who likes the idea) but you will be able to query the "BaseCheckpointManager" class to retrieve all the information you need. Then you could use LitJson or another similar library to build a JSON file with the information you have just retrieved from the "BaseCheckpointManager" class.
     
    Last edited: Apr 25, 2012
  25. Greg-Bassett

    Greg-Bassett

    Joined:
    Jul 28, 2009
    Posts:
    628

    Apologies for the delay in updating my RapidUnity Vehicle Editor packages, just been very busy this week, hoping to do next week with any luck!

    Looking forward to offering capatiblity with my vehicle products and David's awesome Pro Racing AI product! :D
     
  26. dgutierrezpalma

    dgutierrezpalma

    Joined:
    Dec 22, 2009
    Posts:
    404
    Hey Greg, did you have time to check the changes I sent you? Let me know if there is any problem with my code...
     
  27. Greg-Bassett

    Greg-Bassett

    Joined:
    Jul 28, 2009
    Posts:
    628
    Hi David,

    I had a quick look at the code, all looks fine, just trying to find time to recreate my packages and add to my site, and re-submit to the Unity Asset Store.

    Quick question, I saw your flying car demo, could this work with multiple cars, and object avoidance etc.

    Also, can you get cars to follow the path but with an offset, just wondered, as I would like to not have all cars following the racing line. Make sense...?
     
  28. dgutierrezpalma

    dgutierrezpalma

    Joined:
    Dec 22, 2009
    Posts:
    404
    Yes, the code from the demo can work with multiple cars, but the current avoidance behaviour could be "not good enough" to avoid collisions between flying vehicles because it isn't the same avoiding collisions with other cars, than avoiding collisions with other flying vehicles. The flying physics included in the next version of my product will probably be "too simple" for any real-world usage because I will included them only for demo purpose, but I will try to integrate my AI with the airplane / helicopter / spaceship Physics available in the Unity Asset Store in future releases.

    By default, the vehicle will try to follow the ideal racing line, but if the Collision Avoidance Behaviour is enabled and there are nearby vehicles, the AI will leave the racing line to start the overtaking (or the defending position) maneuver. If I've understood your request, you want the AI to follow the racing line using a small offset even if there isn't any nearby vehicle, is that right? Can I ask why do you want such feature?

    If you want the vehicles to follow different racing lines, you can use a different racing line for each vehicle in the scene... or you could change the "Driver Traits" so their behaviour is slightly different even if they are using the same racing line. Do you want to implement a feature that can't be implemented with those functionalities?
     
  29. dgutierrezpalma

    dgutierrezpalma

    Joined:
    Dec 22, 2009
    Posts:
    404
    LADIES AND GENTLEMEN, START YOUR ENGINES!

    The development of the new version of my product (v0.0.3-beta) has been completed and the packages will be uploaded to my site later today. All customers will receive an email when the new packages are available, so they can download the new version of my product (using the same download link).

    //---------------------------------------------------------------------------------//
    // Changelog
    //---------------------------------------------------------------------------------//
    AI:
    - The API has been updated.
    - Added support for flying vehicles.
    - Added support for RapidUnity Vehicle Editor and the Two-Wheeled Addon.
    - Added support for played controlled vehicles (using accelerometers, cInput or the built-in Unity Input).
    - Added support for smoothing the AI simulated input.
    - Added support for Speed Limiter (useful for a Pit-Lane --> PitStops will be added in future releases).
    - Added support for Respawn Colliders: OnTriggerEnter(), the vehicle will be teleported to the desired position.
    - Added support for Collision Avoidance Behaviour.
    - Improved the Respawn Behaviour.
    - Improved the Drifting Behaviour.
    - Improved the "Car Recovery" Behaviour.
    - Improved the "Track Borders Avoidance" Behaviour.
    - Improved the parameter organization in the Inspector.
    - Improved the calculation of the turning radius and the max speed.
    - Improved the AI behaviour with low fps or when the AI is called on Update() instead of on FixedUpdate().
    - Fixed a bug that could cause the AI to "forget" its position in the racing line after a respawn.
    - Fixed a bug that caused several timers not being updated correctly under certain circumstances.

    CHECKPOINT SYSTEM:
    - Allow the user to define the number of laps of the race.
    - Allow the user to define a list of colliders as checkpoints.
    - Allow the user to generate the list of checkpoints automatically from a racing line.
    - Search automatically all the ProRacingAI vehicles in the scene.

    - The following information is stored:
    • Sectors Times
    • Lap Times
    • Total Racing Time
    • Last Checkpoint Reached
    • Completed Laps
    • Best Personal Sector
    • Best Personal Lap
    • Best Absolute Sector
    • Best Absolute Lap
    • Vehicle Position
    • Pit-In time
    • Pit-Out time

    - The following events are launched:
    • Start of the Race
    • Checkpoint Reached
    • Checkpoint Missed
    • Lap Completed
    • Race Completed
    • Pit-Lane In
    • Pit-Lane Out

    RACING LINE:
    - The API has been updated.
    - Added support for importing roads from EasyRoads3D.
    - Added the possibility of defining a node as checkpoint.
    - The scale of the racing line has been taken into account in several calculations.
    - The Racing Line can be translated, rotated and scaled modifying those parameters in the GameObject.
    - The runtime performance has been improved because more information is precalculated on scene load.
    - The vehicle acceleration and the track banking are taken into account when calculating the max speed.
    - Fixed a bug with the interpolation algorithm that was triggered only when we had a single value.


    RACING LINE EDITOR:
    - Added support for calculating the optimal racing line automatically.
    - Added several checks to ensure that the introduced values are valid.
    - Added support for choosing between "View Speeds" or "View Sectors" in the Scene View.
    - The performance has been improved because the Racing Line is only updated after a change.
    - The sectors are sorted according to their "percentage end of sector".
    - Improved the accuracy of the "Node Subdivision" and "Node Reduction" algorithms.
    - Improved the "Generate Sectors" algorithm.
    - Improved the behaviour of the Handles in the Scene View.
    - Show the track length, the average track width, the average speed and the estimated lap time.
    - Show the percentage of start of the sectors.


    MACHINE LEARNING:
    - It is still considered "experimental", but the process has been improved in accuracy, speed and stability.


    INCLUDED SAMPLE CODE:
    - Simple "Live Timing Screen" example.
    - Simple "Race Summary Screen" example.
    - Simple "Read Events" example.
    //---------------------------------------------------------------------------------//

    WARNING: there has been a lot of internal changes since the last version of my product, so this version could be slightly more unstable than the previous version. In addition, Unity will lose the information stored in RacingLine GameObjects and Prefabs created with previous versions of my product, so you are recommended to use the following upgrade procedure:

    • Before installing the new version, make a backup of your project folder (better safe than sorry).
    • Save the information of Racing Lines stored as Gameobjects or Prefabs into external (JSON) files.
    • Install the new version of Pro Racing AI.
    • Restore the Racing Line information from the JSON files created before upgrading.
     
    Last edited: Apr 30, 2012
  30. Pulov

    Pulov

    Joined:
    Feb 20, 2010
    Posts:
    824
    uff!! ,major update!!! cant wait!
     
  31. dgutierrezpalma

    dgutierrezpalma

    Joined:
    Dec 22, 2009
    Posts:
    404
    Yes, that's the reason why I have needed several months to finish it... and I had to drop several planned features (such as PitStops) because I didn't want to postpone the release date again.

    It is very important to develop new features, but those features aren't useful if they aren't released publicly: some customers have complained about not updating my product for so long (and I think they are right), so I will start using shorter release cycles for future updates.

    //---------------------------------------------//

    EDIT:
    I've just uploaded the new files to my site, but it's a little late here... I will send the emails to my customers tomorrow morning, but I want to let you know that you can already start downloading the new file using the same download link, you don't need to wait until you receive my email.
     
    Last edited: May 1, 2012
  32. gunga

    gunga

    Joined:
    Jan 2, 2012
    Posts:
    170
    This looks great! I'm looking at buying this plus EasyRoads3D a car physics system. Just wondering which physics system you'd recommend?
     
  33. dgutierrezpalma

    dgutierrezpalma

    Joined:
    Dec 22, 2009
    Posts:
    404
    As I'm collaborating with several developers to provide a better integration between our products, I hope you will understand that I can't promote any Vehicle Physics over the others because it wouldn't be fair for the other developers. It doesn't matter which Vehicle Physics do you choose, I have developed a common interface with an abstraction layer for my product, so I can integrate easily my AI with different Vehicle Physics and provide the same level of support for all (the supported) Vehicle Physics.
     
    Last edited: May 5, 2012
  34. OmniverseProduct

    OmniverseProduct

    Joined:
    Feb 26, 2012
    Posts:
    1,568
    you could start with unity's car tutorial. That will give you a better idea.
     
  35. sipon

    sipon

    Joined:
    Feb 8, 2009
    Posts:
    143
    Simply take the best of them : unitycar !
     
  36. dgutierrezpalma

    dgutierrezpalma

    Joined:
    Dec 22, 2009
    Posts:
    404
    Hi guys, I have received a message in the old W.I.P. thread but I want to continue the conversation in this thread because some of the responses could be useful for other customers.


    I suppose it's my fault because the documentation is a little outdated. The development of the last release took much longer than expected and I had several customers who were asking me to release the new version as soon as possible because they needed some features from the development branch. So I released the new version without updating the documentation (so they could receive the update sooner), but I will update the documentation with the next release of my product.

    • Vehicle Type: let you choose if the vehicle will be controlled by the player or the AI
    • Vehicle Size (meters): let you choose the vehicle dimensions, that will be used for calculating how close is the vehicle to other vehicles or the borders of the track.
    • Player Parameters: you only need to define these parameters if you want to define a player-controlled vehicle inside Pro Racing AI (for example, if you want the player-controlled vehicle to appear in the Live Timing Screen or if you want the player-controlled vehicle to respawn if it gets stuck).
    • Race Start: these parameters will override the "Driver Traits" parameters for X seconds at the start of the race. In fact, the AI will interpolate between the "Race Start" and the "Driver Traits" parameters at the beginning of the race.
    • Crash Recovery: these parameters will allow you to tweak the behaviour of the vehicle when it tries to return to the racing line after an accident.
    • Collision Avoidance: these parameters will allow the vehicle to avoid other vehicles and obstacles in the track.
    • Track Borders Avoidance: these parameters will allow you to tweak the behaviour of the vehicle when it drives too close to the borders of the track, if it should try to brake a little or return to the center of the track instead of continue driving so close to the border.

    I consider "reasonable" all the default values, but if you want to get a different behaviour you should try to edit one parameter and see if the new behaviour is better or worse than the previous behaviour. I think the name of most parameters should be self-explanatory.

    First you need to create a racing line (it is easier if you place all the nodes in the center of the track) and then you need to put the "track borders" in their correct position. If you press the "Calculate Optimal Racing Line" button, the AI will calculate the fastest path (not the shortest path, but the fastest path).

    You will probably need to tweak the sector parameters to improve the AI lap times, but you should get a good starting point.

    A greater number of nodes will improve the AI accuracy, but I usually try to create the racing line using as few nodes as possible and then I use the "Calculate Optimal Racing Line" option. This option will try to calculate the optimal number of nodes for your track.

    The option "View Mode" let you choose if you want to display the track sectors in the Scene View or if you prefer a graphical representation of the racing line speed at each point of the circuit. The "Speed Ranges" option let you assign a different color to each speed (and the AI will interpolate between those speed ranges).

    You can place the car in any point of the scene and the car will try to find the nearest point in the racing line and continue the race from that point. However, if you use the CheckpointManager for storing the lap times, you will probably want to place the cars near the "Node 0".

    If the physical parameters of the vehicle are very different, you should use a different racing line for each vehicle. You can create a single racing line, duplicate that racing line and tweak the sector parameters for that new vehicle, that should work.

    Yes, it is possible... but I haven't published the product API yet because my product is in an early stage of the development and the API could change in future versions of my product. My plan is publishing the API documentation with the next release (unless I need to make many internal changes, which isn't expected), but if you can't wait you can tell me what do you need exactly and I can try to help you.

    Yes, it is a process to find the optimal sector parameters for a (racing line + vehicle) combination, so you should run this process separately for each (racing line + vehicle) combination. However, this functionality is still in an experimental phase (I have made it public because I want to receive customer feedback) and I can get better lap times tweaking the sectors parameters manually than running the "Machine Learning" process.

    Have you checked if the vehicle moves normally when you don't include the "Machine Learning" GameObject (for example: in the Unity Editor)?

    If the vehicle "enters" the Respawn Collider, it will be teleported to the selected position (if any) or to the nearest position in the racing line. In the next release I will add the possibility of defining a huge collider that covers the whole track and teleport the vehicle to the nearest position in the racing line if the vehicle tries to exit from the collider.

    The Checkpoint Manager is used for storing the sector times, lap times, fastest personal lap, fastest absolute lap, etcetera for every vehicle in the race. You must take into account the CheckpointManager won't detect the vehicles from UnityCar, Edy's Vehicle Physics or the Unity Tutorial, you must use a "Pro Racing AI" vehicle (AI4UnityCar, AI4EdyVehiclePhysics and AI4UnityTutorial) with VehicleType = PlayerControlledVehicle.


    Don't worry, I'm not a native speaker either. I hope you don't have any problem understanding my answers.
     
  37. smitchell

    smitchell

    Joined:
    Mar 12, 2012
    Posts:
    702
    Hi,

    I am very tempted to buy this, But I'm not entirely sure if it suits my game..

    My game chooses a random point in the city for users + AI to race to, So calculating it's path would need to happen in real time, Is this something the AI can do?

    Also I am not using any of the vehicle simulations in your demo's, I have a custom vehicle engine that's much more realistic/fun. Will I easily be able to add the AI to my vehicles? Or is it only compatible with the vehicle engines in your demo's?

    Thanks,

    Scott.
     
  38. dgutierrezpalma

    dgutierrezpalma

    Joined:
    Dec 22, 2009
    Posts:
    404
    Hi Scott,

    Calculating at runtime the optimal path (and sector parameters) for user generated tracks is the final goal of my product, but we aren't there yet... and I suppose we won't be there in the next few month:

    The "Calculate Optimal Racing Line" button does a good work finding the optimal position for the Racing Line Nodes, but it takes a few minutes (depending on your track) and I need to improve the Sector Parameter calculation because at this moment you need to tweak those parameters manually. That can be easily done in the editor, but unfortunately my product isn't ready (yet) for user generated tracks created at run time.

    About integrating my AI with custom Vehicle Physics, it's completely possible... as long as you have a method exclusively for reading the user input and another different method for calculating and applying the forces to the vehicle: I'm using an abstraction layer to separate the AI code from the Vehicle Physics code, so my AI can be extended easily to support new Vehicle Physics.

    If you purchase my product, you will see I have several classes (AI4UnityCar, AI4EdyVehiclePhysics, etcetera) that translates the AI decisions into "commands" for the Vehicle Physics, so you could use one of those classes as example (the source code for those classes is also available in the Binary License) for adding support for your custom Vehicle Physics.


    I'm afraid my product won't be suitable for your project (at least until I improve the Optimal Racing Line Calculation), but thanks for your interest.

    //----------------------------------------------------------------//

    EDIT:

    I'm trying to find a solution for your problem, I know this isn't what you expected, but let me know if it would be good enough for considering purchasing my product:

    • You would generate manually in the editor several "mini racing-lines" covering all the city. These "mini racing-lines" would be a very small racing line composed only by a few straights and corners linked together, but they would be so small that we couldn't consider it as a whole track.
    • Then you could use the current tools to generate [in the editor] the optimal path and calculate the optimal parameters for those "mini racing-lines".
    • Finally, I would add a function for concatenating those "mini racing-lines" at runtime so you could generate a random track at run time.

    In other words: you would create the "building blocks" in the editor (so you can use my current tools) and I would add a feature to build glue those "building blocks" to generate the final track at runtime. Is this good enough for your needs or you would need a true random track generated track at runtime?
     
    Last edited: May 15, 2012
  39. Deleted User

    Deleted User

    Guest

    Hi David,

    I just upgraded to 0.3 from 0.2, and I am having some problems:

    1. The AI cars just sit at the starting line and twitch their front wheels back and forth. The engines appear to be revving (from the sound), but they don't move forward. If I bump the cars with my car I can get them to move. Then they progress along their path as expected. It is almost like they are trying to start in second gear and are stalling. Any idea what might be going on here? It worked correctly in 0.2.

    EDIT: The UnityCar "Automatic" property appears to be cycling on and off very rapidly in the beginning. After I give the cars a push to get them moving, it stops cycling.

    2. You have some new parameters that are not defined (that I can tell):
    - Race Start > Grip, Deceleration, and Look Ahead. According to your post above:
    What parameters are they overriding? I don't see anything that correlates in the "Traits" section

    3. How would you recommend having the AI cars wait until the race starts to drive? The way I was doing it before seems convoluted, and no longer works with this new update.

    Thanks!
    Shawn
     
    Last edited by a moderator: May 17, 2012
  40. dgutierrezpalma

    dgutierrezpalma

    Joined:
    Dec 22, 2009
    Posts:
    404
    Hi Shawn,
    Thanks for your feedback, I will try to solve your problems as soon as possible...

    I have seen a similar behaviour only when you have 2 different controllers (UnityCar's AxisController and AI4UnityCar) trying to move the car at the same time, but as you say it worked before, I suppose that won't be the case. Could you try to disable different options (such as "Crash Recovery Maneuvers", "Track Borders Avoidance", etcetera)? Maybe we can find which subsystem is causing your problem...

    Sorry, it seems I made a mistake and used the name of the equivalent sector parameter instead of using the name of the driver's trait parameter. I will fix it in the next version, but In the meanwhile...
    • Grip -> Speed
    • Deceleration -> Aggressiveness
    • Look Ahead -> Anticipation
    Maybe I should also add the other parameters (steeringSensibility and pitchSensibility) to the RaceStartParameters...

    I have made some changes to the "target speed calculations" and I bet those changes are causing your problems. I'm working on a more reliable way to stop the vehicle (for pitstops and for the countdown at the start of the race) for the next version of my product. It shouldn't take too much, but I understand these problems may be a show-stopper for your project... do you have a backup prior to the update so you can continue working on your project while I continue working in the next release?

    Thanks,
    David Gutiérrez Palma
     
  41. trooper

    trooper

    Joined:
    Aug 21, 2009
    Posts:
    748

    Go for UnityCar, great support and it's raycast based
     
  42. dgutierrezpalma

    dgutierrezpalma

    Joined:
    Dec 22, 2009
    Posts:
    404
    Hey guys,

    I expected the current version to have more bugs than the previous one because I needed to make a lot of internal changes to implement certain new features, but it seems the current version is more unstable than expected because I have received several bug reports in the last few days. I'm working very hard to fix those bugs as soon as possible, so there will be a small change in the priorities:

    1. Fix all known bugs.
    2. Release a new version.
    3. Continue implementing new features.

    I want to ask for your collaboration: if you have found a bug in the lastest version of my product, please write a post in this thread or send me a private message detailing your problem. If possible, try to test a previous version of Pro Racing AI to see if it is an "old bug" or if it was introduced in the last release.


    Thanks for your collaboration,
    David Gutiérrez Palma
     
  43. barbara

    barbara

    Joined:
    Sep 8, 2011
    Posts:
    2
    Hi David,

    We have some questions about last update of ProRacingAI:

    We set scripts to models dynamically. In previous release ProRacingAI we changed script AI4UnityCar, and car with artificial intelligence started to move when the time has come (moment of time to start move defined by us). But now we have a problem, and we cant solve this problem. We set changed script AI4UnityCar to models and set track, but car not moving! We do everything like in last time, but car not moving and twitches and jumping sometimes! When scene open in Unity, car can start to move after some time. But car start to move only if we do some random actions with scene content. When we have dinamic run, without open Unity, the car keep stay in start point.


    We perform the following steps:
    1. We add script 'AI4UnityCar' to model.
    2. Wait some seconds.
    3. Run us method 'StartMoving' from class AI4UnityCar.
    4. We have failed
    Flag FinishBrake is false

    Question: Write please, how dynamically add script AI4UnityCar to model.

    We want to show you how we have changed the script.
    But we can not attach a file to post on the forum.
    And we will be happy if you give us your personal e-mail in which we can write and attach the files.

    Thanks!
     
  44. dgutierrezpalma

    dgutierrezpalma

    Joined:
    Dec 22, 2009
    Posts:
    404
    Hi Barbara, thanks for your feedback.

    I hope you will understand that (under normal circumstances) I can't offer support for custom changes made by all my customers. However, the fact that it was working in the previous version of my product and your changes stopped working in the current version make me think that it could be a bug introduced in the lastest version. I will try to replicate your problems in my local machine and find a solution for the next release.

    [PM Sent]
     
  45. S0ULART

    S0ULART

    Joined:
    Jun 14, 2011
    Posts:
    131
    Hello David, I've got two Questions:

    1. does the A.I and generating an optimal racing line provide also up/down movements for e.g flying cars and not only horizontal left/right movement?

    2. is it possible to define shortcuts that are sometimes open to use and sometimes closed? through use of triggers perhaps?
     
  46. dgutierrezpalma

    dgutierrezpalma

    Joined:
    Dec 22, 2009
    Posts:
    404
    1. In the current version, the optimal racing line is generated only in the "horizontal plane", but you can use the track banking prior the optimal racing line calculation for providing some kind of "up/down" movement. In future versions, I will explore how to include the "up/down" movement into the calculation of the optimal racing line for flying vehicles.

    2. You can assign several racing lines to the vehicle (one that uses the shortcut and another one that doesn't use it) and change the "current" racing line when the shortcut is open.
     
  47. Greg-Bassett

    Greg-Bassett

    Joined:
    Jul 28, 2009
    Posts:
    628
    Hi all,

    After some help!

    I have a copy of Pro Racing AI, and I am having some problems getting it to work?

    I have created a new project, and new scene, then imported my copy of Edy's Vehicle Physics pack, and then imported the Pro Racing AI Edy pack, however I get the following console error and cannot proceed any further.

    BCE0018: The name 'CarExternalInput' does not denote a valid type ('not found'). Did you mean 'UnityEngine.CharacterJoint'?


    Anyone know how to resolve?


    Also, is anyone able to post a quick step by step for setting up a flying vehicle, I just want to do a test with a cube gameobject.

    Many thanks in advance!
     
    Last edited: Jun 10, 2012
  48. dgutierrezpalma

    dgutierrezpalma

    Joined:
    Dec 22, 2009
    Posts:
    404
    Hi Greg,

    The CarExternalInput.js script should be in the Assets/EdyVehiclePhysics folder. If the script isn't there:

    1. Check if Edy's Vehicle Physics have been installed correctly.
    2. Try to find out which version of Edy's Vehicle Physics are you using.
    • If you are using a very old version, it's possible that Edy didn't implement the CarExternalInput class in the version you are using.
    • If you are using the lastest version and that class isn't available, maybe Edy has released a new version recently and I need to talk with him to make our products compatible again.
     
  49. Greg-Bassett

    Greg-Bassett

    Joined:
    Jul 28, 2009
    Posts:
    628
    I cannot find the CarExternalInput.js script in my project, and I have checked some older projects of mine which have earlier versions on Edy's Vehicle Physics in them, and I cannot find the CarExternalInput.js script in them either?

    Is there anyway I can test the Pro Racing AI pack without using Edy's pack, just setup a flying cube around a racing line etc?

    How can I do this?

    Also, reading your release notes you mention that Pro Racing AI is now compatible with my Vehicle Editor physics, but how do I use my vehicle physics with Pro Racing AI, all the other physics packs your product is compatible with have a modified script or scripts to install?

    Thanks in advance!
     
  50. gunga

    gunga

    Joined:
    Jan 2, 2012
    Posts:
    170
    Anyone else having loads of issues with this? I can't get the cars to drive anywhere near the quality needed. I'm growing tired of endlessly tweaking settings.
     
Thread Status:
Not open for further replies.