Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

First game - Reckless Driver: Urban

Discussion in 'Made With Unity' started by carking1996, Mar 8, 2011.

  1. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608
    Hello, I started my first game about 4 weeks ago. It is a racing game, still in alpha stages. So, a lot things aren't done yet. :p This is my first time with a webplayer, so, tell me what you think. Controls are arrow keys, and 1 + 2 for cameras. I know the speedo is off, but, how can I fix that? I don't know how. I didn't make the car script, that was from a tutorial, but I edited it some. I made everything else. What do you guys think?

    Updated WebPlayer link:
    http://dl.dropbox.com/u/30521755/webplayer5/WebPlayer.html

    Have fun!
     
    Last edited: Nov 17, 2011
  2. RAWTalent

    RAWTalent

    Joined:
    Oct 27, 2010
    Posts:
    32
    Couple of problems, the GUI doesn't fit in the web player, and if you fall of the road you can't get back on due to it floating a few inches off the grass. Having said that it's a good start :)
     
  3. bahamapascal

    bahamapascal

    Joined:
    Feb 16, 2011
    Posts:
    23
    Hi nice game(still needs a little polishing;) ).
    It would be an big improvement if the player could press Esc to Quit to the main menu^^.
    And you can probably change the speed by going in to the script,than there should be something like currentSpeed(or similar).
    here an example how it could look:
    Just divide or multiply it till you got your desired speed^^
     
  4. 2dfxman1

    2dfxman1

    Joined:
    Oct 6, 2010
    Posts:
    1,065
    Why does it say I'm driving at 0.1mph even if I'm standing still?
     
  5. RichBosworth

    RichBosworth

    Joined:
    May 26, 2009
    Posts:
    325
    I like it... the control on the car suits the title! There were some issues with seeing through the green car though, which was a little bit distracting at times, but in general I forgot it when I started driving like a mad-man.

    You might want to round the speedometer to integer values, because I don't really care about 0.000001 of an MPH, unlike some of the speed cameras where I live (apparently).
     
  6. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608
    Thanks guys. Bahamapascal, there is nothing like that in my car script. The MPH gauge works like this:

    Code (csharp):
    1. var mph = rigidbody.velocity.magnitude * 2.237;
    2.     mphDisplay.text = mph + " MPH" ;
    RockyBozzy, the green car isn't finished yet. ^^
     
  7. bahamapascal

    bahamapascal

    Joined:
    Feb 16, 2011
    Posts:
    23
    Hey here is the Script for the car game (or test,because I am not planing on making a race game) that I am working on:

    First of all,this is not realy my work.I got it from a Tutorial,but changed it a bit for better performence^^.
    It is wary importent that you make the wheel collider exactly opothit from each other( something like flWheelCollider= -1,0.5,3 and frWheelCollider= 1,0.5,3)
    Also this is a Work in progress Script,so there might be stuff in there which is not jet completed.
    hope you can use this^^
    please let me know
     
  8. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608
    Here is the one I'm using.
    Code (csharp):
    1. var mphDisplay : GUIText;
    2.  
    3. var resetTime : float = 5.0;
    4. private var resetTimer : float = 0.0;
    5.  
    6. // These variables allow the script to power the wheels of the car.
    7. var FrontLeftWheel : WheelCollider;
    8. var FrontRightWheel : WheelCollider;
    9.  
    10. // These variables are for the gears, the array is the list of ratios. The script
    11. // uses the defined gear ratios to determine how much torque to apply to the wheels.
    12. var GearRatio : float[];
    13. var CurrentGear : int = 0;
    14.  
    15. // These variables are just for applying torque to the wheels and shifting gears.
    16. // using the defined Max and Min Engine RPM, the script can determine what gear the
    17. // car needs to be in.
    18. var EngineTorque : float = 600.0;
    19. var MaxEngineRPM : float = 3000.0;
    20. var MinEngineRPM : float = 1000.0;
    21. private var EngineRPM : float = 0.0;
    22.  
    23.  
    24.  
    25. function Start () {
    26.     // I usually alter the center of mass to make the car more stable. I'ts less likely to flip this way.
    27.     rigidbody.centerOfMass.y = -1.5;
    28. }
    29.  
    30. function Update () {
    31.  
    32.     var mph = rigidbody.velocity.magnitude * 2;
    33.     mphDisplay.text = mph + " MPH" ;
    34.    
    35.     // This is to limith the maximum speed of the car, adjusting the drag probably isn't the best way of doing it,
    36.     // but it's easy, and it doesn't interfere with the physics processing.
    37.     rigidbody.drag = rigidbody.velocity.magnitude / 220;
    38.    
    39.     // Compute the engine RPM based on the average RPM of the two wheels, then call the shift gear function
    40.     EngineRPM = (FrontLeftWheel.rpm + FrontRightWheel.rpm)/2 * GearRatio[CurrentGear];
    41.     ShiftGears();
    42.  
    43.     // set the audio pitch to the percentage of RPM to the maximum RPM plus one, this makes the sound play
    44.     // up to twice it's pitch, where it will suddenly drop when it switches gears.
    45.     audio.pitch = Mathf.Abs(EngineRPM / MaxEngineRPM) + 1.0 ;
    46.     // this line is just to ensure that the pitch does not reach a value higher than is desired.
    47.     if ( audio.pitch > 2.0 ) {
    48.         audio.pitch = 2.0;
    49.     }
    50.  
    51.     // finally, apply the values to the wheels. The torque applied is divided by the current gear, and
    52.     // multiplied by the user input variable.
    53.     FrontLeftWheel.motorTorque = EngineTorque / GearRatio[CurrentGear] * Input.GetAxis("Vertical");
    54.     FrontRightWheel.motorTorque = EngineTorque / GearRatio[CurrentGear] * Input.GetAxis("Vertical");
    55.        
    56.     // the steer angle is an arbitrary value multiplied by the user input.
    57.     FrontLeftWheel.steerAngle = 20 * Input.GetAxis("Horizontal");
    58.     FrontRightWheel.steerAngle = 20 * Input.GetAxis("Horizontal");
    59. }
    60.  
    61. function ShiftGears() {
    62.     // this funciton shifts the gears of the vehcile, it loops through all the gears, checking which will make
    63.     // the engine RPM fall within the desired range. The gear is then set to this "appropriate" value.
    64.     if ( EngineRPM >= MaxEngineRPM ) {
    65.         var AppropriateGear : int = CurrentGear;
    66.        
    67.         for ( var i = 0; i < GearRatio.length; i ++ ) {
    68.             if ( FrontLeftWheel.rpm * GearRatio[i] < MaxEngineRPM ) {
    69.                 AppropriateGear = i;
    70.                 break;
    71.             }
    72.         }
    73.        
    74.         CurrentGear = AppropriateGear;
    75.     }
    76.    
    77.     if ( EngineRPM <= MinEngineRPM ) {
    78.         AppropriateGear = CurrentGear;
    79.        
    80.         for ( var j = GearRatio.length-1; j >= 0; j -- ) {
    81.             if ( FrontLeftWheel.rpm * GearRatio[j] > MinEngineRPM ) {
    82.                 AppropriateGear = j;
    83.                 break;
    84.             }
    85.         }
    86.        
    87.         CurrentGear = AppropriateGear;
    88.     }
    89. }
    90.  
    91. function Check_If_Car_Is_Flipped()
    92. {
    93.     if(transform.localEulerAngles.z > 80  transform.localEulerAngles.z < 280)
    94.         resetTimer += Time.deltaTime;
    95.     else
    96.         resetTimer = 0;
    97.    
    98.     if(resetTimer > resetTime)
    99.         FlipCar();
    100.         }
    101.        
    102.         function FlipCar()
    103. {
    104.     transform.rotation = Quaternion.LookRotation(transform.forward);
    105.     transform.position += Vector3.up * 0.5;
    106.     rigidbody.velocity = Vector3.zero;
    107.     rigidbody.angularVelocity = Vector3.zero;
    108.     resetTimer = 0;
    109.     currentEnginePower = 0;
    110.     }
    111.        
    112.        
    What tutorial is that from?
     
  9. gamenut30111

    gamenut30111

    Joined:
    Nov 7, 2009
    Posts:
    399
    Wow, my car just drove over water, I enjoyed that. I would have to say that you need to fix the gui and the colliders on the map.
     
  10. bahamapascal

    bahamapascal

    Joined:
    Feb 16, 2011
    Posts:
    23
  11. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608
    Cool. I am also somewhat new, but I know the basics. :)
     
  12. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608
    double post... I fixed the speedo. :)
    Code (csharp):
    1. var mph = Mathf.Round (rigidbody.velocity.magnitude * 2);
     
  13. HolBol

    HolBol

    Joined:
    Feb 9, 2010
    Posts:
    2,887
    Dude, it was cool till i came off the tracks, but nice going!
    Also, you can't use images in your signature :p.
     
  14. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608
    I see that. Why not? xD I have a new menu designer, so, he's going to do the site and menus! :D Updates soon! :)
     
  15. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608
    Double post... Some updates.

    - Speedometer is fixed.
    - Cameras better optimized.
    - new grass
    - More roads with more higher poly hills.

    Controls:

    - Arrow keys to drive.
    - 1 + 2 for cameras.

    Webplayer: http://www.pasteunity.com/WebPlayer.aspx?GameID=19

    Enjoy. Please tell me what could be better. :)
     
  16. bahamapascal

    bahamapascal

    Joined:
    Feb 16, 2011
    Posts:
    23
  17. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608
    Thanks. But, I'll be making my own cars. ^^ Anyone else have crits?
     
  18. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608
    Double post. Updates! :) Some new things. Totally new car physics. :) What would be the best way to implement a minimap?

    http://www.pasteunity.com/WebPlayer.aspx?GameID=19

    - 100% new car physics
    - Handbrake ('spacebar')
    - Skid sounds with handbrake.
    - 'Gearing Games' image automatically loads the main menu after 5 seconds.
    - Fixed Speedo, with new font and color.

    Please let me know your crits! :D If you don't like the new physics, please tell me how to improve them. :)

    EDIT: Updated car physics. Lemme know your crits! :D
     
    Last edited: Mar 12, 2011
  19. NemorisGames

    NemorisGames

    Joined:
    Mar 20, 2010
    Posts:
    52
    In my opinion, the driving feels pretty good, i missed some indicators and an inside view. the art will be the biggest issue very soon, i specially don't like the square ramps, but with smooth ramps and a nice landscaping your game has a great potencial. Keep it on!
     
  20. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608
    lol

    Updates. New menu, car close to completion, ingame pause with ESC, better car tail lights, realtime shadows, better car speedometer, new road textures, background music, more city, another bridge, improved car physics, and more! :) Tell me what you guys think!



    Webplayer: Click for WebPlayer.

    Have fun! :D
     
  21. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608
    Whoever said this game is dead? :p But, no replies? :(

    UPDATES:

    - Beta Menus(Still WiP by Az)
    - Has working multiple cars' selection(thanks to DMan and Jesse Anders! Thanks!! :D)
    - Rear view mirror
    - Mini-Map
    - Bigger city
    - Nice 'blob' shadow
    - Ai traffic has started WiP
    - Can change resolutions in Options menu
    - fixed menus position on screen(tex will be fixed on ingame ones)
    - Many other various changes/edits/improvements that there are too many to type here. :)

    Play the webplayer here!! :D
     
  22. HolBol

    HolBol

    Joined:
    Feb 9, 2010
    Posts:
    2,887
    Hi, shapin up! Can I sujjest you use the smoothfollow camera instead of making it a child of the camera? The end result is alot nicer.
     
  23. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608
    I tried making it find the game object of body, but it doesnt work. :(
     
  24. HolBol

    HolBol

    Joined:
    Feb 9, 2010
    Posts:
    2,887
    just drag and drop the whole car object onto the script? then unparent the camera from the car if you haven't already.
     
  25. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608
    Major updates.

    * Improved car selection screen.
    * Two new cars.
    * Highly improved car shaders.
    * 2 tunnels.
    * Expanded city.
    * Speedometer works now.
    * Car physics completely changed for a third time. Car doesn't flip until over 80 MPH now. That's what would happen in real life without stabilizer bars. ;)
    * Press F4 to restart level.
    * Improved cameras.

    Some pics. :)









     
  26. Adrenaline-Crew

    Adrenaline-Crew

    Joined:
    Dec 14, 2010
    Posts:
    400
    What program did you make roads in?
     
  27. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608
    I used. Zmodeler. Each road is it's own object. Like a puzzle. :)
     
  28. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608


    An awesome test of a draw bridge animation. Crits welcome.
     
  29. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608
    update. Now with animated gates. And 2 bridges! :D

     
  30. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608
    How is my animation? It's my first. :)
     
  31. Taigo

    Taigo

    Joined:
    Feb 18, 2010
    Posts:
    128
    Very cool, you could have a boat running on waypoints around the river and place a trigger on it´s way to lift the bridge :)
     
  32. vreference

    vreference

    Joined:
    Mar 22, 2011
    Posts:
    154
    The gates would look better if they bounced a bit when they reached the top, those mechanisms always have quite a bit of lash when they are fully raised. Also your car sounds like it's idling at 6000RPM LOL.
     
  33. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608
    lol. They do that a bit. Just not when they are going up. I'll add that. :) I know, the car sounds louder in Fraps. LOL. I'll see if I can add a boat that runs through the river. First, to model it. :D I'm also going to add sounds (like bells for the warning of the bridge going up, and the sounds the bridge should make when going up). Any reccomendations of bell sounds?
     
  34. vreference

    vreference

    Joined:
    Mar 22, 2011
    Posts:
    154
    Keep in mind that volume (loudness) and frequency are different. Also worth mentioning that I saw you posted some code somewhere that seemed to indicate you were calculating engine RPM between 1000 and 3000 RPM, if you are using those numbers to change your engine sound you might have a hard time. 500-5500 (large v8) or 800-7000 (more modern high performance engine) would be more realistic generic ranges for an automotive gasoline engine. Many games use a separate actual recording of an engine idling for idle and fade into the higher RPM frequency altered sound.

    As for bells? I would probably just go out to a deserted railroad crossing and wait =) ...but I'm sure there are plenty of examples on youtube.
     
  35. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608
    Great! I already found bell sounds from railroad crossings. :) I'll try to make my RPM ranges better later on. I also added some cool stairs, I'll show a pic later. Thanks for this advice! :D
     
  36. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608
    Big updates. I made 2 new menus. Car selection screen and the Options, both are almost done. Just need some buttons to do. Cars are a lot more stable, new shader(cubemap), made by me, Stairs, signs, traffic lights that work correctly, new water, car suspensions, and a gear indicator! :D Also, the car selection screen shows the cars' stats. :) Oh, and the city's name is going to be Seaview City. :)





     
  37. HolBol

    HolBol

    Joined:
    Feb 9, 2010
    Posts:
    2,887
    Loooking really good now. I can haz webplaya?
     
  38. herpderpy

    herpderpy

    Joined:
    Mar 9, 2010
    Posts:
    477
    Amazing Carking - Just a quick question - Did you use the car tutorial on the unity site for the physics/car control? It's amazing and I'd LOVE to implement it in a game I'm working on at the moment

    ~ Alex
     
  39. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608
    I used a different tutorial. But, I HIGHLY modified it for my own needs. Like, added a new gear shifting system. :D I'll post a WebPlayer up soon. I cant now because, of input problems(no one will answer my thread)! :'(
     
  40. herpderpy

    herpderpy

    Joined:
    Mar 9, 2010
    Posts:
    477
    Is it possible to send me a link to the tutorial? Would be awesome help!

    Ah - Well when you have it up I'll be happy to to a look:D
     
  41. LastBulliet

    LastBulliet

    Joined:
    Apr 4, 2011
    Posts:
    91
    web player link does not work at all sends me to a non working page...
     
  42. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608
  43. LastBulliet

    LastBulliet

    Joined:
    Apr 4, 2011
    Posts:
    91
    Thanks mate im trying it now it keeps saying problem loading page though :*(
     
  44. RichBosworth

    RichBosworth

    Joined:
    May 26, 2009
    Posts:
    325
    If you were using PasteUnity, then unfortunately it was hacked earlier this week.
     
  45. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608
    Try it now. No, it's now pasteunity. ;)
     
  46. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608
    Just some WiP for another car. 1994 Honda Del Sol. :) Model made in max.




    Hope you like. :)
     
  47. HolBol

    HolBol

    Joined:
    Feb 9, 2010
    Posts:
    2,887
    It's OK, but the camera REALLY needs sorting. Use the unity car camera or the smooth follow camera or SOMETHING....
    Also, with the WASD or Arrows, the car wouldn't drive straight. Had to use throttle and brake with my toes while steering with an analogue stick on my controller to drive 'well'. Also, the car needs headlights. On the mesh. And if I can knock streelights down, I should be ale to knock the traffic lights over too.

    But my main point, in 3 words:
    Fix
    The
    Camera.
     
  48. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608
    Dude. The inputs will NOT reset. ;) I do not know why! It's driving me nuts. There's 4 cameras, the default camera is the orbit cam. That's the one that just stays there, like a static camera. I do not know why. The smoothcam is one of the other three. Please read this topic for the Input problem.

    For the car straight problem, it is the wheel colliders/CenterOfMass. I'll try to figure that out. ;)
     
  49. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,608
    Some update. :)

     
  50. ognjenm

    ognjenm

    Joined:
    May 3, 2011
    Posts:
    97
    Last edited: May 22, 2011