stjobe, on 15 January 2013 - 09:41 AM, said:
It's important to realize that this state rewinding is for hit calculation purposes only, it has no bearing at all on where your 'mech is or seems to be in the game, nor where your target is or seems to be.
Basically, as others have said, when you pull the trigger and send a "fire!" command to the server, it checks where you and your target was at the time of firing and whether your shot would hit. AFAICT it doesn't move either you or your enemy around at all, that's another piece of code that's responsible for that.
Yep - the hope is that your client will have done a good enough job of drawing the target where it should have been so that you don't have to aim in front of it to hit it. On the other hand, since it is still server authoritative, there is no guarantee that where the mech is drawn on the client will actually be where the target is on the server when the shot is fired ... but this should help eliminate the effect of the lag of the target to the server.
If you have a low ping then the target mech should be drawn relatively closely to where the server thinks it is at that moment in time and firing at that position should result in a hit ... though this will depend somewhat on how the server deals with updating positional information from the target mech ... if the target client has a lot of lag the server estimate of its position for resolving fire will lag behind where the target's client thinks it is ... a key element to this technique will be how the server updates the target mech position when resolving fire.
Positional data on the server is essentially a set of discrete points along a time line ... updated with a specific frequency. Variable lag causes the spacing of these points to vary. The algorithm the server uses to connect these dots will be crucial in getting this technique to work ... especially since the server estimated position of a lagged mech just before a positional update is unlikely to agree with the actual reported mech position in that update. The client on the firer is likely displaying the same estimated mech position as is calculated on the server ... but when the positional update of the target arrives on the server it may change the actual position of the target going back along the time line depending on the implementation.
The choices would appear to be ...
1) The server calculates the target mech position based on last reported position + prediction ... this is used by both the firing client and the server to determine hits ... actual target position doesn't matter until the next update from the target client. This will make mechs with high lag more vulnerable to fire and will eliminate the benefits of intentionally adding lag to make yourself harder to hit.
2) The server updates the mech track every time new positional data becomes available and interpolates backward in time to connect the dots. In this case, the firing client drawing of the mech position may be less accurate and it may be harder to register a hit.
Its a knotty problem any way you look at it .. presumably, they already have code that given the mech position and facing determines the details of hits and the key element here is coming up with an algorithm to determine the positions of the firing and target mechs at the moment the fire button is pressed ... and making this determination as close to the client side representation as possible while still be server authoritative.