My attempt to fix darktides server input lag, with mods (Latency Compensatoin)

hello everyone! just wanting to show off the mod i have been working on. this mod is still in development, but there is enough here to be helpful to the players on high ping already.

for a brief overview of how this mod works, so you can get an idea of it’s capabilities

this will only apply to 4 enemies in the game, pox buster, mutant, trapper, pox hound.

i grab the enemies/players location, velocity and health data which is sent by the server
this is the only “real” data i am working with, and unfortunalty it is to blame for any “incorrect predictions” the mod creates

from this point, i need to “assume” or guess “which player the enemy may be targeting” right now this includes modes such as, “closest player” and “always you” i plan on adding a smart targeting mode in the future, which will be a per enemy attempt to predict the correct target, based on how the enemy does target selection. but without actual server data, it is impossible to be 100% accurate

after getting a target and player, i create a nav bot at the enemies location, and tell the nav pot to path find to the player, this is essentially using the games own code, to generate a path for the enemy to the player.

this means the code will work when enemies are “about to walk around a corner” which is the main problem with, anticipating that you need to do something on high ping “not knowing the enemy exists in the first place”

positoin prediction is then a simple question of, how fast the enemy is traveling, what is your latency to the server, and how far along the nav path should the prediction to be placed.
theirs a bit more to it relating to server tick rate, animation interpolation etc. but i don’t want to get into nitty gritty detail, just know that i have offset all predictions by about 100ms into the future to help account for this.

animation prediction is slightly different. right now, only applies to trappers, as they are, by far, the worst thing to dodge in dark tide while playing on high ping.

trappers do a 833ms wind up animation before firing the net, this is actually a god send while doing lag compensation because i can detect this animation early, then create a visual representation of the net before it fires.

not all wind up animations = net firing however, so i do have some logic to detect when the wind up animation is canceled, which will delete any existing prediction and reset the code.
this means, worst case scenario, you may randomly see a net prediction that never got fired due to, the trapper being staggered, killed or otherwise.

link to the mod can be found below

https://www.nexusmods.com/warhammer40kdarktide/mods/702

along with a video showing how the mod works

i am only new to modding darktide. so if anyone has knowledge on how i could make this mod better. please let me know. the main things i am interested in are,

getting enemy target data from the server, and getting nav paths from the server. again as far as i am aware the server does not send this data since all path finding is done server side. but i know that getting the target data alone is, quite a small piece of information for the server to send, that would drastically reduce the complexity of this mod, and increase the mods accuracy.

(if a fat shark dev sees this, first please fix your servers, but failing that, please send me the target data for enemies, even if it is just a small set of problematic fast moving, or dodge related enemies, my main issue is enemies such as the mutant who have sticky targeting, they lock on to a target and then rush past the entire team to get to that one player. having targeting data for the pox bomber would be helpful as well. but there targeting logic is close enough to just “closest player” that it is not a big issue.
i don’t even need this data that often, if i could for example get the enemies current target data every 500ms or even once per second, that is still a massive improvement for this mod.)

alternative ways to display the predicted positions location, rendering a clone of the enemy, moving the visual position of the enemy. stuff like that
i know i may be able to show png in game if i host them online somewhere, so i could explore doing that

9 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.