1 Attachment(s)
[Release] Halo No Lead Fix (Server-side)
Server-side No Lead Fix. For haloceded.exe v1.09 ONLY.
I can't believe it has been over a year since I posted the original idea thread!
I am sorry that I have not got around to trying this sooner but oh well... here it is!
Source is included. It was written as quickly as possible, so it is not well organised, but hopefully the community will benefit more if it is released.
Code:
Halo Lag Compensation Tool
==========================
By PaulusT
==========
This tool prevents or reduces the "leading" that is required in Halo.
It is for Halo Custom Edition 1.09 dedicated server.
First posted to:
modacity.net/forums/showthread.php?24803-Release-Source-Halo-Lag-Compensation-Tool
Installation
============
Place all files and folders in "release" into the directory of haloceded.exe.
E.g.
...
plugins/
haloce.exe
haloceded.exe
winmm.dll
winmm.pdb
...
Setup
=====
Edit your init.txt file for the server (e.g. init_server.txt) to include these lines:
multiplayer_draw_teammates_names 1
mouse_acceleration 95
multiplayer_hit_sound_volume 1
Run your server. E.g. haloceded.exe -exec init_server.txt
Done. Players can now join your server.
Explanation
===========
When player A directly shoots player B, it will usually miss
because by the time the message has reached the server, player B has moved.
This tool will cause the hitbox of player B (and all players) to lag behind
so that player A's shot will hit without player A having to lead.
A similar technique is used in Source games, like Team Fortress 2,
Counter Strike, etc.
The hitbox of player B will lag by the following number of milliseconds:
Ping of player A * multiplayer_hit_sound_volume + mouse_acceleration
The technique is not perfect and the formula will almost certainly need to be tweaked.
The defaults I have provided above have worked OK in my limited testing:
i.e. Ping of player A + 95
Please check back at
modacity.net/forums/showthread.php?24803-Release-Source-Halo-Lag-Compensation-Tool
for updates and the best values to use.
If multiplayer_draw_teammates_names is true, then the average of player A's ping
over the last 10 seconds (sampled once per second) is used,
instead of player A's current ping.
The maximum lag amount is about 2 seconds.
Limitations
===========
This is just a quick hack, but it should fairly be stable.
However, you will still need to lead players in vehicles in this release
(but this can be fixed quite easily I think).
Also, crouching, other animations, rotation
and probably some other things I am forgetting are not taken into account.
I am not sure about how to handle animations.
Source
======
The source is included. The license is the GPLv3. It is a quick hack (sorry!).
Please feel free to incorporate into your own projects.
Please credit PaulusT. Perhaps include a link to:
modacity.net/forums/showthread.php?24803-Release-Source-Halo-Lag-Compensation-Tool
If you use this, please post to the above thread to keep the community in the loop.
winmm.dll
=========
winmm.dll is just a dll loader. It loads all dlls in the "plugins" directory
into the Halo client and Halo dedicated server.
It seems to work OK in Windows 7 and I assume it will work fine for others too.
If not, you can use any other dll loader to load HaloLagCompensation.dll
into the dedicated server.
HaloLagCompensation.dll unloads if it thinks it is loaded into the Halo client,
so your Halo client should not be affected.
If things do go wrong, just delete winmm.dll from your Halo directory.
Thanks
PaulusT
Edit: A few extra points that I forgot to explain!
Who can use this?
This is a server-side fix. So, this will have no effect if you load up your Halo client and connect to a random game. You must start haloceded.exe and then join that server, or join someone else's server that is definitely running the tool. Clients do not need the tool.
Parameters
In order to get this tool released ASAP, I have used the following redundant server-side variables as parameters:
- multiplayer_draw_teammates_names (is the "use average ping" parameter)
- multiplayer_hit_sound_volume (is parameter M below)
- mouse_acceleration (is parameter K below)
The M and K parameters are constants that can be adjusted. The hitbox of player B (in the README example) is lagged by:
ping of player A * M + K
Thus, you will need to try different values of M and K. I have given some defaults in the README above. You must set the server-side variables as explained in the README or the tool may not work. Please report the values you used.
Testing that the tool works
I failed to provide any feedback as to whether the tool is actually working! (It should just work, as long as you have the parameters set and are using the 1.09 custom edition dedicated server). However, for now, you can do the following:
- Check that HaloLagCompensation.dll has loaded into haloceded.exe. You can use a tool like Process Explorer. Open Process Explorer, click the haloceded.exe process to highlight it, view DLLs (Ctr+D) and then find HaloLagCompensation.dll in the lower pane.
- At the server console, do:
- multiplayer_hit_sound_volume 0
- mouse_acceleration 2000
- Now, you should be able to shoot at "where players were 2 seconds ago" and still get hits. I.e. reverse leading. E.g. Player B stands still. Then player B runs away. Then immediately, player A shoots at where player B was when they were standing still. Player B should still take damage.
If it does not work
Please report:
- Version of haloceded.exe that was used. This MUST be the real v1.09.
- Whether Process Explorer shows that HaloLagCompensation.dll was loaded in haloceded.exe.
- The values of the parameters. I.e. go to the *server console* and type:
- multiplayer_draw_teammates_names
- multiplayer_hit_sound_volume
- mouse_acceleration
- ...and tell us what values were output to the console.
Thanks!
Re: [Release+Source] Halo Lag Compensation Tool
Hawt. I thought it was a hoax because nothing came out of it, but this is pretty cool.
Just played a few games, didn't even notice it and did pretty good.
Wait, this works for clients, right, or was that just placebo?
Re: [Release+Source] Halo Lag Compensation Tool
Ping of player A * multiplayer_hit_sound_volume + mouse_acceleration
Wait what?
Edit
Why are you looping through each player twice? You grab the playerPossses[j] and playerVels[j] and then you loop again and restore. Cant you do it all in the one loop? Why cant you just do this?
Code:
...
playerHistories[j].readDataIntoPlayer(ping * (*hitSound) + (*mouseAccel),otherPlayer);
otherPlayer->World = playerPosses[j];
updatePhysics(otherStaticPlayer.CurrentBiped);
...
Also, just fyi, putting methods into a header file is bad practice :)
Re: [Release+Source] Halo Lag Compensation Tool
I tested this out with a couple of players and verified that it was indeed loaded but sadly it didn't seem to offer any improvement to the lead.
I had a similar idea a while back where the basic idea was to snapshot relevant game state every tick and essentially rewind to the relevant snapshot based on the assailant's ping during collision calculations. A crude implementation offered an improvement (not removal, that wasn't the goal and wouldn't be possible given the implementation) in lead and if those who tested it with higher pings are to be believed, it reduced lead down to the level you'd expect with a one/two (33/66) tick delay. The downsides were that you'd occasionally get reverse lead (รก la CS), you'd seemingly die behind cover more frequently if shot by players with higher pings (nothing worse than playing against a player who has host) and it wasn't overly reliable.
Quote:
Originally Posted by
Limited
Ping of player A * multiplayer_hit_sound_volume + mouse_acceleration
Wait what?
Limited has already asked the most obvious question, so out of curiosity, what relevance does the mouse acceleration have and wouldn't using it in any calculations be slightly troublesome given that it varies from player to player?
Anyway, nice to see somebody still working on this, even if it is a bit of a dead horse. ;)
Re: [Release+Source] Halo Lag Compensation Tool
Would love to see any kind pf process when it comes to the terrible netcode Halo has.
It's really a shame that no one at Microsoft can just sign off on releasing part of the source so the community can fix this.
Re: [Release+Source] Halo Lag Compensation Tool
Ah sorry I should have been clearer about a few things! I will edit my first post as well.
Quote:
Originally Posted by
Ryx
Wait, this works for clients, right, or was that just placebo?
Sorry I should have explained this. This is a server-side fix. So, this will have no effect if you load up your Halo client and connect to a random game. You must start haloceded.exe and then join that server. Clients do not need the tool.
Quote:
Originally Posted by
Limited
Ping of player A * multiplayer_hit_sound_volume + mouse_acceleration
Wait what?
Sorry again!
The formula for lagging player B's hitbox should be:
ping of player A
That's it. However, we do not live in a perfect world! There appears to be some additional latency. So the formula is perhaps something like the following:
ping of player A * M + K
(where M and K are some constants).
In order to get this tool released ASAP, I have used the following redundant server-side variables as parameters:
multiplayer_draw_teammates_names (is the "use average ping" parameter)
multiplayer_hit_sound_volume (is parameter M above)
mouse_acceleration (is parameter K above)
These variables normally have no effect (for the dedicated server). These must be set up as described in the first post, otherwise the tool will not work as expected! You may need to tweak these values to get it right. I will edit the first post with more details.
Quote:
Originally Posted by
Limited
Why are you looping through each player twice? You grab the playerPossses[j] and playerVels[j] and then you loop again and restore. Cant you do it all in the one loop? Why cant you just do this?
Code:
...
playerHistories[j].readDataIntoPlayer(ping * (*hitSound) + (*mouseAccel),otherPlayer);
otherPlayer->World = playerPosses[j];
updatePhysics(otherStaticPlayer.CurrentBiped);
...
Sorry I should have given a brief description of the code! It is not well organised. However, the reason there are two loops is because we are doing the following:- For each "object update" at every step (this is the dUpdateObject function):
- Find out if this object is "owned" by a player i.e. if this is a bullet fired by a player (this is the first loop). If so...
- Move all *other* players back in time (this is the first nested loop).
- Update the object now, while all players have been moved (this is the call to oUpdateObject).
- Move all *other* players forward in time, back to their actual positions (this is the second nested loop).
So, the implementation does not really lag the hitboxes behind. It actually moves players back while updating objects like bullets. It then moves them forward before any further processing, so the "moving" only affects collisions with e.g. bullets. Does that make more sense? As I said, I have hacked away ASAP to get this out and the code is not well-commented.
Quote:
Originally Posted by
Limited
Also, just fyi, putting methods into a header file is bad practice :)
Hehe ah yes, I am guilty of doing that while prototyping! :) And as I have said, this is definitely one of those times! On the other hand, the classes (all two of them!) are templates, so I believe in this case it is quite common to leave the definitions in the header file (although perhaps not inline). The almighty C++ faq shows that this is not required though. Of course, whether these classes really need to be templates is also debatable!
Quote:
Originally Posted by
Btcc22
I tested this out with a couple of players and verified that it was indeed loaded but sadly it didn't seem to offer any improvement to the lead.
Ah this is disappointing. You have made me realise that I should have had an indicator showing that the tool is actually activated and working! Perhaps with the above explanations, you can verify what values you are using for the parameters? This might have been the problem. I will also add some instructions to the first post about testing the tool.
Note that I have tested this on my system with haloceded.exe v1.09 and it was definitely working. However, we still need to figure out the best parameter values by testing with a range of different pings. Even then, the parameters may even need tweaking per client, but hopefully it will not come to that (this is not possible in this first release).
Re: [Release+Source] Halo Lag Compensation Tool (Server-side)
That's pretty cool, looks good. Does the call to updatePhysics force the engine to recalculate the hitbox etc?
Re: [Release+Source] Halo Lag Compensation Tool (Server-side)
Impossibruuu!!!
J/K sounds really good. This would be helpful for new players who have no idea how to lead. Would probably make all our lives easier too. Will test when I get the chance.
Re: [Release+Source] Halo Lag Compensation Tool (Server-side)
Also, I stuck this thread since any progress in this area is awesome.
Re: [Release+Source] Halo Lag Compensation Tool (Server-side)
Quote:
Originally Posted by
urbanyoung
That's pretty cool, looks good. Does the call to updatePhysics force the engine to recalculate the hitbox etc?
Yes that is the idea. Trial and error was used, so I don't know exactly what the function does.
Quote:
Originally Posted by
Cortexian
Also, I stuck this thread since any progress in this area is awesome.
Awesome!
Quote:
Originally Posted by
Cortexian
I have a server running this called "
LancersEdge.net NoLag" if you guys want to try it and compare it to my other two servers.
Paulus, if you wish I can give you FTP and access to a web control panel that will let you have full control over the server. It will allow you to host a server on a fairly snappy internet connection and test revisions.
Amazing! That is very generous! Feel free to PM me the details.
I just played on the server. It was pretty good, but it looks like the parameters definitely need tweaking. What are they set to? (Assuming I get access, I will try tuning them. In fact, this is the probably the only thing I'd like to experiment with in the short-term.)
Thanks again.