TPW HOUSELIGHTS MP
==========================

Version: 1.08 MP
Released: 20120603
Authors: tpw
Requires: CBA
Runs on : Arma2, Operation Arrowhead, Combined Operations

Changelog: 
1.00 - initial release 20120510
1.01 - Can now be configured from hpp file. Lights are removed from houses after player leaves area.
1.02 - Not released
1.03 - Lights can flicker. 3 different light types, each fully configurable for brightness, colour and flickering. Miscellaneous improvements.
1.04-1.06 - Not released
1.07 - Total overhaul of code for true dynamic lights. Lights only flicker within a configurable distance of player to save CPU. Distant lights are brighter to compensate for limitations in lighting engine.
1.08 - Minor bugfixes, initialisation hint is configurable
1.08MP - Multiplayer compatible version with light parameters hard coded, so that all players will see the same lights at the same point on a map.  
1.081MP - Bugfix release   

This addon causes lights to automatically come on in enterable buildings around the player after dark. It will work on any map with ALICE2 compatible enterable buildings, and will simply ignore unenterable ALICE buildings. Sick and tired of villages being pitch black after dark? This addon will create a flickering glow from houses at night which greatly increases immersion. 


How it works:
-------------
Unlike the single player version of this script which dynamically calculates light parameters for any map each time it is initialised, this MP version has hard coded house and light parameters. These parameters are simply a (very large) array of arrays of position data for each house, with the lighting parameters for that house. Depending on the map, the appropriate array is processed and the final array of lightable houses generated for the script to use. Every player using this script will see the same lights at the same spot on the map. No synchronisation necessary. 

I've set it up with house data from some of the most common maps with enterable buildings:

Aliabad
Clafghan
Fallujah
Fayshkhabur
Hazarkot
Lingor
Qom
Sangin
Shapur
Takistan
Tigeria
Torabora
Tropica
Zargabad

You are welcome to use the script version of this addon if you require MP compatible houselights on islands not in this list. Or please let me know via the BIS forum and I can add them into a future addon version.

Shortcomings:
-------------
The addon requires CBA to launch properly. If anyone knows of a way to convert a simple script into a PBO in a way that does not require CBA then I'd like to know about it.

This version of the addon works in SP and MP (but not on a dedicated server). Because the randomisation of lights, brightnesses, colours and flickering has been precalculated,different MP players will see the same lights at the same location on the map. However, each player is required to run this addon inidividually. The CPU and network overhead, and my coding inability, prevents me from implementing true light source synchronisation. You are welcome to examine the heavily commented code to see if there is a way a dedicated server synchronised MP solution is achievable. 

Light sources don't seem to stress the engine too hard, but flickering light sources can. Default settings put lights into 30 or fewer houses, with 5-6 of them flickering. This version of the addons does not easily allow changing of light parameters, in the interests of a uniform experience betwen players. If you require configuration, please either use the script version of this addon, or use the SP version.


How to use it:
--------------
Install: Copy the @TPW_HOUSELIGHTS_MP modfolder to your preferred mod location, and call it via command line or mod launcher. You must also copy userconfig/TPW_HOUSELIGHTS/TPW_HOUSELIGHTS.hpp to your Arma2 userconfig/TPW_HOUSELIGHTS/TPW_HOUSELIGHTS.hpp. This config file can be edited to taste and is well commented, so it's easy to change appropriately.


Feedback:
---------
I'm a shit coder and no doubt this can be improved. I would value any feedback and suggestions, so give me your 2 cent's worth on the BIS forum.

Thanks:
-------
*Das Attorney for showing me how to create PBO addons, and for general advice. 
*CarlGustaffa for his excellent azimuth code. 
*Rydygier for his inspiration to right my own flickering code.
*RogueTrooper for improved enterable building code.
*Xeno for config and server advice.
*Demon Cleaner and Muzzleflash for code optimisation and cleanup.
*Twistking for excellent suggestions re light source uniformity for MP.

As always, thanks to BIS for a fantastic piece of software, and for the incredible community on the BIS froum. 

tpw