First game - Reckless Driver: Urban

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. :stuck_out_tongue: 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!

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 :slight_smile:

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^^

Why does it say I’m driving at 0.1mph even if I’m standing still?

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).

Thanks guys. Bahamapascal, there is nothing like that in my car script. The MPH gauge works like this:

var mph = rigidbody.velocity.magnitude * 2.237;
	mphDisplay.text = mph + " MPH" ;

RockyBozzy, the green car isn’t finished yet. ^^

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:

Here is the one I’m using.

var mphDisplay : GUIText;

var resetTime : float = 5.0;
private var resetTimer : float = 0.0;

// These variables allow the script to power the wheels of the car.
var FrontLeftWheel : WheelCollider;
var FrontRightWheel : WheelCollider;

// These variables are for the gears, the array is the list of ratios. The script
// uses the defined gear ratios to determine how much torque to apply to the wheels.
var GearRatio : float[];
var CurrentGear : int = 0;

// These variables are just for applying torque to the wheels and shifting gears.
// using the defined Max and Min Engine RPM, the script can determine what gear the
// car needs to be in.
var EngineTorque : float = 600.0;
var MaxEngineRPM : float = 3000.0;
var MinEngineRPM : float = 1000.0;
private var EngineRPM : float = 0.0;



function Start () {
	// I usually alter the center of mass to make the car more stable. I'ts less likely to flip this way.
	rigidbody.centerOfMass.y = -1.5;
}

function Update () {

    var mph = rigidbody.velocity.magnitude * 2;
	mphDisplay.text = mph + " MPH" ;
	
	// This is to limith the maximum speed of the car, adjusting the drag probably isn't the best way of doing it,
	// but it's easy, and it doesn't interfere with the physics processing.
	rigidbody.drag = rigidbody.velocity.magnitude / 220; 
	
	// Compute the engine RPM based on the average RPM of the two wheels, then call the shift gear function
	EngineRPM = (FrontLeftWheel.rpm + FrontRightWheel.rpm)/2 * GearRatio[CurrentGear];
	ShiftGears();

	// set the audio pitch to the percentage of RPM to the maximum RPM plus one, this makes the sound play
	// up to twice it's pitch, where it will suddenly drop when it switches gears.
	audio.pitch = Mathf.Abs(EngineRPM / MaxEngineRPM) + 1.0 ;
	// this line is just to ensure that the pitch does not reach a value higher than is desired.
	if ( audio.pitch > 2.0 ) {
		audio.pitch = 2.0;
	}

	// finally, apply the values to the wheels.	The torque applied is divided by the current gear, and
	// multiplied by the user input variable.
	FrontLeftWheel.motorTorque = EngineTorque / GearRatio[CurrentGear] * Input.GetAxis("Vertical");
	FrontRightWheel.motorTorque = EngineTorque / GearRatio[CurrentGear] * Input.GetAxis("Vertical");
		
	// the steer angle is an arbitrary value multiplied by the user input.
	FrontLeftWheel.steerAngle = 20 * Input.GetAxis("Horizontal");
	FrontRightWheel.steerAngle = 20 * Input.GetAxis("Horizontal");
}

function ShiftGears() {
	// this funciton shifts the gears of the vehcile, it loops through all the gears, checking which will make
	// the engine RPM fall within the desired range. The gear is then set to this "appropriate" value.
	if ( EngineRPM >= MaxEngineRPM ) {
		var AppropriateGear : int = CurrentGear;
		
		for ( var i = 0; i < GearRatio.length; i ++ ) {
			if ( FrontLeftWheel.rpm * GearRatio[i] < MaxEngineRPM ) {
				AppropriateGear = i;
				break;
			}
		}
		
		CurrentGear = AppropriateGear;
	}
	
	if ( EngineRPM <= MinEngineRPM ) {
		AppropriateGear = CurrentGear;
		
		for ( var j = GearRatio.length-1; j >= 0; j -- ) {
			if ( FrontLeftWheel.rpm * GearRatio[j] > MinEngineRPM ) {
				AppropriateGear = j;
				break;
			}
		}
		
		CurrentGear = AppropriateGear;
	}
}

function Check_If_Car_Is_Flipped()
{
	if(transform.localEulerAngles.z > 80  transform.localEulerAngles.z < 280)
		resetTimer += Time.deltaTime;
	else
		resetTimer = 0;
	
	if(resetTimer > resetTime)
		FlipCar();
		}
		
		function FlipCar()
{
	transform.rotation = Quaternion.LookRotation(transform.forward);
	transform.position += Vector3.up * 0.5;
	rigidbody.velocity = Vector3.zero;
	rigidbody.angularVelocity = Vector3.zero;
	resetTimer = 0;
	currentEnginePower = 0;
	}

What tutorial is that from?

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.

That is the link to the tutorial,sadly it is only in german so you will probably have a problame understandin:(
If you want to read the Website you could probably use Google translate^^.
Thanks for the script will look at it in a momant^^
Since I am a new to programming,I hope I can learn from it.

Cool. I am also somewhat new, but I know the basics. :slight_smile:

double post… I fixed the speedo. :slight_smile:

var mph = Mathf.Round (rigidbody.velocity.magnitude * 2);

Dude, it was cool till i came off the tracks, but nice going!
Also, you can’t use images in your signature :P.

I see that. Why not? xD I have a new menu designer, so, he’s going to do the site and menus! :smile: Updates soon! :slight_smile:

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. :slight_smile:

Hello egain^^
One easy improvment would be to put the Smooth Follow script on the camera
allso here is a hige quality car model for FREE:

hope this helps you^^

Thanks. But, I’ll be making my own cars. ^^ Anyone else have crits?

Double post. Updates! :slight_smile: Some new things. Totally new car physics. :slight_smile: 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! :smile: If you don’t like the new physics, please tell me how to improve them. :slight_smile:

EDIT: Updated car physics. Lemme know your crits! :smile:

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!

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! :slight_smile: Tell me what you guys think!

Webplayer: Click for WebPlayer.

Have fun! :smile: