Okay so, if high latency is in play while making a game, this is the best way (in my opinion) to resolve it (backtracking). Basically, we store records of the previous position, angle, and other misc information that might affect game play if it is not also backtracked in time. Then when the enemy is being interacted with or shot at (simulated by pressing left mouse), we restore one of our stored records. This will reverse them in time to match up with the server information. This is the WORST case scenario, where our scratch cat is at 200 ms ping, moving at full speed consistently, and we are shooting the LAST record that we could shoot at without going over the 200 ms mark. 200 ms (milliseconds) is the maximum ping that any lag compensation will compensate for, or else it will begin to affect game play. There is also something defined in the Source Engine about "Teleport Distance", which is 64 hammer units. This is so if someone were moving extremely fast, it would not backtrack them the past that distance. The reason why we make a record ever 0.053 seconds is because of limitations in the source engine that I just copied over. This basically assumes that the tickrate of the server is 64, and the max tolerable ticks is 12 when backtracking (so do 64/12 and other math stuffz). Doing {record_index - record_count - 2} is my personal preference, you restore any record that you have stored, which means at any position too. I am also quite sure I have done this wrong, because it your limit is 200 milliseconds, but this might be creating usable records every 200 milliseconds instead. IDK, you get the point.
Backtracking demonstration by @-Blazed- Thanks to @Java_Programmer for the mouse click script. This was based from: https://github.com/ValveSoftware/source-sdk-2013/blob/master/mp/src/game/server/player_lagcompensation.cpp Note: The record trails would not be visible to any player if this was being used practically, but they are here for demonstration purposes. The spinning and moving cat is also just in place of the player that you want to lag compensate, I am just showing off the restore. The execution of this idea may also be buggy, so feel free to make your own version. (P.S. you would also want to store and restore tick count if your game had such a thing) Edit: Okay, I started playing with backtracking in the source engine practically, and it seems that it only REGISTERS HITS on the records. It will only restore their position once they die. There is also a "teleport distance", where it won't backtrack you if you move 64 units between ticks (I don't simulate this, so if they move very quickly you can backtrack them very far.)