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 to include these lines:

multiplayer_draw_teammates_names 1
mouse_acceleration 95
multiplayer_hit_sound_volume 1

Run your server. Done.

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.



