What this code prevents is pogo sticking, jump jump jump (not touching the ground, and also not running other movement logic - as the comments say).
That still allows what a CS player would think of as a bunny hop, jump, land, jump in rapid succession. You'll still need to code logic to stop that sort of jumping (using a stamina system ala DOD would work, I add further penalties like you can't aim for beans after a jump, and if you jump while firing an RPG or something you'll blow your .. err legs off).
At least that's always been my understanding.
You wouldn't want to clamp jumping to the normal forward speed of a player as jumping is a gathering of kinetic/potential? energy in the skeletal/muscular system and a release quickly to accelerate, it has to be somewhat faster therefore than 1.0 times max speed. Why 1.7? I dunno, why 100 health? Just numbers chosen that 'felt right'? (well 100 health makes math easy, but you know what i mean).
At 09:52 AM 8/23/2003 -0700, you wrote:
Can someone explain to me the reasoning behind this code (code at bottom)?
I understand this is to limit bunny hopping but why 1.7X the player max speed? Is there a reason this was not set lower? Also why the .65 speed reduction? 400 x 1.7 * 0.65 = 443 ???
I would like to further prevent bhoping and thought I would follow Valves approach only with different multipliers but wonder why Valve didn't do this originally. Was there some problem that prevented using a factor of 1.0 or 1.2 for example? Why was 1.7 chosen as the limit?
[code]
FROM VALVE SDK FILE: pm_shared.c
#define BUNNYJUMP_MAX_SPEED_FACTOR 1.7f
//----------------------------------------------------------------------------- // Purpose: Corrects bunny jumping ( where player initiates a bunny jump before other // movement logic runs, thus making onground == -1 thus making PM_Friction get skipped and // running PM_AirMove, which doesn't crop velocity to maxspeed like the ground / other // movement logic does. //----------------------------------------------------------------------------- void PM_PreventMegaBunnyJumping( void )
_______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders
Pat 'sluggo' Magnan Tour of Duty mod http://www.tourofdutymod.com Monkeystrike mod http://www.monkeystrike.com
_______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders