Help! How to implement accurate attack in client-server RPG?,
Members - Reputation: 110
Posted 02 November 2012 - 09:37 PM
1. Player1 at position A in server.
2. After 100ms, Player2 see Player1 at position A, but Player1 moved to position B in server side.
3. Player2 attacks Palyer1 at position A.
4. After 100ms again. Server receives attack packet, But Player2 moved to position C, if Player2 attacks Player1 at current position C, the hit will always miss.
I need estimate attack time:
Command Execution Time = Current Server Time - Packet Latency - Client View Interpolation
This formula from:
But how can I get Packet Latency and Client View Interpolation?
I read the unity network demo of TPS-Auth. I think Client View Interpolation should be equal to fixed time + Client Latency.( GraduallyUpdateState.cs m_InterpolationBackTime property)
Moderators - Reputation: 10314
Posted 03 November 2012 - 10:31 AM
A third option is to realize that 100 milliseconds is really hard to tell for most players -- it's a very small amount of time! You can show the attack on the attacking player's machine, but you only need to show the "hit or miss" after you get the data back from the server on how it went. Many FPS-es do this by showing guns firing right away, but showing blood spurts or whatever from the target only after the server has sent a hit-detect message back.