Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / 2D Drag Race ( Help With Accel And Decel )

Author
Message
JNice013
20
Years of Service
User Offline
Joined: 10th Jan 2004
Location:
Posted: 18th Jan 2004 07:16
I'm using DBC and one of my projects is a 2d street drag racing game.
( You check out how the cars look here Kuru Kuru Style http://shin.bit.ac/ ) The cars will be moving from left to right without movement, the only controls will be accelerating and shifting. I'm not quite sure how to go about accel and decel and i've been messing around with it but have gotten nowhere. Also would scrolling the screen left to right be the right way to go for movement.

"The Infamous J Nice"
JNice013
20
Years of Service
User Offline
Joined: 10th Jan 2004
Location:
Posted: 22nd Jan 2004 22:21
Can some one help me with this please ? I'd appreciate any help . . .

"The Infamous J Nice"
Don Malone
21
Years of Service
User Offline
Joined: 27th Apr 2003
Location: Birmingham, Alabama
Posted: 26th Jan 2004 05:07
Accel and Decel can be as simple or as complicated as you want to do it. I always try to work with a simple system when I can.

But what will you be using in your equation? Will you factor traction of the road in? how about torque of the cars? Do you have a formula to figure the cars traction using RPM's and the cars available torque? From there you have to devise the optimal shift points for each vehicle to know when the acceleration starts to decline. This is the complexe form.

You first have to decide how you want to approach your formula and try to work something out then try to get help if you need it when you have something of your own to show an effort was made.

I know that I was not a lot of help but these are the problems you will face when you program not only games but other programs as well.
Good Luck and await your post

Wasting CPU Cycles since the 286 was a hot machine.
JNice013
20
Years of Service
User Offline
Joined: 10th Jan 2004
Location:
Posted: 28th Jan 2004 22:08 Edited at: 28th Jan 2004 22:08
I only want the cars horsepower to matter. The higher the ars HP the faster the acceleration will be and once the accel reaches the top speed for that gear it will stay that sped until shifted up and if shifted between a certain speed and certain speed a small boost of accel will be given for correct shifting time.

The game is a flat out sideways drag race so theirs not alot of things to factor in except the power of the car deterining accel and top speed.

I will try to work something up to show for.

"The Infamous J Nice"
Don Malone
21
Years of Service
User Offline
Joined: 27th Apr 2003
Location: Birmingham, Alabama
Posted: 29th Jan 2004 05:29
This is just a rough of what I am trying to figure out.

Top speed is a given - Example 120 mph
Shift Point is 8000 RPM's
Number of Gears in Tranny are say 4

I am trying to get the kinks out of this simple formula

speed=(speed+((topspeed-currentspeed)/((RPMs/Shiftpoint)*5)/Gear*6)

Like I said it is rough and still needs a lot of work but in essence my thought process is like you are determining the number of units the car moves forward.

so if current speed is 80 in third gear at 6500 RPM then my formula would look something like
speed=(80+((120-80)/((6500/8000)*5)/3*6))
or
speed =(80+((40)/((.8125)*5)/3*6)) or speed= speed + 13.67

as rpms increase the potential accel increases and acceleration is decreased with a higher gear. When the car reaches max speed you can no longer accelerate. The only issue is balancing the formula with your needed acceleration needs. You will have to determine how you want to handle RPM's.

Like I said the formula is very rough and probably not the best math example. I am sure someone can write better code and also note this is not tested in DB but just a on paper math example.

Maybe you can get an idea for your needs.
Good luck

Wasting CPU Cycles since the 286 was a hot machine.
JNice013
20
Years of Service
User Offline
Joined: 10th Jan 2004
Location:
Posted: 30th Jan 2004 01:59
thanks that helps a little. I'm trying to work out something like that to I just have to write everything out so I know the exact numbers that will be used.

Thanks

"The Infamous J Nice"

Login to post a reply

Server time is: 2024-05-13 12:13:12
Your offset time is: 2024-05-13 12:13:12