Topic: Improved Physics

object ".Improved Wall Physics"
{
    requires 0.2.0
    always_active
    state "main"
    {
        change_state "start"
    }
    state "start"
    {
        on_player_in_the_air "start"
        if "player_angle() == 90" "go"
        if "player_angle() == 270" "go"
    }
    state "go"
    {
        on_player_jump "set speed"
        let "$y = cond(player_angle() == 90, player_xspeed(), 0-player_xspeed())"
        unless "player_angle() == 90 or player_angle() == 270" "start"
    }
    state "set speed"
    {
        set_player_yspeed "-$y"
        change_state "start"
    }
}

This makes it so you don't lose vertical momentum when running up a wall. Just spawn it somewhere, and it will do the rest. I would kind of like to see an official fix added as opposed to a scripted one, but this works well enough for now.

Keeps your speed running down walls too.

For those who don't know what I mean:

Before:
https://dl.dropbox.com/u/24102763/before.png

After:
https://dl.dropbox.com/u/24102763/after.png

Why yes, those are screens of the new MM.

Last edited by SilverstepP (2012-06-24 17:13:43)

Re: Improved Physics

Nice. I'll be sure to use that in Greek Overture. (my MOD)

Re: Improved Physics

thanks for reporting. smile

is the way things are now really incorrect? if so, why?

Re: Improved Physics

Alexandre wrote:

thanks for reporting. smile

is the way things are now really incorrect? if so, why?

Because you lose all momentum when jumping from a wall, regardless of your current speed. Other Sonic games did not do this.

Re: Improved Physics

As Alex said in the Soda Pop Zone topic, Open Surge is supposed to be an original and unique game to most classic Sonic games. However I do agree with you on this. Say you have on object that kills you on touch, an you have to keep running upward. Suddenly you have to jump to a spring above you. It seems pretty stupid when upon jumping down to the death trap.

Re: Improved Physics

S32X wrote:

As Alex said in the Soda Pop Zone topic, Open Surge is supposed to be an original and unique game to most classic Sonic games.

Yes, but this is just physics. You shouldn't lose momentum that fast.

S32X wrote:

However I do agree with you on this. Say you have on object that kills you on touch, an you have to keep running upward. Suddenly you have to jump to a spring above you. It seems pretty stupid when upon jumping down to the death trap.

... Sure?

Either way, it needs to be fixed.

Re: Improved Physics

Proof?

By using that object, you actually have a gain in momentum. Jumping happens in the axis which is perpendicular to the axis you're running - which is what you showed in pic 1. With that object, however, the y-speed comes from nowhere.

Re: Improved Physics

This goes again to my questioning of Reality simulation in the game. Let's pretend someone's climbing a mountain. Now, unless the person was really stupid, he pushed his feet off the wall, and at the same time he (extremely stupidly) detaches his support chord. Which direction would the person go x/ypos wise? In another case, Surge is so fast that he can probably run on water. Would he be able to defy gravity?

Re: Improved Physics

Alexandre wrote:

Proof?

By using that object, you actually have a gain in momentum. Jumping happens in the axis which is perpendicular to the axis you're running - which is what you showed in pic 1. With that object, however, the y-speed comes from nowhere.

No, if you're running up a wall going extremely fast, and kick off, you will keep your upward momentum. It is not a gain, or loss, it is maintaining it.

And even if it was a gain, kicking off would provide the extra oomph. Plus, it would feel much more natural.

In other words:

Imagine you have just hit a booster
https://dl.dropbox.com/u/24102763/simplicity.png

This could become a real pain.

Re: Improved Physics

All right.

Re: Improved Physics

Did you draw that just now?

Re: Improved Physics

S32X wrote:

Did you draw that just now?

Yes.

Yes I did.

Re: Improved Physics

cool. cool (KZR seems to be the only one who's not here)

Last edited by S32X (2012-06-25 03:08:55)

Re: Improved Physics

I agree with SilverstepP on the physics.
(Sorry, gotta go. sad )

-- svgmovement

15

Re: Improved Physics

the thing here is that the engine is using X speed (xsp) as Ground speed (gsp), so when you run vertically there is no Y speed (ysp) since ysp is used to know you are in the air. Internally, you're on the ground, so when you jump off the wall the speeds are reconverted to xsp/ysp, which is ok in floors or ceilings, but looks weird on walls.

my take on this is that unless there is a 90/270º wall, your gsp actually translates into -ysp when going up the wall, and into ysp when going down.

https://image.ibb.co/kuSYrm/SD_sml.pnghttps://image.ibb.co/kHq8P6/SeD_sml.pnghttps://image.ibb.co/cJf8P6/LTot_W_sml.png

Re: Improved Physics

-yspeed? But yspeed has infinite integers.

Last edited by S32X (2012-06-29 04:05:45)

17

Re: Improved Physics

-integer ?  the engine does not return speed in decimals anyway

https://image.ibb.co/kuSYrm/SD_sml.pnghttps://image.ibb.co/kHq8P6/SeD_sml.pnghttps://image.ibb.co/cJf8P6/LTot_W_sml.png

Re: Improved Physics

integers aren't decimals. There this:

...-4,-3,-2,1,0,1,2,3,4...

I really don't want to get into another mish-mash about math again. Either you're mistaken or my local school district is messed up.

@SilverstepP

I tried using this object in my ".default_startup" and I got this

Engine wrote:

Can't find built-in function "Physics" in "Physics"

I looked in the script, and I don't see a "physics()"

Last edited by S32X (2012-06-29 04:20:59)

19

Re: Improved Physics

what i said was "minus integer" is possible. if yspeed has infinite integers, what does it have to do with the fact that yspeed can be negative? i am the one confused here

https://image.ibb.co/kuSYrm/SD_sml.pnghttps://image.ibb.co/kHq8P6/SeD_sml.pnghttps://image.ibb.co/cJf8P6/LTot_W_sml.png

Re: Improved Physics

S32X wrote:
Engine wrote:

Can't find built-in function "Physics" in "Physics"

I looked in the script, and I don't see a "physics()"

And you shouldn't. I didn't put that in there.

If you got that, then it's not something I did, nor something I can help you at the time, seeing as I couldn't know what you did to get that without seeing each script you put anything involving this in. All you had to do is paste the script somewhere in some .obj, spawn the object, and you're done. Nothing else really fancy is required.

How, exactly, did you spawn it?

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

@ Integer / Decimal hoopla

Last time I checked, YSpeed can be a decimal without crashing. It can also be positive or negative.

Whether the engine actually takes decimals into consideration when setting yspeed (as opposed to it rounding the value) is beyond me. The difference would be so ridiculously small as it is, anyways, unless you want a very slow object.

As long as yspeed is a real number of any kind, it should work. Whether it works as intended or sends you flying the wrong way is completely up to the scripter.

Re: Improved Physics

SilverstepP wrote:

How, exactly, did you spawn it?

This way:

// ---------------------------------------------------------------------------
// Open Surge Engine
// http://opensnc.sourceforge.net
//
// File:   objects/default_startup.obj
// Desc:   default startup object. Takes care of the HUD and stuff.
// Author: Alexandre
// Date:   2010-12-20, 2010-12-21, 2011-01-01, 2011-08-21, 2012-01-01, 2012-01-15
// ---------------------------------------------------------------------------


#include "default_startup/hud.inc"
#include "default_startup/opening_animation.inc"
#include "default_startup/level_cleared.inc"
#include "default_startup/switch_character.inc"
#include "default_startup/pause.inc"
#include "default_startup/quit.inc"
#include "default_startup/camera.inc"
#include "default_startup/water.inc"

// ----------------------------------------------
// This object is created by default
// in every level that contains the
// 'startup ".default_startup"' line
// ----------------------------------------------
object ".default_startup"
{
    requires 0.2.0
    always_active

    state "main"
    {
        hide

        create_child ".default_startup.opening_animation"
        create_child ".default_startup.level_cleared"
        create_child ".default_startup.switch_character"
        create_child ".default_startup.camera"
        create_child ".default_startup.water"
        create_child ".Improved Wall Physics

        change_state "cooldown"
    }

    state "cooldown"
    {
        on_timeout 4.0 "enable_hud"
    }

    state "enable_hud"
    {
        let "$_hide_hud = 0"
        let "$_disable_character_switching = 0"

        create_child ".default_startup.hud"
        create_child ".default_startup.pause"
        create_child ".default_startup.quit"

        destroy
    }
}

22

Re: Improved Physics

create_child ".Improved Wall Physics

there's the issue. unclosed quotes.

https://image.ibb.co/kuSYrm/SD_sml.pnghttps://image.ibb.co/kHq8P6/SeD_sml.pnghttps://image.ibb.co/cJf8P6/LTot_W_sml.png

Re: Improved Physics

That's actually not a problem.

create_child ".Improved Wall Physics"|create_child .Improved Wall Physics|create_child ".Improved Wall Physics|create_child .Improved Wall Physics"

It doesn't really matter. I've scripted plenty of objects that have one or no quotes at all and they work fine.

create_child ".Improved Wall" Physics

Now that's a problem.

24

Re: Improved Physics

no, the problem is that you specified a name with multiple words and spaces after an open quote, but didn't close it.

I know Silver is not too friendly with

"more_than_one_word"

he's like

"more than one word"

, so to make sure his objects work, don't forget to keep the object names inside quotes.

Last edited by KZR (2012-06-29 05:33:41)

https://image.ibb.co/kuSYrm/SD_sml.pnghttps://image.ibb.co/kHq8P6/SeD_sml.pnghttps://image.ibb.co/cJf8P6/LTot_W_sml.png

Re: Improved Physics

K I'll try that. smile