PDA

View Full Version : Smash bros type launching algo


3DModelerMan
11-05-2008, 10:47 AM
Hey I was wondering what you guys had to say about this.
How did they do the launching in smash bros?. I can't seem to get it to work in my little demo, should I have them launch for only a certain amount of time depending on their damage?, or only a certain distance?.
Thanks:happy: .

starstutter
11-05-2008, 02:16 PM
ehhh, well sounds cool but we could probably help more if you posted some code :)

I think it's really just rasing the velocity of the launch linear to the amount of damage they take. You shouldn't have to change other aspects of the physics.

alphadog
11-06-2008, 07:07 AM
What is "the launching"? (Sorry, never played Smash Bros.)

To me, it sounds like the next Night Shyamalan movie... :)

starstutter
11-06-2008, 07:08 AM
What is "the launching"?
To me, it sounds like the next Night Shyamalan movie... :)
Vwat a twist!

3DModelerMan
11-06-2008, 07:50 AM
What is "the launching"? (Sorry, never played Smash Bros.)
The higher your damage the easier it is to launch your oponent out of the screen and K.O them. But anyway I will install a physics engine and get everything setup and working then.

starstutter
11-06-2008, 10:34 AM
well, I mean, we really can't specificly help you because you're not telling us exactly how you plan to implement this. Off the top of my head:

LaunchSpeed = PowerOfAttack * Direction + log(DamagePercent + 1) * Direction * (pow(PowerOfAttack, 2)* .07);

I'm just pulling that out of my ass and basing it off what I've seen of the smashbros damage system. Obviously it's not totally accurate but it should give you a vauge resemblance of the launch patterns.

3DModelerMan
11-06-2008, 03:03 PM
Thanks, a vauge resemblance is all I really need anyway.

alphadog
11-07-2008, 05:27 AM
Well, your own "launching" could be designed from simple kinetics and transfer of a force to a body, where the damage caused is an indicator of the "strength" of the force. Basically, start from an elastic collision and move from there...

vrnunes
11-07-2008, 04:31 PM
Have you already implemented some sort of gravity into your characters?

Gravity is quite simple to implement, you just insert a property for vertical increment, like:


class Sprite
{
float iy; // vertical increment
float px, py; // sprite position
... other properties, etc
}


then, at each step of your character updating, you do something like:


sprite.iy += GRAVITY; // GRAVITY = some small value, like 0.8f
sprite.py += sprite.iy; // here you update sprite vertical position

// check if it reaches ground (simplistic)
if (sprite.py > SCREEN_HEIGHT)
{
// prevents from falling out of screen
sprite.py = SCREEN_HEIGHT;

// you can give the sprite a bounce if you wish:
sprite.iy *= -0.5f; // (nice bouncing!)
}


There were some details left for you to implement, but this is a basic gravity algorithm that works nicely.

3DModelerMan
11-08-2008, 07:00 AM
Yeah gravity is easy, and my engine just lets me set the gravity on my objects anyway.