Racing Game Help

Hello. This is my first post in this forum.

I know this kind of topic has been razed before but I would like to know certain things that were not answered in other topics.

I am attempting to create a simple arcade racing game using the BGE. To start with it will just feature a car and a track (no AI or anything yet, until I can work out how to program it and everything. I’m only just starting to use python and have almost no experience with programming). So far I have a car from this demo: http://www.bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=11&t=1687

I have modified it so that the wheels appear to lock a bit when trying to brake and turn at the same time (its really just the tyres losing friction, but they still spin) and made the car turn a little bit more like in an arcade game and made some all-round tweaks and improvements. I will be adding my own car mesh later.

What I would like to know at this point is this:

  • How to add a “hood cam” which can move and rotate from the car slightly (so kind of like loose parenting but not looking at the car like with the camera actuator thingy)
  • How to add gears
  • How to add a menu system or more importantly at this point, UI (such as a speedometer etc.)

I am not too familiar with the game engine yet. I can deal with logic bricks and such but no scripting or IPOs or anything unless there’s a good tutorial or explanation.

Thanks for any help. If you would like me to upload what I have so far I can :slight_smile:

EDIT: Uploaded .blend file.

SpewBoy

Attachments

sb_vehicle_game.blend (920 KB)

There’s a bunch of tutorials which I have used if you click on “resources” in my sig. Python, cars, you name it.

For your “hood” cam you could add an empty slightly in front of the car, just above the hood. Parent the empty to the car. Then have the camera use the camera actuator to follow the empty. I’m not sure how well this will work, but it’s a start.

For a UI, look at the “dynamic text” link.

Welcome to BA!

here is a vehicle rapper
http://www.tutorialsforblender3d.com/Game_Engine/Vehicle/Vehicle_1.html
it really cool

Thanks guys! I’ll check them out. JO9, I tried that hood idea but it didn’t seem to work, although I tried a cube instead of an empty. I’ll give it another shot.

Thanks for your help. I’ll post back here if I have more questions that I cant find the answer to.

SpewBoy

Okay. I just tried to get a speedometer working. I used a premade python script for it:

import math
o = GameLogic.getCurrentController().getOwner()
obj = GameLogic.getCurrentScene().getObjectList()


####  Name of object you want to measure the speed of ###
Name = "car"
###   how fast is the car going if it travels 10 unit
###   per frame?
unit = 100

def dist(pos,posi):
   Z = (posi[2])-(pos[2])
   Y = (posi[1])-(pos[1])
   X = (posi[0])-(pos[0])
   return math.sqrt((X)*(X) + (Y)*(Y) + (Z)*(Z))

pos = obj["OB"+Name].getPosition()
if not hasattr(o, "init"):
   o.init = 1
   GameLogic.pos = pos


o.Text = dist(pos, GameLogic.pos)*unit
GameLogic.pos = pos

The problem with this is that it measures the speed for every axis. I only want to measure my car’s Y axis speed. I can do all of the dynamic text and stuff but its just the scripting that gets me.

Could someone please make a blend file or modify mine to incorporate a way to measure my car’s speed? Just a simple demo would do. I have checked the links and searched the forum for a way to do this but I don’t quite understand most of them and I only want to measure the car’s Y speed and nothing else.

Thanks,

SpewBoy