Enhanced flares

Workshop for all Mission Engineer Comrades. Home of the FA Mission Making Template.
Post Reply
Pooter
Host
Posts: 117
Joined: Tue Jul 28, 2015 2:26 am

Enhanced flares

Post by Pooter »

So we all know that UGL flares are a bit weak. It may be realistic, but it's not particularly good gameplay.

To this end I looked into enhancing the UGL flares and came up with the following script:
http://pastebin.com/Hq6tx5SR

This attaches a point light to the flare that appears and disappears at roughly the same time as the flare itself.
The brightness of the flare, as well as its duration, color, and attenuation (how quickly the light disappears) are all in global variables so they can be changed mid mission if necessary.


The attenuation is probably the most important factor, but also the hardest to get right. The function takes parameters in in the form of [start dist, const coefficient, linear coefficient, quadratic coefficient, hard limit start, hard limit end].
startDist is the dist at which the light will start to dim. I have set to 1 (meter).
the coefficients are the harder ones. The constant coefficient will affect all light outside the start distance equally, while the linear and quadratic affect the light more as distance goes on. If you want the light to be concentrated set the quadratic coefficient high.
The hard limit start and end we can mostly ignore as a setting of 500,700 works just fine.

Notes:
This only affects UGL flares not mortar or starter pistol flares.
If you extend the duration of the supplemental light beyond the lifetime of the flare then the light will not continue to fall, it will sit in position.
Be careful with the attenuation, as you can accidentally make a beacon of light ( http://steamcommunity.com/sharedfiles/f ... =513868925 )
The attached light is actually hovering 0.5m above the ground to increase their effectiveness while on the ground.

I would attach pictures, but they can't really convey the changes, take a look at enhanced_flare_test_v5 and change flareBrightness and flareAttenuation.

I intend to use these to redo spoopy swamp (along with two dozen other changes).
Last edited by Pooter on Wed Sep 09, 2015 10:43 pm, edited 1 time in total.

User avatar
Eagle_Eye
Posts: 209
Joined: Wed Feb 11, 2015 2:35 am
Location: Cork, Ireland

Re: Enhanced flares

Post by Eagle_Eye »

Very, very nice Pooter.

This is something that I always believed could only be done with proper modding, so hats off to you if you can get it to work in an efficient manner during missions.

This will go a long way toward making the swamp mission a more enjoyable experience. That being said I dont think its the only issue to address in that mission. One that I meant to mention in the mission thread is that rangefinders with NVG function are not particularly overpowered, but can really be a nice addition to give us a little bit of breathing room.

User avatar
wolfenswan
Posts: 1209
Joined: Wed May 25, 2011 4:59 pm

Re: Enhanced flares

Post by wolfenswan »

1. You can filter nearestObjects for specific types, saves you from iterating through the results and ignoring the non-flares. If that doesn't work try filtering nearestObjects with isKindOf.

2. You prob. want to use createVehicleLocal for the lightpoint, otherwise you create it globally every time the function is called.
I know of no way to detect what color the flare is, so all of the supplemental lights are the same color (currently white).
You use BIS_fnc_inString to check the class name of present flares for their color. Possibly config crawling too.

Pooter
Host
Posts: 117
Joined: Tue Jul 28, 2015 2:26 am

Re: Enhanced flares

Post by Pooter »

wolfenswan wrote:1. You can filter nearestObjects for specific types, saves you from iterating through the results and ignoring the non-flares. If that doesn't work try filtering nearestObjects with isKindOf.

2. You prob. want to use createVehicleLocal for the lightpoint, otherwise you create it globally every time the function is called.
I know of no way to detect what color the flare is, so all of the supplemental lights are the same color (currently white).
You use BIS_fnc_inString to check the class name of present flares for their color. Possibly config crawling too.
1. Tried that, this was the only way I found to get it to work, I'll fiddle with it again later.
2. It doesn't actually matter for lights, they are only created locally.
All the strings I could find for the flare object didn't include any reference to their color. Maybe I can get the color from the fired handler.

Pooter
Host
Posts: 117
Joined: Tue Jul 28, 2015 2:26 am

Re: Enhanced flares

Post by Pooter »

Updated the script, removed the nearestObjects call and added colors for the flares.

Pooter
Host
Posts: 117
Joined: Tue Jul 28, 2015 2:26 am

Re: Enhanced flares

Post by Pooter »

Why must BI make this all so complicated...

So Enhanced flares v1 (and v1.1 and v1.2) failed. Looked great on my machine, but had variable brightness when viewed with different settings of dynamic lights. Because somehow BI thought that was acceptable.

With that in mind I set out to get create a v2 that did not have this drawback.

The problems with flares comes in 2 parts:
1. Flares on their own aren't bright enough.
2. Once a flare hits the ground its brightness goes down so far as to be useless.

I solved part 1 by making each flare effectively a cluster flare.
I solved part 2 by making flares on the ground hover 1m over above the ground. The effect is a little weird if you're right next to them, but it works.


I'll have a new version of Budget Issues and Spoopy Swamp ready some time tomorrow.

Post Reply