Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

AI Car Asset ?

Discussion in 'Assets and Asset Store' started by Life_Is_Good_, Jan 23, 2014.

  1. Life_Is_Good_

    Life_Is_Good_

    Joined:
    Mar 4, 2013
    Posts:
    39
    Hello

    I am currently working on an AI Car for city scenes, and I thought there are maybe some people who are interested in an AI Script Asset for Cars? So my question would be if it's so, and what "skills" should this AI have ?

    Sorry, if my english isn't as good as it should be :)

    // Edit
    Here's the newest Webplayer

    https://dl.dropboxusercontent.com/u/157743692/Update 2/AICarAsset.html
     
    Last edited: Jan 27, 2014
  2. gameseizer_00

    gameseizer_00

    Joined:
    Dec 20, 2013
    Posts:
    124
    simply put a waypoint, a decent AI script, in an empty game object in your scene.
     
  3. Life_Is_Good_

    Life_Is_Good_

    Joined:
    Mar 4, 2013
    Posts:
    39
    I am not sure if I get your answer, did you mean that it isn't needed because it's too simple, or did you mean there should only be a simple driving system ?
     
  4. gameseizer_00

    gameseizer_00

    Joined:
    Dec 20, 2013
    Posts:
    124
    no. what i mean, is that you only got to get the car model in scene and add the following necessary scripts and objects (i wont tell you the code though):
    empty game objects parented to the waypoint script and copy those gameobject throughout your city streets,
    add the waypoint script to the car, and voila! there's your first AI car. Skills, hmm. I think AI cars should behave like
    actual cars.
     
  5. gameseizer_00

    gameseizer_00

    Joined:
    Dec 20, 2013
    Posts:
    124
    and there's no need of a driving system. this AI car you mention were not controlled by the player are they?
     
  6. Life_Is_Good_

    Life_Is_Good_

    Joined:
    Mar 4, 2013
    Posts:
    39
    No, they will be controlled by the "Computer" so they're driving by themselve.

    That's nearly my idea, you would only have to place simple cubes or whatever along the street, put them in a parent object and it's finish.

    I meaned with skills something like Car features. In citys you want to have many cars I think, so should something like passing cars be included? You would have access to the acceleration, top speed etc. in the inspector so you could make some cars faster, some slower, and if a fast car is behind a slow car the fast car would try to pass the slow.
    That's only one idea I am trying currently(Waypoint System is already set up)
    Is that something you would mean with behave like real cars?
     
  7. Life_Is_Good_

    Life_Is_Good_

    Joined:
    Mar 4, 2013
    Posts:
    39
    Last edited: Jan 25, 2014
  8. gameseizer_00

    gameseizer_00

    Joined:
    Dec 20, 2013
    Posts:
    124
    yeah. simply like that. 'fast car is behind a slow car the fast car would try to pass the slow' thing. but you have to deal with many collider and waypoints to do this.
     
  9. Life_Is_Good_

    Life_Is_Good_

    Joined:
    Mar 4, 2013
    Posts:
    39
    yes, there will be raycasts which detect how fast the front car is, and if it's slow enough dynamic waypoints will be instantiated and the car behind will accelerate a bit, so it don't crash with the front car. I am already trying to translate it in code.
     
  10. gameseizer_00

    gameseizer_00

    Joined:
    Dec 20, 2013
    Posts:
    124
    yeah. that's what i am talking about. good ai. keep up!
     
  11. gameseizer_00

    gameseizer_00

    Joined:
    Dec 20, 2013
    Posts:
    124
    I remembered this old saying 'when there's an AI there's a large chunk of collider+scripts'
     
  12. Life_Is_Good_

    Life_Is_Good_

    Joined:
    Mar 4, 2013
    Posts:
    39
    thanks :)
    Ohh yes, there are many options which could let the AI crash if you don't check everything, and to check everything you need many colliders ;)
     
  13. gameseizer_00

    gameseizer_00

    Joined:
    Dec 20, 2013
    Posts:
    124
    yeah. you're welcome.
     
  14. fred_gds

    fred_gds

    Joined:
    Sep 20, 2012
    Posts:
    184
    That would be great. Well what I think would be needed is some kind of traffic light system, a system for different intersections (so that they kind of follow the traffic rules), a system to manage multiple lanes (for highways or so) and it would be great if the system could kind of just give out a value for steering (between -1 and 1 or something like that) and the same for the throttle/brake, so that you could use the system on your own car-system. Also an optimization for mobile would be great.

    The way you generate the passing script seems great ;)
     
  15. Life_Is_Good_

    Life_Is_Good_

    Joined:
    Mar 4, 2013
    Posts:
    39
    A traffic system is another idea, maybe controlled by triggers so you just need to set up a simple collider in front of your traffic light or something else and the AI will understand. That will also be included.
    Acceleration, top speed, braketorque, steering etc. will be changeable in the inspector.
    But I am not sure about mobil devices, I have to say, I haven't ever codet for mobil devices so that could be a problem, but I will try when the most things are completed.
     
  16. fred_gds

    fred_gds

    Joined:
    Sep 20, 2012
    Posts:
    184
    Well if you want I could share my experience with mobile devices with you. How long do you think it's going to take you to finish the package?
     
  17. Life_Is_Good_

    Life_Is_Good_

    Joined:
    Mar 4, 2013
    Posts:
    39
    Well, that sounds good.

    I am not sure, this is my first asset... I will have to set up the complete functional traffic system, passing cars, detect civilans, traffic lights...
    Maybe about a month, but I am really not sure, it will depend on the other things I have to do, if I can spend much time the next month it should be finished quickly, if not, it wont :D
     
  18. fred_gds

    fred_gds

    Joined:
    Sep 20, 2012
    Posts:
    184
    Sounds great. Do you already have an idea for a price tag and what language are you programming in?
    I would be pleased to become beta tester if you need :D
     
  19. Life_Is_Good_

    Life_Is_Good_

    Joined:
    Mar 4, 2013
    Posts:
    39
    I don't know yet, some time ago I've seen a asset which was kind like this, and the price was about 90$ !
    Way too much I think, I would choose something like 20 up to max. 40$.
    But First I will have to check if selling would be profitable... Unity gets 30% and I am in Germany too, so I would have to exchange the Dollars to Euros...

    I am Programming in C#, a few beta testers will be welcome, but there is still much work to do until I can choose some beta tester.
     
    Last edited: Jan 24, 2014
  20. fred_gds

    fred_gds

    Joined:
    Sep 20, 2012
    Posts:
    184
    You're german too?

    I can't tell you for the profit of assets, but I personally think that the price tag depends on the asset. So for a great asset a 90$ price tag might be reasonable.
     
  21. Life_Is_Good_

    Life_Is_Good_

    Joined:
    Mar 4, 2013
    Posts:
    39
    Yesss

    That's right but first I will have to see what the asset is like at the end...
    And of course what the customers want to pay for it
     
  22. gameseizer_00

    gameseizer_00

    Joined:
    Dec 20, 2013
    Posts:
    124
    any improvements, Godfather-Games?
     
  23. Life_Is_Good_

    Life_Is_Good_

    Joined:
    Mar 4, 2013
    Posts:
    39
    Yesterday in the evening I've started with the implementation of passing cars which are moving too, it works but I am not happy with it at the moment, There are still some conditions missing and I need to make the passing look more 'fluently'
     
    Last edited: Jan 25, 2014
  24. Life_Is_Good_

    Life_Is_Good_

    Joined:
    Mar 4, 2013
    Posts:
    39
    That's how it could look like :

    https://dl.dropboxusercontent.com/u/157743692/Update 1/AICarAsset.html

    The AI get the Speed of the Front Car, if it's speed is faster + 5 than the speed of the front Car, it will pass it. If not, it will just normaly drive behind the Front Car.

    But of course it's still work in progress, there's a small problem with the graphical wheels as you can see but I'm trying to fix it.
     
  25. Life_Is_Good_

    Life_Is_Good_

    Joined:
    Mar 4, 2013
    Posts:
    39
    Hello!

    I've set up a small Webplayer demo where you can play around with a few of the settings you'll be able to change directly in the inspector.

    https://dl.dropboxusercontent.com/u/157743692/Update 2/AICarAsset.html

    There are some more settings you can change but often you need to change them only at the very beginning because they change automatically by runtime. And some others aren't visible in the GameView, so I decided to show up only these settings in this Webplayer.

    I gave you the opportunity to make the Waypoints(the Sphere's) I've set visible, so you can see how easy it is to set up the path for the AI.

    There're still some bugs inside, and of course it's all work in progress.

    Have fun!
     
    Last edited: Jan 27, 2014
  26. fred_gds

    fred_gds

    Joined:
    Sep 20, 2012
    Posts:
    184
    That demo looks great.

    Are you planning to also setup a spawn system? If so please make it work with object pooling
     
    Last edited: Jan 28, 2014
  27. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    an ai driver would need waypoint following behaviour. you have reaction (timer to steer), but how drives through corners - slowing down, tempo.
    also like if the path to waypoint is direct (no raycast hit) and distance is big, could be hitting the pedal (race driver ai) or taking it casual (cruising ai)

    I was also planning a traffic system. based on waypoints, but waypoints that are chosen dynamically. also setting car ai starting time, stopping breaks and stuff.
     
  28. Life_Is_Good_

    Life_Is_Good_

    Joined:
    Mar 4, 2013
    Posts:
    39
    Fred's Iphone, thanks :)
    What do you mean exactly with spawn system? You mean spawning AI cars randomly in the city or something like that?

    dibdab, I think I don't understand you, the AI Driver is already following waypoints. And of course slowing down by steering will also come, but at the moment I was working on other things.

    The idea with the big distance sounds pretty good, haven't think about that, I think that will be included too :)

    There are kind of dynamic waypoints, but not for the complete path, I think there would be too much possibilitys where the waypoints could get spawned...
     
  29. fred_gds

    fred_gds

    Joined:
    Sep 20, 2012
    Posts:
    184
    yeah well spawning the car within a certain distance of the players position. I have tried to setup a system but it isn't really great.
     
  30. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    yeah, I looked into that. it seems like it has one target, and a waypoint path is managed by another script. and also looks like it has angle/slowdown (angle as 'change of direction').

    though I like keep things in one script and working on having the waypoints / obstacle avoidance / start-stop etc. managed by the main script.
     
  31. Life_Is_Good_

    Life_Is_Good_

    Joined:
    Mar 4, 2013
    Posts:
    39
    Fred, sounds interesting but I'm not sure what it would look like, maybe I could mix it with the traffic system, but of course I will try and see .

    At the moment there is only one script(about 900 lines) which manages everything of the AI.
    Pathfinding, steering, sound, start-stop, detection of other AIs/ block entitys etc.
     
    Last edited: Feb 1, 2014
  32. vitlabs

    vitlabs

    Joined:
    Nov 28, 2014
    Posts:
    46
    ISmart give you the power to create very easy SMART CAR!!

    With the top drop-down menu, providing options for create a vehicles with multiple axle types and behaviors like :Sport , Normal,Truck and custom.

    The project also includes a range of simple example vehicles form Vehicle Tools asset and new Smart Waypoint script and Traffic light script!

    https://www.assetstore.unity3d.com/en/#!/content/105065