Aftershock(Trackverse)/Wipeout/F-Zero-like Dynamics ?

Problems building or running the engine, queries about how to use features etc.
Post Reply
User avatar
Mind Calamity
Ogre Magi
Posts: 1255
Joined: Sat Dec 25, 2010 2:55 pm
Location: Macedonia
x 81

Aftershock(Trackverse)/Wipeout/F-Zero-like Dynamics ?

Post by Mind Calamity »

Hi, guys!

I'm trying to do a game like F-Zero/Wipeout, and I have no idea where to start on the physics/game dynamics, I tried with Bullet and applying force/impulse while a key is pressed.

That sort of worked, but it's far from playable, so I'm thinking of abandoning Bullet for a collision detection-only library (like Minimal OGRE Collision) (or using only Bullet's collision-detection facilities) and coding my own dynamics, now trouble is - I have no idea how to actually make the dynamics I mean that hovery effect Wipeout has, or smooth turning around corners and tilting the craft among others...

So what I need is hints and tips on:
* Keeping the craft hovering (but not a static Y-only hover - see video below)
* Tilting the craft while turning and making the turns smooth
* Any other information about making the gameplay dynamics Wipeout-like
This is the first time I'm doing something like this so any help is much appreciated.

Here's what I'd like the gameplay to be like:
[youtube]PnCn3yra2jQ[/youtube]

Any help is greatly appreciated!

I will post a video and code from my Bullet progress later.

------------------------------------------

The above post is a mirror of my original post on GameDev.net.

I hope the guys from Aftershock/Trackverse can help!
BitBucket username changed to iboshkov (from MindCalamity)
Do you need help? What have you tried?
- xavier
---------------------
HkOgre - a Havok Integration for OGRE | Simple SSAO | My Blog | My YouTube | My DeviantArt
User avatar
Jabberwocky
OGRE Moderator
OGRE Moderator
Posts: 2819
Joined: Mon Mar 05, 2007 11:17 pm
Location: Canada
x 218
Contact:

Re: Aftershock(Trackverse)/Wipeout/F-Zero-like Dynamics ?

Post by Jabberwocky »

For the hovering, I'd approach it like this.
You have gravity, which applies a force downward.
You have lift, which applies a force upward depending on the distance from the ground.
So the closer you are to the ground, the stronger the upward force, until the upward force and gravity balance out and you stay hovering.

On a flat pice of track, everything balances out, and you stay an even distance from the ground.
After you go over a jump or a bump, your forward velocity takes you further from the ground, so the upward force lessens, and gravity pushes you down until the upward force kicks in again.
You might need to add some extra stabilizing code to keep the craft from bobbing up and down like a pendulum between the upward and gravitational forces.

For the roll, you could maybe approach that without using force. Just rotate the craft around the forward axis based on the turn rate.
Image
User avatar
Waruck
Goblin
Posts: 210
Joined: Mon Dec 12, 2011 12:52 pm
Location: Germany
x 34

Re: Aftershock(Trackverse)/Wipeout/F-Zero-like Dynamics ?

Post by Waruck »

if you only apply an upward force depending on the distance to the ground you'll end up with some oscillation around your desired hight. For smoothing the hight to a desired goal have a look at pid-controller: http://en.wikipedia.org/wiki/PID_controller
in a nutshell:
-pid stands for proportional, integral and derivative.
-the proportional term alone gives you an oscillation around a desired point (like a spring).
-the integral part gives a quicker smoothing to the desired point. It first increases the oscillation's magnitude but then reduces it.
-the derivative term smoothes the oscillation to a constant value. this makes the process a little bit slower but reduces to problem with the integral-part at the beginning.
-giving weighting factors to all these terms gives you different behaviours to smooth your signal/value to the desired goal-point

For a hovering effect you can take the vertical distance to your desired point as the proportional part, the vertical velocity as the derivative part and just ignore the integral part. Just make sure to disable the regulation while your vehicle isn't hovering but falling, otherwise you would get some really strange falling behaviour.

Tilting can be achived in a similar way. Calculate the goal-point for your roll based on your steering. Take the difference between your current roll and the desired roll as the proportional term and take your angular-momentum as the derivative term.

Use a Physics-Library to apply the Forces (angular force for tilting) and experiment a little with the weighting-factors to get a behaviour you're fine with. To speed up the motions you can either increase the proportional contribution or decrease the derivative contribution. To reduce the oscilation you can increase the derivative contribution.
Post Reply