Search Unity

iRDS - Intelligent Race Driver System Available on Asset Store

Discussion in 'Assets and Asset Store' started by rhodnius, Mar 18, 2013.

?

What you prefer (features are, Transmission, differential and Engine as separate component)

Poll closed Nov 12, 2019.
  1. Release new physics at it's current state and do new stuff on next releases?

    0 vote(s)
    0.0%
  2. Wait for all the new stuff on physics to be implemented then do the release?

    100.0%
  1. Mojo-Game-Studio

    Mojo-Game-Studio

    Joined:
    Sep 18, 2015
    Posts:
    111
    Hiya,

    How difficult would it be to modify the cop behavior, to have them smash into each other instead of just AI and player cars?
     
  2. MK1_Dev

    MK1_Dev

    Joined:
    Sep 7, 2018
    Posts:
    104
    Hi. I have cars respawning in the same position of other cars, thereby creating an explosion effect. I notice this was addressed previously, however I see it practically every race. I am using version 3.2.6 DLL. Cheers.
     
  3. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,334
    Hmm, this sounds familiar, i think is already in there, would have to check it out and see if there is an option already in place (which i think it is)



    This could be maybe the cars are in different layers? or a tag not in place, let me check what the code does to know there is another car on the spawning position.

    Edit: Ok just checked it out, make sure the object that is the root of the cars has the Tag Player on them
     
    Mojo-Game-Studio likes this.
  4. MK1_Dev

    MK1_Dev

    Joined:
    Sep 7, 2018
    Posts:
    104
    Great thanks!
     
  5. Mojo-Game-Studio

    Mojo-Game-Studio

    Joined:
    Sep 18, 2015
    Posts:
    111
    Hiya, did you look at the cop behavior for me?
     
  6. Mojo-Game-Studio

    Mojo-Game-Studio

    Joined:
    Sep 18, 2015
    Posts:
    111
    ??
     
  7. Mojo-Game-Studio

    Mojo-Game-Studio

    Joined:
    Sep 18, 2015
    Posts:
    111
    I've setup my AI and obstacles as you suggested, but the moment I put an IRDSObstacle script on an object the AI can just drive through it.

    Here are the settings:
    upload_2019-7-17_9-9-15.png

    upload_2019-7-17_9-9-51.png

    upload_2019-7-17_9-10-13.png

    What I have noticed is that IRDSObstacle is deactivated for the cube at runtime:
    At runtime, and as you can see the car drives straight through the cube and IRDSObstacle is inactive. This happens regardless if I mark the object as static or not. upload_2019-7-17_9-9-15.png upload_2019-7-17_9-9-51.png upload_2019-7-17_9-10-13.png upload_2019-7-17_9-15-37.png
    upload_2019-7-17_9-15-37.png
     
  8. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,334
    Sorry for the late reply, I was busy the weekend and got Cold this days, I have looked at it and the Cop behavior currently does not have the option to make the ram each other, this shouldn't be hard to get working though, but needs code changes for sure.

    This gets deactivated for you as the Cube does not have a rigidbody, since it doesn't have a rigidbody it considers it as static and calculates its position just once and store it for the rest of the time the game is playing.

    The cars are not detecting the obstacle, did you tested this before as I see you reported it was working? did you changed the unity version?

    Edit: Also make sure the car that is instantiated does have the obstacle sensor on it, just in case

    Edit: Make sure the trigger for the obstacle sensor is very big and wide, at least 15 meters wide and about 100 large, this would make the cars detect it way before getting to it, and avoid them satisfactory, if the trigger is not big enough the obstacle gets out of the detection area easily.
     
    Last edited: Jul 17, 2019
  9. Mojo-Game-Studio

    Mojo-Game-Studio

    Joined:
    Sep 18, 2015
    Posts:
    111
    Added a ridgibody to the cube and made the other suggestions, but the cars still drive through the cube, also I can drive through the cube with the player car. And yes I did upgrade to Unity 2018.4
     
  10. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,334
    I understand, did it worked on previous Unity version? i would check it here too on 2018.3+ to see if this has to do with the Unity version.
     
  11. Mojo-Game-Studio

    Mojo-Game-Studio

    Joined:
    Sep 18, 2015
    Posts:
    111
    I'm not sure, as they were only road signs, pretty much placed off track, but it did seem to avoid them. I think the reason the cars can drive through the obstacles is because of the physics layer settings and only having obstaclesensor collide with obstaclesensor, I figure it should also collide with default to stop that otherwise the player car will always be able to drive through them, so maybe that's one problem solved, but the AI still seem to make no attempt to steer around any of the obstacles.

    I found a pretty simple workaround for making cars bash into each other like in a demo derby, which is instead of using cop mode, I just use normal AI cars, and set their next waypoint to whatever car is their current target - seems to work pretty well :) - They never finish a race, but that's ok as in the mode I need it for the winner is the one with the least amount of damage after a certain amount of time.
     
    rhodnius likes this.
  12. jbooker410

    jbooker410

    Joined:
    Mar 9, 2014
    Posts:
    41
    Hi. Awesome asset. The only thing is I bought this asset mainly because it stated that it supported Randomation Car Physics. When I unpack the other physics folder I get this error.
    Assets\iRDS\Other Physics AI\ExternalPhysicsScripts\Randomation 2\IRDSCarControllInputRandomation.cs(43,9): error CS1061: 'IRDSCarControllerAI' does not contain a definition for 'IRDSWheelsCenter' and no accessible extension method 'IRDSWheelsCenter' accepting a first argument of type 'IRDSCarControllerAI' could be found (are you missing a using directive or an assembly reference?)

    If you can help me fix this with a little info on how to set it up that would be awesome. Both IRDS and Randomation say you're importing a new project and it will override settings. Which do I import first? I know Randomation is no longer on the asset store but is available on GitHub as open source. I want to use it for its damage system and im kinda on a dead line. Thanks Much.
     
    Last edited: Jul 19, 2019
  13. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,334
    Ok i see, i would check this out then on Unity 2018.3+ to see if anything comes up for the obstacle avoidance, also if you want we could do a remote session, so i could see quickly on your setup what could be missing.


    Hi @jbooker410 Thanks for the kind words.

    What happens is that the script is outdated some how i forgot to update that one, instead of IRDSWheelsCenter it should be SetIRDSWheelsCenter, sorry for that. will update this.

    Let me know if you need something else

    Cheers!
     
  14. Mojo-Game-Studio

    Mojo-Game-Studio

    Joined:
    Sep 18, 2015
    Posts:
    111
    Seems to work if I set the rigidbody to isKinematic. At least I see the mauve/purple debug drawline

    Will update once I have it fully tested.
     
    Last edited: Jul 22, 2019
    rhodnius likes this.
  15. fredastaire

    fredastaire

    Joined:
    Sep 10, 2017
    Posts:
    90
    Is the asset compatible with HDRP ?
     
  16. jbooker410

    jbooker410

    Joined:
    Mar 9, 2014
    Posts:
    41
    Hey. The change in the script worked great for connecting the Randomation Physics But a new problem has started. When I set up the track and it brings up my cars in the editor everything runs fine. cars go like they should. when I do a pc build and start the game there is no GUI and all the cars do one big right turn Crash and vanish. Not sure what is happening to make it work fine in editor and not in game. Tried going back to 2017.4.30 to see if it was just some bug in 2018 but it gives me the following errors
    Assets/iRDS/Other Physics AI/ExternalPhysicsScripts/Randomation 2/Editor/IRDSRandomationMenu.cs(26,49): error CS0433: The imported type `VehicleParent' is defined multiple times

    Assets/iRDS/Other Physics AI/ExternalPhysicsScripts/Randomation 2/Editor/IRDSRandomationMenu.cs(26,19): error CS0584: Internal compiler error: The method or operation is not implemented.

    Assets/iRDS/Other Physics AI/ExternalPhysicsScripts/Randomation 2/Editor/IRDSRandomationMenu.cs(26,19): error CS0201: Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement

    Would like to try to keep it in 2018 since i am trying to make an oculus quest VR game.

    Also. Is there a way to access the Ai steering? I want to have the car when bumped at a certain speed turn left or right and crash. I can do this by multiplying the turning the AI is doing by a value but I need to know how to access the value it your script in case I need to use your car physics

    Thanks
     
    Last edited: Jul 21, 2019
  17. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,334
    High Definition Rendering Pipeline is about rendering, so I don't see any issues on using that type of rendering pipeline.

    Check which scenes are you including on the build, and not sure what you mean with no GUI, you mean the iRDS GUI for lap count, timer, etc?

    It seems you may have more than one script that implements the VehicleParent class, you should check where that is duplicated (seems to be something from Randomation?)

    For the AI steering, this is internally on the IRDSCarContrllerAI class, if you wan to affect the cars trajectory, you could use the ExternalSteerOffset property to make the car move on the direction you want, this is to make the actual point they are following to move in that distance on the local X axis of that point (the point keeps always a distance ahead of the car) so is not a direct steering value, but more like a distance to move the target point from the car, so if you set it to +5 the point would be moved to the left (looking the car from behind) and with negative values to the right.

    Let me know if this helps
     
  18. Mojo-Game-Studio

    Mojo-Game-Studio

    Joined:
    Sep 18, 2015
    Posts:
    111

    Hi Rhod,

    So I was playing with implementing a demo derby scenario by setting the AI's currentwaypoint to the car I want it to target, which works for the most part, I then came across, this post above, and tried it, but they don't seem to target the car once I assign it's IRDSCarControllerAI to copCurrentTarget.

    Have I read it right in that I should only have cop cars on the scene, or will this work for standard AI cars?

    1. Can you check this?
    2. To get a list of cars I was using IRDSStatistics.Instance.GetAllDrivers(), but now I have all the AI cars set as cops, this list only contains the player car, is there a way to get a list of IRDSCarControllerAI for the cop cars, instead of doing a GameObject.Find?
     
  19. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,334

    For question 2, you need to check the option of adding or not the cops to the driver's list, is on the Cop settings on the levelload.

    For question 1, the AI needs to be a cop for that to work, I have not tried it out, so i would check it out and see if that still works as stated on that post (i have not changed that behavior, so it should work).
     
  20. Mojo-Game-Studio

    Mojo-Game-Studio

    Joined:
    Sep 18, 2015
    Posts:
    111

    Sorry my fault, I had them on a track, for anyone else trying this, put the track outside of the area you want the demo derby and it works great :)


    So another question, if I want to remove a car from the 'race' when it's damage gets too much, what do I need to call after endrace? Basically I want to destroy the gameobject of the car after say 5 seconds of it being wrecked.

    At the moment I do this:
    car = transform.root.GetComponent<IRDSCarControllerAI>();
    carInput = car.GetCarInputs();
    car.SetEndRace(true);
    car.enabled = false;
    carInput.setThrottleInput(0);
    carInput.setBrakeInput(1); carInput.setHandBrakeInput(1);
    Destroy(transform.root.gameObject);

    But this leads to a massive slowdown in frame rate and a lot of info messages in the console 'Null center'
     
  21. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,334
    In this case i strongly suggest just disabling the car game object. :)
     
    Mojo-Game-Studio likes this.
  22. MK1_Dev

    MK1_Dev

    Joined:
    Sep 7, 2018
    Posts:
    104
    Hi! Would it be possible to add an option in IRDS Manager to hide Markers in Play mode? I think this would be a really useful feature especially during testing as I keep forgetting to hit Hide Markers before hitting Play. Cheers!
     
  23. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,334
    Yeah sounds like something useful.
     
  24. fredastaire

    fredastaire

    Joined:
    Sep 10, 2017
    Posts:
    90
    How would I through script access the load level settings for specific ai settings grid number position?
     
  25. Mojo-Game-Studio

    Mojo-Game-Studio

    Joined:
    Sep 18, 2015
    Posts:
    111
    I need to implement a node based pathfinding system for the ai to drive from point a to b, what I'm hoping to do is have the ai drive to a node on the path by setting their next waypoint to that node. How would I create waypoints on the fly?

    I'm guessing there isn't a method specifically for this, so I figure I'll have to do some kind of spoofing. The AI will be cops so was hoping to the use the copCurrentTarget method.
     
  26. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,334
    In this case you can access it using the singleton of that class, by simply typing LevelLoadVariables.Instance.carsDrivers (which is the list of specific drivers you have assigned previously on the inspector on the levelload object) and from there access the fields you want to change or update.


    Currently there is no path finding implemented into the system, as the system is meant to be used for racing games in a circuit or a sprint type of race (and other subtypes of race), you could how ever kind of hack into it, since each car has a list of transforms for them to access waypoints, but they also use some other information stored on the managers to know the max speed and some other info to handle different situations (the limits of the track, etc.).

    Another way could be to implement a really simple waypoint follower script to make that behavior and switch between the 2 when needed.
     
  27. jbooker410

    jbooker410

    Joined:
    Mar 9, 2014
    Posts:
    41
    Hey man. Is there a way to only register my player car to the standings and to end the race without messing with the rest of the AI control? For one I will eventually want to make this multiplayer but in trying to read up on the API nothing is making sense. I'm not new to coding but I'm not the best either and a lot of what I try to use comes up obsolete. What I am trying to do is when the car hits another car it goes off the road and wrecks. the camera view goes to the wrecking car. I need the car to go on autopilot while the car is off screen. I can do this by enabling and disabling AI input on my player car and everything is fine when I have the car placed in the scene and not spawned by your system. When I spawn with your system enabling and disabling the AI Input has no effect. And as far as the multiplayer thing goes I have tried to go through the API for addnewplayer but without It actually laid out with a code example I have not been able to figure out how to use it. Mainly problem with the second veriable.
    Thanks
     
    Last edited: Aug 3, 2019
  28. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,334
    Hi @jbooker410 ,

    If you want the player car to be controlled, just make the IRDSCarControllInput carPilot to false on the player instance, this would make the AI to take over the control.

    About the Networking, I would send you a few scripts that I have for using with Photon (PUN2) so you can see some example.
     
  29. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,334
    Seems that i can not send you direct messages from within this forum, pls contact me to send you what you are needing.
     
  30. jbooker410

    jbooker410

    Joined:
    Mar 9, 2014
    Posts:
    41
    Hey forgot to mention in the first post that I am using the RCC integration. I have tried everything I can think of to change the car to go to Auto Pilot in the RRC input controller script. Like I said before it works when the car is placed in the scene but not when spawned by the system. When a player is spawned by the system does it completely ignore the your RCC input controller? I have tried setting the RCC AI controller to true and that kills the controller input but cant get it to go into AI from the script. As far as the network file you can reach me at jasonbooker410@outlook.com.

    Thanks.
     
    Last edited: Aug 4, 2019
  31. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,334
    Ahh ok. But what i sent already it should just work fine, have you tried changing the value of carPilot?
     
  32. Mojo-Game-Studio

    Mojo-Game-Studio

    Joined:
    Sep 18, 2015
    Posts:
    111

    Please please please send them to me also, happens to be my next task :)

    BTW I solved the pathfinding by creating a dummy car at the next path node and setting the copcurrenttarget to it. works great.
     
  33. Mojo-Game-Studio

    Mojo-Game-Studio

    Joined:
    Sep 18, 2015
    Posts:
    111
    FYI, the rewired script needs the namespacing added, and there are a couple of errors line 254 carInputs.playerControls.enabled = false; is inaccessible due to protection level and line 326 if (carInputs.GetGoPits()) is depreciated

    fixed in the version attached
     

    Attached Files:

    Last edited: Aug 6, 2019
    rhodnius likes this.
  34. bretluke

    bretluke

    Joined:
    Mar 1, 2017
    Posts:
    4
    What would be the easiest way to respawn cars on certain conditions? I am trying to get my cars (AI and Player) to auto respawn when they inadvertently exit the race track. Thanks in advance!
     
  35. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,334
    Will do then, currently out of the country, would be back this weekend.

    Sure, there is an option for this already, go to the leve load object, then go to the Respawn / Instantiate settings and look for the Max out of limit distance and set there a value greater than 0 to activate the respawning if any car gets out of the track pass that distance.

    Cheers
     
    Mojo-Game-Studio likes this.
  36. Mojo-Game-Studio

    Mojo-Game-Studio

    Joined:
    Sep 18, 2015
    Posts:
    111
    Hi Jose,

    Seem to be having a problem with the rewired integration and specifically the setup with an xbox controller.

    If you define the Throttle and Brake to be the left and right trigger, when pressing either, the script IRDSPlayerControlsRewired gets values for both throttleInput and throttleInput1(Brake) meaning the car never moves, as both triggers are on the same axis.
     
  37. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    I did not see what platform you are building for so I am just guessing windows. Do you have Xinput enabled in Rewired?

    What version of Rewired are you using?

    https://guavaman.com/projects/rewired/docs/Troubleshooting.html#xbox360-triggers
     
    rhodnius likes this.
  38. Mojo-Game-Studio

    Mojo-Game-Studio

    Joined:
    Sep 18, 2015
    Posts:
    111
    Last edited: Aug 12, 2019
    rhodnius likes this.
  39. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,334
    Thanks for the help!

    Awesome you got it!
     
  40. fredastaire

    fredastaire

    Joined:
    Sep 10, 2017
    Posts:
    90
    Is there a way in the asset to have a caution period when a vehicle crashes or spins and have the cars regroup in line for a restart?
     
  41. Mojo-Game-Studio

    Mojo-Game-Studio

    Joined:
    Sep 18, 2015
    Posts:
    111
    Hiya Jose, any chance you can send me the multiplayer scripts
     
  42. Mojo-Game-Studio

    Mojo-Game-Studio

    Joined:
    Sep 18, 2015
    Posts:
    111
    You can set Yellow flag on each car, then set the max speed of the lead car slower to allow the other cars to catch up.
     
  43. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    Happy to help.
     
  44. bretluke

    bretluke

    Joined:
    Mar 1, 2017
    Posts:
    4
    I have played with this option, but I have not been happy with the results. I seem to be getting erratic respawns when it is enabled. Is there a particular method/function to call within one of the classes that I can use to manually respawn the cars?
     
  45. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,334
    yes, that would do it, thanks!

    Oh, forgot to send this out, email? if you want you can send the email in PM.

    Yes, you can call the respawn on each car independently, is on IRDSCarControllerAI class, using FlipCar method.
     
  46. bretluke

    bretluke

    Joined:
    Mar 1, 2017
    Posts:
    4
    Just an update - FlipCar() is working great! Thanks for the help!
     
    rhodnius likes this.
  47. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,334
    Awesome
     
  48. sim1138

    sim1138

    Joined:
    Feb 26, 2016
    Posts:
    2
    Has anyone ever had this issue? I can't get the cars to operate correctly to save my life. They jitter like crazy and won't seem to turn. (Video attached)

     
  49. rhodnius

    rhodnius

    Joined:
    Apr 11, 2012
    Posts:
    1,334
    Seems like could be your suspension settings. Btw, all of that would be not present on the new physics I'm working on, since it would be much simpler to compute and would be more accurate too.
     
    Slipangle likes this.
  50. fredastaire

    fredastaire

    Joined:
    Sep 10, 2017
    Posts:
    90