Player Jump Event trigger in server/client mode...
I'm working on a game that has a need for the player to lose energy when they jump. I'm trying to figure out the best way to do this for my multiplayer game.
If it were standalone, I could just override DoJump() and decrement energy levels, but I need to have a way to notify the server so it can change the energy for the player there, rather than on the client that is attempting to make their pawn jump.
I was hoping that there was a way to detect a 'jump' event when the pawn goes into a jump mode. I see that there's a bPressedJump value that is set when the player uses the jump key on the keyboard. This is then examined in an update and if valid calls DoJump() on the client.
DoJump() sets Z velocity, and then sets the physics mode. I'm guessing this is then evaluated with standard client movement (which simulates the movement on client and passes it to server to handle movement as well). But I'm not sure if there's ever a "Hey, this player jumped" on the server.
I could, in the client DoJump(), call a server function independently that asks to decrement energy, but this seems a bad idea (hacking could make a player bypass energy loss, for example).
I could also examine a player's historical Z velocity value and note if it takes a huge increase, but that also seems error prone because a player could hit a launch pad, fall of a precipice, etc...
Anybody run into a similar situation, or have a tip on how I could detect on the server when a player successfully invokes a jump?