Author: tpw
Author Website:

Requirements: Community Base Addons

Version: 1.09
Signed: Yes

Short description: This addon causes lights to automatically come on in enterable buildings around the player after dark.

Date: 2013-03-22 23:26


Comments: (0)
Rating:



 



TPW Houselights - automatic house light addon A2 - Multiplayer

by
tpw


Description:
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
    Stratis
    Takistan
    Tigeria
    Torabora
    Tropica
    Zargabad

If you would like to add your own map or change the lighting parameters, then please use the script version: tpw_houselights-scan.sqf can be used to generate a lighting array for the map, which can then be pasted from the clipboard into tpw_houselights109-mp.sqf.

Or, please let me know via the BIS forum and I can add them into a future addon version.


Installation:
This version works with Arma 2, Arma 2: Operation Arrowhead, Arma 2: Combined Operations and Arma 3.

Addon version:
As we always recommend use modfolders to seperate the custom content from the official game content to prevent problems. For different ways to set up your modfolders and use them please visit our FAQ.

When you are using the Steam version you can find a Steam mod installation and activation FAQ here.

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. The addon version will work for any and every mission.

Script version:
Copy @TPW_HOUSELIGHTS_MP/scripts/tpw_houselights109-mp.sqf to your mission folder, and call it from the init line of the player or the mission's init.sqf with
0 = [] execvm "tpw_houselights109-mp.sqf";


Included .pbo files:
tpw_houselights_109mp.pbo


Media:

Videos by McLupo:


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 around the player, 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.

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.


Personal note:
Due to some significant personal difficulties I basically took a 6 month break from Arma, coding, and computers in general. I'd like to extend a special thank you to Ollem for continuing to work on and extend some of my other coding projects (TPWCAS especially) during this time, and for his support and belief in me.


Credits & 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 write 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.
*Foxhound for dedication to supporting the Arma modding community.
*As always, thanks to BIS for a fantastic piece of software, and for the incredible community on the BIS froum.


Changelog:
v1.09MP
- Minor tweaks, Arma3 compatibility.

v1.08
- Bugfix release

v1.08
- Minor bugfixes, initialisation hint is configurable
- Now comes in SP or MP version

v1.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.

v1.04-1.06
- Not released

v1.03
- Lights can flicker.
- 3 different light types, each fully configurable for brighness, colour and flickering. Miscellaneous improvements.

v1.02
- Not released

v1.01
- Addon version is configurable by HPP file.

v1.00
- initial release


Forum topic:
- BI forums



- Community Base Addons




Enable javascript to be able to download from Armaholic please!



Tags: Lights