Endless Car Chase Game Template

GET IT ON THE UNITY ASSET STORE

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

2 Likes

Here’s a bit of the modeling session for the first car in the template:

1 Like

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.

3462525--274700--ECCAvoidRocks.gif

1 Like

Here’s another test with bigger obstacles.

3464081--274862--ECCAvoidingWalls.gif

3 Likes

There are several attributes you can set to control car behavior:

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.

2 Likes

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.

1 Like

Endless Car Chase is live on the store, check it out:

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.

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.

3476882--276374--ECC105update.gif

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.

1 Like
  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.

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.

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:


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.

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.

Hi, the car controller looks amazing! any plans to sell only this script?

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.

1 Like

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:

This is true for any unity project.

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

1 Like

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.

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!

1 Like

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.

https://www.youtube.com/watch?v=6-KQjQI2qcM

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