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:17


Comments: (4)
Rating:



 



TPW Houselights - automatic house light addon A2 - Singleplayer

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:
At startup the script scans all houses within a 20km radius of the player, and any enterable houses are placed into a houses array.
Each house in the array is then given its own set of lighting parameters, and a lit/unlit status. If the sun is below the horizon, then every 15 seconds the houses array is scanned, and any unlit house within the player's specified radius has a light source created using the lighting parameters associated with that house. Any lit house outside the radius has its light removed.


Installation / Usage:
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/scripts/tpw_houselights109.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.sqf";


Included .pbo files:
tpw_houselights_109.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.

The addon works in SP and MP (but not on a dedicated server). Owing to the various randomisation features of the script, different MP players may see different lights even if at the same location on the map. If you are playing MP and require all players to see the same lights at the same point on a map, then please use the MP version of this addon. 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. You may need to adjust the settings if you find your performance suffering.

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.09
- Minor tweaks, Arma3 compatibility.

v1.081
- fixes a config error in this addon version.

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