Altering velocity of entity client side


(Rudi) #1

On the server side we can do (g_cmds.c):

ent->client->ps.velocity[2] = 270 * 1.6f;

But on the client side how do we alter that (from cg_consolecmds.c)…

Any insight would be appreciated!! THANKS :smiley: :evil:


(Discovery) #2

You can’t really do that. ET is designed in a way that prevents speedhacks (except for the engine exploits :wink: ). If you change the speed clientside you will only get bad prediction since the server will correct the position every serverframe.


(Rudi) #3

Okay, but how do we make it so that everything is smooth, because currently when running the command that runs that function, it can only be ran every 1-2 seconds, meaning the whole motion is extremely ‘jumpy’ and laggy.

Like with the double jump code posted here, Jay said the answer to make everything smooth was to run it on the client side too… But you’re saying it can’t be done? Or am I missing something here (probably am).


(Discovery) #4

Aah now I get you. Yes you can (and should) change the movement clientside when it is done serverside too. It is pretty simple: most movement code can be found in the bg_ files. These files are used by the server and the client. This means that when you change something serverside and compile both the server and client bins, it is changed clientside too. It gets a bit harder when the movement is partially done in the game files only, but I don’t know “the double jump code JayBird posted here”.


(Rudi) #5

Here’s the Double Jump: http://splashdamage.com/forums/viewtopic.php?t=11173

I spoke with Jaybird again he said that it needs to be in bg_pmove.c, so I put a function in there and called it from g_cmds.c, but that doesn’t work. Jaybird says that I need to use the pmove function and that will call that function depending on the player’s state. Now then I have no idea how to do this.

I’m guessing that I need to add some flags somewhere but I need some help or an example or something. :shock: