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
    It's a quirk with the align-to-terrain code, it adjusts the rotation of the "Base" part of the car object based on the ground in front of it, so it's always a bit tilted.
     
    adrog6666 likes this.
  2. adrog6666

    adrog6666

    Joined:
    Aug 10, 2018
    Posts:
    39
    Thank you very much...
    sorry for the noob questions, hahah
    But do you have an email? I need to ask one more question, I need to show a pick of what im talking about.thanks
     
  3. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,443
    I just found this thread. This template looked pretty silly at first, but after seeing all the growth and extensions that the author was doing, it kept looking better and better. I liked how you modeled your own assets and AI features to put into the template.

    It's kinda sad how some people just assumed the template author would do all the work for them to turn it into a game they could shove on the market with no effort. Bug fixes and questions are awesome, but "please do it for me" just misses the point. Templates are a starting-point. The rest is up to you.
     
    DavidJares likes this.
  4. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Contact me through the mail on my store profile:
    https://assetstore.unity.com/publishers/4255
     
    adrog6666 likes this.
  5. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    I try to help when I see a feature that can benefit others and make the product a better one in the long run, though I do keep in mind the core limitations of each template. This one for example is not a car-physics based game so you won't get cars crashing and flying around.

    You're right, what's great about templates is that they cut-off that initial fumbling phase where you set up your base gameplay, and give you a way to build up on an existing "skeleton" to make your own game. I hope my templates can help people achieve that goal.
     
    siddharth3322 and adrog6666 like this.
  6. Liga97

    Liga97

    Joined:
    Dec 6, 2014
    Posts:
    4
    Hi,
    first of all let me say your template is amazing! I'm going to buy it during the next few days!

    I've some questions for you:

    1) is it possible to crash upside down?
    2) what's the current framerate on android and ios devices of your template?
    3) what happens if i put a ramp? Does the car jump "like" with a real physic system?

    Thanks in advance for your time.
    Liga
     
    puppeteer likes this.
  7. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    1) The "physics" in the game are fake, for example the drifting you see is a coded behavior based on your turning angle, and the movement along terrain is based on raycasts. The collisions between objects are based on triggers so they don't affect rigidbodies at all. When a car dies it flips over using a script rather than a physical reaction. So cars will not crash and flip over unless they die of the collision.

    2) Tested on a Samsung Galaxy S6 I got between 30-20fps, and closer to 30 fps without shadows:
    upload_2018-9-9_16-56-33.png

    3) The car "sticks" to the ground it moves along, so it would reach the ground nearly immediately after clearing off the platform. I had previously code in the player controls that would make the car slowly fall down if there is no terrain under it, making it behave as if it is falling with gravity, but I removed it to keep things simpler. If you want to try out the "fake gravity" code contact me and we'll try something together.
     

    Attached Files:

  8. novikov85

    novikov85

    Joined:
    Sep 11, 2018
    Posts:
    2
    Hello,
    I want to create a game based on your template Endless Car Chase. Сould you help me to change the game to my requirements? Thanks!
     
  9. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    What are you planning to make with your project?
     
  10. novikov85

    novikov85

    Joined:
    Sep 11, 2018
    Posts:
    2
    I'm reply on your email.
     
  11. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    adrog6666 likes this.
  12. adrog6666

    adrog6666

    Joined:
    Aug 10, 2018
    Posts:
    39
    Last edited: Sep 24, 2018
    puppeteer likes this.
  13. elqusiry

    elqusiry

    Joined:
    Nov 7, 2017
    Posts:
    2
    Hey, how to restore the default mobile controls after the latest update?

    The wheel is very hard to play with that i'm confident i'm using it wrong. I need the old control method back (tap left and right half of the screen).

    I'm sure it's quite easy but i just can't find it!
     
    mediavidea and puppeteer like this.
  14. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Just delete the mobile controls UI canvas, or remove its reference from the GameController in your scene.
     
  15. elqusiry

    elqusiry

    Joined:
    Nov 7, 2017
    Posts:
    2
    Thanks so much it works perfectly. If i may ask what's the purpose of the wheel to begin with ?

    Great asset BTW! I'll be reviewing it on the store very soon.
     
  16. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    It was a steering option requested by one of the users of the package. It's something they saw in other games and wanted to have a similar control scheme instead of the default left/right controls.
     
  17. anhtuan1911

    anhtuan1911

    Joined:
    Mar 4, 2016
    Posts:
    7
    Does this template use any kind of pooling system? Doesn't look like it
     
  18. cryptokayser

    cryptokayser

    Joined:
    Aug 31, 2018
    Posts:
    1
    Hello and thank you for this pack, I learn a lot with it.
    I'd like to use it to do some kind of multiplayer isometric mini games, in a small stage, with some fun ramps of stunt cars, earn points by jumping, and have a leaderboard in the end to win prizes.

    But before all this, first point I can not "jump" the car from the top of the springboard ...
    The car remains "hooked" on the ground.

    Do you have any idea how to do it? :p

    Thanks and bravo once again !
     
    puppeteer likes this.
  19. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    No, there's not built-in pooling, cars/effect/items/obstacles are instantiated and destroyed at runtime.
     
  20. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    The moving-along-surface feature that I added in an update basically gives the car a way to stick to a terrain using Raycast, so there is still no rigidbody physics involved.

    The problem with Rigibody physics in this package is that the code at its core uses the Transform and Raycast to control the car, with no use of the Rigidbody component at all. I had tried with another client before, but the result is less than optimal. So switching it to a physics based game you'll need to give up all the current behavior like the fake-drifting.
     
    siddharth3322 and cryptokayser like this.
  21. RicochetWitcher

    RicochetWitcher

    Joined:
    Nov 12, 2014
    Posts:
    5
    Hello! Wonderful asset, my congratulations!!
    I am trying to set up a car jump with obstacles, as your gif, but the car sticks to the ground instantly and vertically. How can this be regulated?
     
    puppeteer likes this.
  22. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    The code is built to make the car "stick" to the terrain it's moving on, but you can change it to make it check if we are moving up or down, and then make it drop gradually if moving down.

    Code (CSharp):
    1.             if ( thisTransform.position.y <= groundHitInfo.point.y + 0.1f )
    2.             {
    3.                 // Set the position of the car along the terrain
    4.                 thisTransform.position = new Vector3(thisTransform.position.x, groundHitInfo.point.y + 0.1f, thisTransform.position.z);
    5.             }
    6.             else
    7.             {
    8.                 thisTransform.position -= Vector3.up * Time.deltaTime * 10;
    9.             }
    10.  
    It should replace the regular moving along surface code in the car:

    upload_2018-11-14_12-37-20.png

    It's not a perfect solution, but it should work. Of course the car can rotate mid air, so you should have a boolean to check that and prevent it from rotating. The car also always looks at the terrain under it ( variable named forwardPoint ) so it might look weird at highder jumps.
     
    RicochetWitcher likes this.
  23. adrog6666

    adrog6666

    Joined:
    Aug 10, 2018
    Posts:
    39
    Stupid question?
    how do I add the skid effect to the car?
    I noticed the texture for it in there, but im unsure how to add it.
    Thanks for your time....
     
    puppeteer likes this.
  24. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    I wanted to add them at some point but then kept them out because they didn't look good, you can try to see how it would look like this: Drag one of the cars to the scene so you can edit it, and add a Trail Renderer with the Skid material like the GIF below.

    ECCSkid.gif
     
    siddharth3322 likes this.
  25. adrog6666

    adrog6666

    Joined:
    Aug 10, 2018
    Posts:
    39
    thanks buddy, ill see how it looks...
     
  26. hector_plou

    hector_plou

    Joined:
    Dec 7, 2017
    Posts:
    18
    Hello,

    First of all, great job.
    I've changed the ground objetc from Floor to terrain and I'm getting this error:

    MissingComponentException: There is no 'Renderer' attached to the "Terrain" game object, but a script is trying to access it.
    You probably need to add a Renderer to the game object "Terrain". Or your script needs to check if the component is attached before using it.
    UnityEngine.Renderer.get_material () (at C:/buildslave/unity/build/Runtime/Export/GraphicsRenderers.bindings.cs:128)
    EndlessCarChase.ECCGameController.LateUpdate () (at Assets/ECCAssets/Scripts/ECCGameController.cs:302)

    Should I change something more appart of set ground objetc to terrains?

    Best regards
     
  27. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    For terrain you don't need to assign a Ground Object, so keep it empty.

    upload_2018-12-2_21-50-35.png

    Just make sure that the terrain object has a "Ground" layer assigned on it.
     
  28. hector_plou

    hector_plou

    Joined:
    Dec 7, 2017
    Posts:
    18
    Thank you!!!

    One question more.
    Is there any way to bouncing with objects?
     
    puppeteer likes this.
  29. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    You mean crashing with physics into obstacles and bouncing back? No, unfortunately, the game is not physics based at all, drifting and handling is all code controlled, limited to 2D space or aligned to terrain.
     
  30. hector_plou

    hector_plou

    Joined:
    Dec 7, 2017
    Posts:
    18
    Thank you!! it is a very good template.

    I'm trying to scale the car during playing game by code, and it automatically goes back to the initial scale.
    Is there any way to keep it scaled?

    Thanks and best regards
     
    puppeteer likes this.
  31. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    That could be because of the Spawn animation that affects the scale of the object. Put one of the cars in the scene and open the Animation window to edit it, then choose the "Spawn" clip.

    upload_2018-12-5_1-16-59.png

    This is the animation clip that shows the car when it first appears in the scene or in the shop, and it basically changes the scale of the object.

    Clear the keyframes from this animation and try the game now, see if the scaling reset problem persists.
     
  32. gapet1949

    gapet1949

    Joined:
    Dec 10, 2018
    Posts:
    1
    Good evening.How can i change script to spawn objects on certain surface.Because i need to spawn objects on the road only
     
    puppeteer likes this.
  33. RicochetWitcher

    RicochetWitcher

    Joined:
    Nov 12, 2014
    Posts:
    5
    Hi! Is there any way to add a car with a trailer? Or something like a motorcycle, I mean something having two wheels?
     
    puppeteer likes this.
  34. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    That can be a bit tricky, as the spawning component basically spawns an object within a distance from another object ( the player for example is the center point ), so it spawns in a random circular way.

    What I can do is add another script that can spawn at a random point within a list of points that you can place manually on the floor ( so you place them on the streets at the points you want things to spawn ).

    What do you think about that?
     
    Alfaprok likes this.
  35. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Two objects attached to each other are not possible, but it is actually possible to have a motorcycle vehicle, just use two wheels instead of four, and make it lean in a negative value so it leans inwards as it turns.

    Try it out, and if you have any problems I can post a vid example.
     
    siddharth3322 likes this.
  36. roshan090

    roshan090

    Joined:
    Mar 20, 2018
    Posts:
    35
    i purchased your template. its very good and everything is organized can i have the demo with big obstacles like this video
    thanks
     
  37. Alfaprok

    Alfaprok

    Joined:
    Dec 14, 2018
    Posts:
    1
    Thanks!!that's good idea
     
  38. roshan090

    roshan090

    Joined:
    Mar 20, 2018
    Posts:
    35
    hi
    i am trying to add restart game button on game over screen but whenever it goes to game over screen
    you are destroying the player so player object becomes empty in game controller
    so i have to go back on the main screen to initialize it again
    and when ever games over the enemies sound are still playing on the background
    i stopped the enemy object spawner by changing time.TimeScale =0
    how i can destroy all enemies on game over and stop their music
    can you help me to fix it on game over screen ?

    thanks
     
  39. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    There is already a restart button in the gameover screen. It refers to the function Restart() in the GameController object in the scene, and it reloads the current scene. Is there another way you want to implement a gameover/restart? Can you post a screen of what you are trying to achieve?
     
  40. roshan090

    roshan090

    Joined:
    Mar 20, 2018
    Posts:
    35
    Actually i just wanted to add restart button on game-over screen so i can restart game on game-over screen instead of home.
    Thanks
     
    puppeteer likes this.
  41. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Check this screen:

    upload_2018-12-14_20-25-1.png

    This ButtonRestart, you can put it anywhere in UI canvas and it will restart your current scene. Try it out!
     
  42. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Working on a new update, will have a city demo scene with a camera chasing the player, and a whole lot of other stuff ( bike model example maybe??? :D ):

    ezgif.com-optimize(2).gif
     
  43. hector_plou

    hector_plou

    Joined:
    Dec 7, 2017
    Posts:
    18
    I like it very much!!!

    Didi you change the camerarotate function? the current one is a little dizy...
     
    Last edited: Dec 15, 2018
  44. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    It's the same one I had previously hidden, but I slowed the speed a bit I think, and I also change the view angle to be a little higher so you don't feel he spinning too much. Maybe with the streets and buildings as reference, it's easier on the eyes.
     
  45. adrog6666

    adrog6666

    Joined:
    Aug 10, 2018
    Posts:
    39
    whens this coming out? looks great!!!
     
    puppeteer likes this.
  46. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Thanks! I hope to submit it by the end of the month. Here's a vid showing the gameplay better:

     
    siddharth3322 and Virtuadreamer like this.
  47. roshan090

    roshan090

    Joined:
    Mar 20, 2018
    Posts:
    35
    waiting for your next update :)
     
    puppeteer likes this.
  48. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    I have one question, regarding car modeling, you have done in 3ds max.
    As per this video, You have designed a flat car but from 6:55 to 7:00 interval, you have given a car curvy look.
    that how you have achieved?
    I am learning 3d model designing using 3ds max software and I have seen your work and learning cars designing as like yours.
     
    puppeteer likes this.
  49. puppeteer

    puppeteer

    Joined:
    Sep 15, 2010
    Posts:
    1,282
    Here is a short video where I try to do the same thing again ( not exactly good, but it's the process )



    I focus on working with the vertices, first thing I use the scale tool ( in squish mode where X scales opposite Y ), and make the car look "fat". Then I move some of the vertices closer together and make the hood lift up a little. For the front I scale the "eyes" of the car to make them look bigger relative to the body, like in cartoons. And I make sure that the wheel holder area stays the same if I want to use the same wheels for this car too.
     
    siddharth3322 likes this.
  50. siddharth3322

    siddharth3322

    Joined:
    Nov 29, 2013
    Posts:
    1,049
    Really thanks for your help, I clearly get your point :)
    You are an awesome person and your services related to your product is too good.
     
    puppeteer likes this.