Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Client
- PlayerUpdating
- In Client PlayerUpdating//called once a frame
- RequestStateUpdates();
- this will send packet to server
- server handles this packet and contains index of sender
- server then calls
- player[index].SendState()
- Client handles state
- client changes state
- process current state
- idle state
- i listen for inputs
- when input is there i send input packet to server
- server handles input changes states to walking and try to move
- on server state update (we send this successful update to other clients)
- walk state
- I should also be listening to keys so i can keep walking when Iām in walking state
- When Iām in walk state
- I should Have my position already
- Send my states animations
- SendMyRotationToEveryone
- send my states SendMyPosToEveryone
- Server
- How does server send to client constantly?
- SendState contains
- state id
- state aim name
- state aim play
- handlinput
- player[index].currentstate = walk state
- DAtaSender.sendState(to everyone)
- player[index].currentState.processInput //calculate movement to send
- player[index].currentState.updateMovement() //send position to everyone with angle
- player[index].currentState = Idle() //should be a generic (next state) so i can transition to which ever state
- states
- idle //by default server is sending idle state to client
- processInput()
- updatemovement
- walk // when server receives input it changes the states
- processInput()
- this will see what keys where pressed
- based on this
- temp x and temp z will be updated
- UpdateMovement(
- set player[index].pos = temps
- network.sendmovementdatatoall()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement