Search Unity

Endless Car Chase Game Template

Discussion in 'Assets and Asset Store' started by puppeteer, Apr 13, 2018.

  1. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282



    Hello,

    This will be the thread for Endless Car Chase, a complete project template. At first I wanted to create a simple car chase clone, but the potential here is much bigger in terms of what can be done with this template so I decided to take it a step further and work on smarter AI that tries to avoid obstacles while chasing the player, more camera options, map area wrap-around, and ground UV tiling for maps that keep rolling under the player ( no map edge ). Also thinking about adding more game mode like playing as the cop, or playing a capture the flag type of game.

    I'll be posting work-in-progress updates and support related questions here. If anyone has questions or suggestions I'd love to hear them. I want to make this asset useful and versatile.

    Link to store page
    https://assetstore.unity.com/packages/templates/packs/endless-car-chase-game-template-116027
     
    Last edited: May 23, 2021
    siddharth3322 and Gametyme like this.
  2. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Here's a bit of the modeling session for the first car in the template:

     
    siddharth3322 likes this.
  3. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Here's a bit of the AI code I'm working on to make cars avoid obstacles on the way in realtime. When they detect an obstacle they rotate either left or right based on the Raycast side, and then keep chasing the player.

    ECCAvoidRocks.gif
     
    siddharth3322 likes this.
  4. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Here's another test with bigger obstacles.

    ECCAvoidingWalls.gif
     
  5. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    There are several attributes you can set to control car behavior:

    ECCCarAttributes.png


    Health – The health of the player. If this reaches 0, the player dies.

    Hurt Delay – When the car gets hit and hurt, there is a delay during which it cannot be hit again.

    Speed – The speed of the player, how fast it moves player. The player moves forward constantly.

    Rotate Speed – How quickly the player car rotates, in both directions.

    Damage – The damage this car causes when hitting other cars. Damage is reduced from Health.

    Hit Effect – The effect that appears when this car is hit by another car or by an obstacle.

    Death Effect – The effect that appears when this car dies.

    Drift Angle – The slight extra rotation that happens to the car as it turns, giving a drifting effect.

    Lean Angle – The slight side tilt that happens to the car chassis as the car turns, making it lean inwards or outwards from the center of rotation.

    Chassis – The chassis object of the car which leans when the car rotates.

    Wheels – The wheels of the car which rotate based on the speed of the car. The front wheels also rotate in the direction the car is turning.

    Front Wheels – The front wheels of the car also rotate in the direction the car is turning.

    Chassis – The chassis object of the car which leans when the car rotates.

    The same car component is used for the player as well as the computer controlled cars. There are several AI attributes you can control for each car.


    There are also AI specific attributes you can set for cars that are no the player:

    Speed Variation – A random value that is added to the base speed of the AI car, to make their movements more varied.
    Chase Angle Range – A random value that is to the chase angle to make the AI cars more varied in how to chase the player.

    Avoid Obstacles – Make AI cars try to avoid obstacles. Obstacle are objects that have the ECCObstacle component attached to them.

    Detect Angle – The width of the obstacle detection area for this AI car.

    Detect Distance – The forward distance of the obstacle detection area for this AI car.
     
    siddharth3322 and Gametyme like this.
  6. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Made a few more tweaks while waiting for the review to go through, now cops will also try to avoid other cops, cars that get hit lose control before exploding, and rocks will instantly destroy cars.

     
    siddharth3322 likes this.
  7. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Endless Car Chase is live on the store, check it out:
    https://www.assetstore.unity3d.com/#!/content/116027?aid=1011lGiL

    And I'm already preparing the next update which should be accepted within a few days.

    1.05 (25.04.2018
    )
    - Cop cars now try to avoid other cop cars too, while chasing the player.
    - Made rock obstacles deadly and kill instantly.
    - Tweaked some attributes of spawn rate, car speeds, etc.
    - Added hurt flashing effect when cars are hit, and losing control before exploding.
    - Added police pickup truck.
    - Added slowmotion effect when dying.
     
    Last edited: Apr 27, 2018
  8. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Update 1.05 is live on the store, try it out.

    1.05 (25.04.2018
    )
    - Cop cars now try to avoid other cop cars too, while chasing the player.
    - Made rock obstacles deadly and kill instantly.
    - Tweaked some attributes of spawn rate, car speeds, etc.
    - Added hurt flashing effect when cars are hit, and losing control before exploding.
    - Added police pickup truck.
    - Added slowmotion effect when dying.

    ECC105update.gif
     
  9. dev_2051

    dev_2051

    Joined:
    Jul 25, 2013
    Posts:
    92
    Wow, this template is getting really good.

    Before buying i would like to ask,
    1.Can this template handle city generation(roads/buildings etc)?
    2.How this endless template handle floating point error, as driving car around endlessly on plane can cause such error.
     
    puppeteer likes this.
  10. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    1. You can basically create a city scene, and unassign the endless floor from the gamecontroller. This will make the car simply move within the city area. You can also place cop cars around the map area and they will chase the player car. But as this is basically "Car vs Cops" behavior template, the logic is based on a flat ground. I'm testing options for an update that allows the car to move over varying terrain heights.

    2. I'm not sure about this one, can you show me an example of such a case? The "endless" aspect of the game is simple fakery using a ground object that follows the player while its texture UVW moves against the motion direction to give a feeling of actully never ending ground.
     
  11. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Here's a short video showing the process of creating a new car from a duplicate of an existing car, using a new car model from the Simple Racer package by Synty Studios.

     
  12. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    I got a bug report from one of the users. I'm submitting a hotfix which should take a couple of days to pass review, but in the meantime you can fix it by moving this line of code like the screenshot below:

    ECCShopHotfix.png
    The bug itself is that when you choose a car you can't afford, then go back to the game and restart it, then start immediately without entering the shop, you'll get to play that locked car. This fix ensures we can only play cars that we have unlocked in any case.
     
  13. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Update 1.06 is live on the store.

    1.06 (02.05.2018)
    - Fix: When selecting a locked car and restarting the game you can play the locked car.
    - Added return button in the shop which can be triggered by gamepad/keyboard too.
    - Changed "chasis" to "Chassis" in all cars and code. Old code still works for now, but I'll remove it in future updates.
     
  14. luisjuniorj

    luisjuniorj

    Joined:
    Jan 2, 2018
    Posts:
    1
    Hi, the car controller looks amazing! any plans to sell only this script?
     
  15. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Hi, thanks. I've only ever made assets for the Complete Projects category, so it's always a mix of scripts and graphics. But I'm thinking of maybe selling the car selector or the car controls separately. I'll see about it.
     
    luisjuniorj likes this.
  16. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Got a question from a buyer about screen orientation on mobile devices. Here's how you can set the orientation type/s you want to use for your mobile game:

    ECCOrientation.png

    This is true for any unity project.
     
  17. Sidhanth783

    Sidhanth783

    Joined:
    May 24, 2017
    Posts:
    19
    there is a serious bug in this. when we left the car untouched when we start, its very easy to play, no police car can chase u, i made a score of 500 without touching the controls, it goes straight and noo police will come to chase , i have tested this around 7 times and each time i get a score unlimited, soo plz fix this
     
    puppeteer likes this.
  18. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    I made the demo scene very very easy so that people can try it, meaning that mostly all cop cars will be slower than your first player car, the orange coupe. Of course this can be modified for your own game so that your first car is slower than the enemies and you gradually get better and better cars.

    Try to play with the second sedan car, see if the cops can get you or not.
     
  19. Ankanetwork

    Ankanetwork

    Joined:
    May 9, 2018
    Posts:
    1
    Hi, there.
    I have a question. If I buy the game, it says it's ready for publication. My question is, are the car models already included? or do we have to create them?

    Can you easily change the background of the game screen? Is it documented?
    Thank you!
     
    puppeteer likes this.
  20. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Hi, everything you see in the demo and video is in the package, that includes code/art/sound. It's how all my game templates are.

    There is documentation showing the components of the game and what you can customize in them, and I recently made a video showing how I created a new car model from an existing one.



    If you're familiar with the Unity editor you'll be able to easily reskin the game and modify it for your project.
     
  21. lystudio

    lystudio

    Joined:
    May 9, 2017
    Posts:
    2
    Hi,

    Great asset! I wanna know:
    1. Could you provide mobile apk since I am using mac.
    2. Is there any monetization method like admob or IAP already integrated?

    br,
    L.
     
  22. Sidhanth783

    Sidhanth783

    Joined:
    May 24, 2017
    Posts:
    19
    How do i set a payment ( real money, not ingame cash) for cars, hw to achive this, plz help this
    i need to set a payment button for some special cars in the store
     
    Last edited: May 24, 2018
  23. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
  24. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Do you mean payment with the in-game cash or payment with actual money (IAP)?
     
  25. lystudio

    lystudio

    Joined:
    May 9, 2017
    Posts:
    2
    puppeteer likes this.
  26. Sidhanth783

    Sidhanth783

    Joined:
    May 24, 2017
    Posts:
    19
    payment with actual money (IAP)\
    my email :- saisidhanth5@gmail.com
     
    Last edited: May 24, 2018
  27. Sidhanth783

    Sidhanth783

    Joined:
    May 24, 2017
    Posts:
    19
    hello
    can you do a tutorial on hw to impliment IAP
     
  28. Sidhanth783

    Sidhanth783

    Joined:
    May 24, 2017
    Posts:
    19
    how to add multiple scenes, in the main menu can i set different scenes to select. Basically i want to create game modes
     
    puppeteer likes this.
  29. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Unfortunately AdMob is something I don't work with. I saw some of my buyers have implemented AdMob using plugins from the store, but I haven't done it myself.

    I'll take a look at options to make a tutorial for UnityIAP similar to how I made the UnityAds tutorial.
     
  30. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    You can duplicate an existing scene and modify it to make the attributes different. Then you can use the ECCLoadLevel component to load the new scene from a top menu for example.

    I have similar things done in my other templates, but I can also make a video tutorial showing how that would be in Endless Car Chase.
     
  31. Sidhanth783

    Sidhanth783

    Joined:
    May 24, 2017
    Posts:
    19
    how did u achive this, i tried this one but did nt get
    i have made a simple fbx file of plane and imported adn added as prefab, but nt getting the result as u got
     
    puppeteer likes this.
  32. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    You can make an obstacle from any objects of any size, just make sure you have an ECCObstacle component attached to it, and a collider with the size of the obstacle like the screenshot below.

    ECCObstacle.png
     
  33. Sidhanth783

    Sidhanth783

    Joined:
    May 24, 2017
    Posts:
    19

    thanq very much fr support

    nice kit :D
     
  34. Sidhanth783

    Sidhanth783

    Joined:
    May 24, 2017
    Posts:
    19
    how to add leader board in the game, i already have google console account, adn every thing set up, just tryinh hw should i add leaderboard to the game

    can u please help me with this
     
  35. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
  36. Sidhanth783

    Sidhanth783

    Joined:
    May 24, 2017
    Posts:
    19
  37. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    When I learn how to make IAP. I never did it before, I hope to be able to do an example video by the end of June.
     
  38. pasta5841

    pasta5841

    Joined:
    Apr 27, 2018
    Posts:
    6
    * options for an update that allows the car to move over varying terrain heights.

    Is this feature being tested?
    When will it be done?
     
    siddharth3322 and puppeteer like this.
  39. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Yes, I hope to finish update 1.1 this week, which should have the car moving along a terrain ( not physics-based, just moving along terrain ). I didn't want to post an undercooked progress GIF, but here is what I have so far:

    ECCMoveAlongSurface.gif
     
    siddharth3322 likes this.
  40. Sidhanth783

    Sidhanth783

    Joined:
    May 24, 2017
    Posts:
    19
    Its going awsome, can u please work on IAP system too
     
    puppeteer likes this.
  41. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Here's a video showing how you can put dust particle effects on your car:

     
  42. sales_unity764

    sales_unity764

    Joined:
    Mar 9, 2018
    Posts:
    8
    First off amazing template I have one question i have made a city and have a countryside and all. Problem I am having that police cars placed around city all automatically take off on start and head towards player. I know i read something about this somewhere but i cant seem to find it again.
     
    puppeteer likes this.
  43. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Ah, I see. The cops want to chase you, so they start chasing you the moment they exist in the scene.

    From a design point of view you want to keep them "idling" or even disabled until the player gets within chase distance.

    One way to do this is a script attached to the cop car that disables it at the start of the game, and only enables the car component when the player gets close enough ( maybe using a Distance check or a trigger check ).
     
    siddharth3322 likes this.
  44. sales_unity764

    sales_unity764

    Joined:
    Mar 9, 2018
    Posts:
    8
    Thanks I just didnt know if there was a setting I was missing to keep them from driving all the way across map. I will try and script something.
     
    AleksandrLukanin and puppeteer like this.
  45. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    I made a generic script that trigger when a tagged object hits it, and runs a list of functions in the scene. I used this to turn the car cop on when the player gets near. Here's how it works:



    The script is attached, look at the video to see the setup. You need to have a trigger and a kinematic rigidbody so you can detect objects.
     

    Attached Files:

    siddharth3322 and adrog6666 like this.
  46. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Here's a glimpse of the next update for Endless Car Chase, which should give players a way to make cars move along surfaces.



    It's not a perfect physical solution but it allows cars to move up and down hills, and the obstacles and items will spawn along that terrain. You can set in the gamecontroller whether the cars move on terrain or ignore it.
     
    siddharth3322 likes this.
  47. pasta5841

    pasta5841

    Joined:
    Apr 27, 2018
    Posts:
    6
    When will this update be available?
     
    puppeteer likes this.
  48. nikitinminsk

    nikitinminsk

    Joined:
    May 22, 2018
    Posts:
    2
    Nice template! Update soon? Drop some questions to email!
     
    puppeteer likes this.
  49. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Next update is live on the store, you can get it here:
    https://www.assetstore.unity3d.com/#!/content/116027?aid=1011lGiL

    Update 1.1:
    - You can make the cars move along uneven terrain, limited to up/down rotation.
    - You can show a health bar for each car, including enemies.
    - Obstacles and items are created along the surface.
     
  50. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Copy your entire project folder and make a backup before trying the update, then import the ECCGameController and ECCCar to see the changes.

    If it's possible to try a full update that would be great, as I have added some prefabs in the demo scene for a terrain you can try out. If you can't just do the two scripts update and tell me how it goes. You can turn on/off the moving-along-terrain feature in the gamecontroller so you might need to toggle it there.