#Creating a sort of State Machine for handling the player. Client VS Server State Changing?

1 messages · Page 1 of 1 (latest)

trail wraith
#

I'm very new to state machine/behaviortrees but I'm trying to learn to make my own combat system

There are supposed to be fast paced state changes based on player input and external factors from other players

In the instance of "parrying" an attack, where you have a short window to react to an attack and press a button, in which case it then switches to normal "blocking" fairly quickly.. I feel as though such quick updates through the server can make things feel sluggish?

Or am I underestimating the response time remotes have when properly optimized?

#

I also very much assume handling state changes on the client could lead to a lot of exploitation

rotund vault
trail wraith
# rotund vault Client should initiate the action that causes the state change, after being veri...

So
Player Presses Button
Send a state change request to the server?
Server checks authenticity from last state or needed parameters
Server handles most of the follow-up logic of that state

So basically just input handling on client of course but then for state changes you just request the server to handle that

Or are you saying initiate the state change on the client for responsiveness, and then have the server authenticate that change and revert or accept it?

jovial sandal
limber iglooBOT
#

studio** You are now Level 4! **studio

jovial sandal
#

those are npc behaviour

trail wraith
#

Its more than just for NPC behavior

#

state machines have many uses

#

really its a question about replication

rotund vault
# trail wraith So Player Presses Button Send a state change request to the server? Server check...

Client fires a remote event, server script receives and authenticates it, if it’s a valid input it continues with any of the combat logic you have made (hitbox, damage management, all either inside the server script or a module script if you are utilizing oop). From what you’re saying I’m assuming you are trying to utilize a state machine for other inputs such as blocking and stuff so after an attack is verified by the server you’ll also want to update the players state on the server (I.e: attacking or blocking.) if your logic has the players attack hit another player then you have it check their state so if they are blocking then your attack will end having reduced damage or whatever you plan on doing.

trail wraith
#

I think what I'm more-so asking is in terms of replicating the client state to the server for the best responsiveness, would remote event firing be the most efficient method

rotund vault
#

Efficiency depends on how much you try communicating between client and server which shouldn’t be a lot so you’ve got nothing to worry about