I'm creating an online game (2d platformer) and I'm having some trouble understanding what to send clients. I'm sampling each player's input and sending it to the server after a set amount of time. The input is then sent to other clients, while the position is sent to the local player (since that client is already aware of inputs).
This is all fine. However, everything I have read about online games has said to only send the position of the player. How do I inform clients about the actions the player took?
For example, if player A uses a dash skill, I need to render that on client B, and accelerate the player at that time. I could send client B data about the position and physics state before and after the skill was used, as well as the name of the skill, but isn't that overkill? It seems easier to me to simply send input data. Something like this: [{key: right, time: 5}, {key: dash}].
One problem with this though is if I'm sending the data using UDP, client B will not render the player's skill if the packet is lost, unless I send the information until client B has inform the server it has been seen, but surely that defeats the purpose? Should I be using TCP for crucial information such as player abilities?
And if sending just position data, how does one deal with acceleration? Wouldn't I have to send the physics state of the player as well? Do other games do this, or do they just interpolate positions instead of calculating the momentum of other entities?
I'm not sure if I'm missing something but if someone could help me understand how I need to go about updating clients I would really appreciate it.