Jedi Academy – ID Tech 3 – Strafe Jump Code

| | August 4, 2015

Firstly, sorry if this is a bad question.

Situation:
I’m aware that the ID Tech 3 engine contains the infamous ‘strafe jumping’ mechanic. For this question though, I’m not referring to the strafe jump itself (the single jump), but rather the continued use of the method which enables tremendous speeds to be reached.

I have noticed that this is possible due to the fact that in some implementations of the ID Tech 3 engine, your speed isn’t cancelled when you wish to jump again.

In Jedi Knight II: Jedi Outcast, your speed isn’t cancelled when you jump. However in Jedi Academy, it is.

Foundations for the question:
Now that the source code has been released for both Jedi Outcast and Jedi Academy, I thought I’d see if I can find out what is cancelling my speed when I jump (in JA), and revert it back to how it is in JO so that I may reach great speeds.

However, I have no idea where such code would kept within the project.

Things I have tried:
I’ve tried searched for terms such as “strafe”; “jump”; and “move”.

I’ve also tried searching for console commands which could give an indication to a possible setting/toggle responsible for this, but I have not been met with much success.

Question:
Is anyone aware of the line(s) of code which cancels my speed when I jump?

Additional information:
I am by no means whatsoever a games developer. I have had experience programming, but again, I am by no means a professional.

One Response to “Jedi Academy – ID Tech 3 – Strafe Jump Code”

  1. Synthetic Ascension on November 30, -0001 @ 12:00 AM

    Solution:
    After a bit of digging with Google, I found this forum post asking what is/was responsible for strafe jumping being disabled in Siege Mode (Multiplayer). The last reply stated that the PM_Accelerate() was responsible for this.

    For my case however, it wasn’t quite, however it did direct me to bg_pmove.cpp contained within the OpenJK-mastercodegame directory. I compared this file (from JA), to the same file in Jedi Outcast. After a while, I found this code contained within PM_GetLandingAnim():

    switch ( anim )
    {
    case BOTH_FORCEJUMPLEFT1:
    case BOTH_FORCEINAIRLEFT1:
        anim = BOTH_FORCELANDLEFT1;
        //stick landings some
        pm->ps->velocity[0] *= 0.5f;
        pm->ps->velocity[1] *= 0.5f;
        break;
    case BOTH_FORCEJUMPRIGHT1:
    case BOTH_FORCEINAIRRIGHT1:
        anim = BOTH_FORCELANDRIGHT1;
        //stick landings some
        pm->ps->velocity[0] *= 0.5f;
        pm->ps->velocity[1] *= 0.5f;
        break;
    case BOTH_FORCEJUMP1:
    case BOTH_FORCEINAIR1:
        //stick landings some
        pm->ps->velocity[0] *= 0.5f;
        pm->ps->velocity[1] *= 0.5f;
        anim = BOTH_FORCELAND1;
        break;
    case BOTH_FORCEJUMPBACK1:
    case BOTH_FORCEINAIRBACK1:
        //stick landings some
        pm->ps->velocity[0] *= 0.5f;
        pm->ps->velocity[1] *= 0.5f;
        anim = BOTH_FORCELANDBACK1;
        break;
    case BOTH_JUMPLEFT1:
    case BOTH_INAIRLEFT1:
        anim = BOTH_LANDLEFT1;
        //stick landings some
        pm->ps->velocity[0] *= 0.5f;
        pm->ps->velocity[1] *= 0.5f;
        break;
    case BOTH_JUMPRIGHT1:
    case BOTH_INAIRRIGHT1:
        anim = BOTH_LANDRIGHT1;
        //stick landings some
        pm->ps->velocity[0] *= 0.5f;
        pm->ps->velocity[1] *= 0.5f;
        break;
    case BOTH_JUMP1:
    case BOTH_INAIR1:
        anim = BOTH_LAND1;
        //stick landings some
        pm->ps->velocity[0] *= 0.5f;
        pm->ps->velocity[1] *= 0.5f;
        break;
    case BOTH_JUMPBACK1:
    case BOTH_INAIRBACK1:
        anim = BOTH_LANDBACK1;
        //stick landings some
        pm->ps->velocity[0] *= 0.5f;
        pm->ps->velocity[1] *= 0.5f;
        break;
    case BOTH_BUTTERFLY_LEFT:
    case BOTH_BUTTERFLY_RIGHT:
    case BOTH_BUTTERFLY_FL1:
    case BOTH_BUTTERFLY_FR1:
    case BOTH_FJSS_TR_BL:
    case BOTH_FJSS_TL_BR:
    case BOTH_LUNGE2_B__T_:
    case BOTH_FORCELEAP2_T__B_:
    case BOTH_ARIAL_LEFT:
    case BOTH_ARIAL_RIGHT:
    case BOTH_ARIAL_F1:
    case BOTH_CARTWHEEL_LEFT:
    case BOTH_CARTWHEEL_RIGHT:
    case BOTH_JUMPFLIPSLASHDOWN1://#
    case BOTH_JUMPFLIPSTABDOWN://#
    case BOTH_JUMPATTACK6:
    case BOTH_JUMPATTACK7:
    case BOTH_A7_KICK_F:
    case BOTH_A7_KICK_B:
    case BOTH_A7_KICK_R:
    case BOTH_A7_KICK_L:
    case BOTH_A7_KICK_S:
    case BOTH_A7_KICK_BF:
    case BOTH_A7_KICK_RL:
    case BOTH_A7_KICK_F_AIR:
    case BOTH_A7_KICK_B_AIR:
    case BOTH_A7_KICK_R_AIR:
    case BOTH_A7_KICK_L_AIR:
    case BOTH_STABDOWN:
    case BOTH_STABDOWN_STAFF:
    case BOTH_STABDOWN_DUAL:
    case BOTH_A6_SABERPROTECT:
    case BOTH_A7_SOULCAL:
    case BOTH_A1_SPECIAL:
    case BOTH_A2_SPECIAL:
    case BOTH_A3_SPECIAL:
    case BOTH_PULL_IMPALE_STAB:
    case BOTH_PULL_IMPALE_SWING:
        anim = -1;
        break;
    case BOTH_FORCELONGLEAP_START:
    case BOTH_FORCELONGLEAP_ATTACK:
        return BOTH_FORCELONGLEAP_LAND;
        break;
    case BOTH_WALL_RUN_LEFT://#
    case BOTH_WALL_RUN_RIGHT://#
        if ( pm->ps->legsAnimTimer > 500 )
        {//only land at end of anim
            return -1;
        }
        //NOTE: falls through on purpose!
    default:
        if ( pm->ps->pm_flags & PMF_BACKWARDS_JUMP )
        {
            anim = BOTH_LANDBACK1;
        }
        else
        {
            anim = BOTH_LAND1;
        }
        //stick landings some
        pm->ps->velocity[0] *= 0.5f;
        pm->ps->velocity[1] *= 0.5f;
        break;
    }
    return anim;
    

    It seems that the code for Jedi Outcast does not contain the code:

    //stick landings some
    pm->ps->velocity[0] *= 0.5f;
    pm->ps->velocity[1] *= 0.5f;
    

    After commenting this out, I found that my speed is not cancelled every time I land.

Leave a Reply