Home » MODDING HQ 1.13 » Flugente's Magika Workshop » New feature: dynamic (flash-)lighting
New feature: dynamic (flash-)lighting[message #318629] Sat, 04 May 2013 01:15 Go to next message
Flugente

 
Messages:3309
Registered:April 2009
Location: Germany
dynamic (flash-)lighting

As I can't stand cuddly bears crying in the dark, I added dynamic lighting to the game. How dynamic it is really depends on wether I caught all relevant spots, so don't expect wonders.

Basically, every item can now be defined to be a flashlight. A flashlight has the ability to light a few tiles in front of the merc who has the thing in his hands. I update the lighting to his movements, thereby creating (more or less convincing) the illusion that the light source moves.

Flashlights need batteries to work (they drain relatively slow). They can be turned on and off via item transformation. Only those items in your hands that are flashlights/have flashlight attachments and have batteries are considered to be on - only they will make light. Flashlights also don't work on the surface during the day, because there is no need to.

http://www.youtube.com/watch?v=Xad0Trvl1_A&feature=youtu.be[/video]
This video shall serve as demonstration.

Take special note of the fact that Raider only sees the enemy when the light is on, and that the flashlight does not go through walls.

The only new tag in Items.xml is , an UINT16-entry. Items that have a value > 0 are considered flashlights, this is also the range in tiles that the light shines.

This is in the trunk as of r6061 and GameDir r1667. Useable flashlights are the Rifle LAM-Flashlight Combo and the new Flashlight item (#1636), which also works as a melee weapon (remember, anything can be a flashlight, including attachments).

Note that there may still be some instances that should cause a light redraw but don't - please notify. This is actually the hard part.

And before you ask: No, I will not make flashlights work out of the inventory. 'Cause its uncool. :armsfolded:


Re: New feature: dynamic (flash-)lighting[message #318631] Sat, 04 May 2013 01:21 Go to previous messageGo to next message
tais

 
Messages:809
Registered:February 2008
Location: NL
Leave something for the other coders plz...


Re: New feature: dynamic (flash-)lighting[message #318636] Sat, 04 May 2013 02:00 Go to previous messageGo to next message
sidew

 
Messages:50
Registered:June 2012
Surprised

After seen the video I lost my mandible....

[Updated on: Sat, 04 May 2013 02:00] by Moderator

Re: New feature: dynamic (flash-)lighting[message #318637] Sat, 04 May 2013 02:51 Go to previous messageGo to next message
Toneone

 
Messages:383
Registered:October 2008
Location: Germany
I...I think I'm in love with you. Very Happy
Re: New feature: dynamic (flash-)lighting[message #318643] Sat, 04 May 2013 07:07 Go to previous messageGo to next message
sevenfm

 
Messages:1532
Registered:December 2012
Location: Under the Mountain
Great! Flashlights with batteries are cool.
One thing is unclear for me:
camo/stealth penalties when on/off?



Re: New feature: dynamic (flash-)lighting[message #318644] Sat, 04 May 2013 08:19 Go to previous messageGo to next message
Hawkeye

 
Messages:1753
Registered:October 2005
Location: Australia
Could this be added to light emitting objects in game? Such as lamps outside a doorway, which could be shot to shroud it in darkness?

Perhaps it would pave the way for searchlights used by the enemy?


Re: New feature: dynamic (flash-)lighting[message #318646] Sat, 04 May 2013 11:16 Go to previous messageGo to next message
sevenfm

 
Messages:1532
Registered:December 2012
Location: Under the Mountain
Turning light on and off in closet?


Re: New feature: dynamic (flash-)lighting[message #318647] Sat, 04 May 2013 11:21 Go to previous messageGo to next message
grim

 
Messages:307
Registered:July 2006
Location: France
Flugente, you're a marvel!
Re: New feature: dynamic (flash-)lighting[message #318649] Sat, 04 May 2013 12:45 Go to previous messageGo to next message
batanen

 
Messages:24
Registered:May 2013
Nice feature! May the enemies counter-attack you when you flash the light in front of them? Do they also get advantage of seeing further if your flashlight is on / can they use the flashlight feature too by night?
Re: New feature: dynamic (flash-)lighting[message #318650] Sat, 04 May 2013 12:58 Go to previous messageGo to next message
Headhunter

 
Messages:268
Registered:November 2009
Location: Sweden
Cool stuff! How long is the step from this to being able to shoot out sentry lights at night? Razz

Did you change the regular night-time vision range?
Re: New feature: dynamic (flash-)lighting[message #318651] Sat, 04 May 2013 13:08 Go to previous messageGo to next message
anv

 
Messages:232
Registered:March 2013
Wow, that's absolutely amazing!

Just imagine: pitch black night, enemies with flashlight patrolling the area, your mercs frantically run from one tree by the road into the shadows of another, to hide from the light. May totally turn a stealthy approach upside-down.

Or going into the crepitus lair and having to choose between turning the flashlight off and fighting in the dark, or actually see something in the front of you but becoming a walking target, as flashlight betrays your position.

Or preparing for massive Drassen counterattack at night by giving Biff, Flo and other C-list guys flashlights, and positioning them in the direction of an anticipated attack, while militia and your pros can take potshots at clearly visible enemies from the safety of the shadows. Possibilites are endless! Very Happy


Re: New feature: dynamic (flash-)lighting[message #318653] Sat, 04 May 2013 13:42 Go to previous messageGo to next message
Thor

 
Messages:431
Registered:February 2007
Location: Belgium
Indeed, great feature with new tactical options! Thanks, man!

Btw, the only place we can get this is Depressive Brot's link, right? Does anybody know why there isn't any .exe build on SVN anymore? Was a lot easier Smile
Re: New feature: dynamic (flash-)lighting[message #318654] Sat, 04 May 2013 13:47 Go to previous messageGo to next message
DepressivesBrot

 
Messages:3807
Registered:July 2009
Because those things are outdated and behave oddly way too fast seeing the speed with which Flug adds stuff. And apparently nobody wants to add all the builds everytime they commit some small code change.


Re: New feature: dynamic (flash-)lighting[message #318656] Sat, 04 May 2013 14:11 Go to previous messageGo to next message
Thor

 
Messages:431
Registered:February 2007
Location: Belgium
Alright. Thanks for the quick answer. Wink Also for your initiative with the .exe and the complete downloads. Because, like you say, it's not always easy to match the SVN build to the right game .exe.

[Updated on: Sat, 04 May 2013 14:59] by Moderator

Re: New feature: dynamic (flash-)lighting[message #318659] Sat, 04 May 2013 16:14 Go to previous messageGo to next message
merc05

 
Messages:78
Registered:January 2013
Fantastic feature! Even more so when I was deliberating using flashlights in my mod. Thanks a lot Flugente!

Since we don't have pics for handheld flashlights, here:
http://imageshack.us/a/img694/9366/flashlightja.png http://imageshack.us/a/img339/2197/flashlightjam.png http://imageshack.us/a/img404/8178/flashlightjas.png

Or maybe something bigger to pound heads Smile :
http://imageshack.us/a/img9/701/flashlightbatonja.png http://imageshack.us/a/img442/2684/flashlightbatonjam.png http://imageshack.us/a/img401/6344/flashlightbatonjas.png

http://www.mediafire.com/download.php?6vhvnj4k3esuey1
Re: New feature: dynamic (flash-)lighting[message #318662] Sat, 04 May 2013 16:45 Go to previous messageGo to next message
Wil473

 
Messages:2830
Registered:September 2004
Location: Canada
merc05
Or maybe something bigger to pound heads Smile


I'd suggest making it a tad shorter - specifically sizing the interface graphic to fit the small pocket. I'm thinking something the size of a helical magazine would be more handy as an ad hoc club. Guess, what what items will be added to the next revisions of AFS/DL-1.13/UC-1.13...

[Updated on: Sat, 04 May 2013 16:47] by Moderator



Re: New feature: dynamic (flash-)lighting[message #318677] Sat, 04 May 2013 21:21 Go to previous messageGo to next message
Maalstroom

 
Messages:343
Registered:December 2008
Location: en route to San Hermanos
We should be able to attach the flashlight to the helmet! you know, like the miners do.
If the enemies are using the flashlight we should be able to spot them! And if it will be possible to shoot the lamppost ... this game will be, pure and simple, amazing!

Totally awesome feature, as always!
Re: New feature: dynamic (flash-)lighting[message #318678] Sat, 04 May 2013 21:32 Go to previous messageGo to next message
Wil473

 
Messages:2830
Registered:September 2004
Location: Canada
Maalstroom
We should be able to attach the flashlight to the helmet! you know, like the miners do.
If the enemies are using the flashlight we should be able to spot them! And if it will be possible to shoot the lamppost ... this game will be, pure and simple, amazing!

Totally awesome feature, as always!


Yup had the same idea, but having actually worn a miner's lamp during a few summers working in a mine years ago (technically a surface labourer but it was safer to have one attached to my hard hat on at least one occasion), I was thinking more of a climbers/splunker's headlamp. Much more practical as say starting gear for an engineer/technician.
http://www.mec.ca/AST/ShopMEC/HikingCamping/Lighting/Headlamps.jsp

[Updated on: Sat, 04 May 2013 21:33] by Moderator



Re: New feature: dynamic (flash-)lighting[message #318680] Sat, 04 May 2013 21:50 Go to previous messageGo to next message
Sam Hotte

 
Messages:2028
Registered:March 2009
Location: Middle of Germany
Systems for a helmet side mounting seem more versatile to me as you can still use these lamps as handheld flashlights (and probably there might even be systems that allow for rail mounting to a gun as well)
E.g. https://www.rescue-tec.de/Lights/UK-Lights (example is from civilian fire fighting, though)
Re: New feature: dynamic (flash-)lighting[message #318681] Sat, 04 May 2013 21:57 Go to previous messageGo to next message
Wil473

 
Messages:2830
Registered:September 2004
Location: Canada
Will this feature work if the flashlight is attached to the helmet?

Actually before I get too far with the lightweight headlamp graphics, does wearing the flashlight in the face slot run afoul of this restriction?Flugente
And before you ask: No, I will not make flashlights work out of the inventory. 'Cause its uncool. :armsfolded:


EDIT: ...and yes, I guess you're right Sam, they do make RIS for helmets. http://www.optactical.com/oppiad.html

[Updated on: Sat, 04 May 2013 22:09] by Moderator



Re: New feature: dynamic (flash-)lighting[message #318683] Sat, 04 May 2013 23:07 Go to previous messageGo to next message
tais

 
Messages:809
Registered:February 2008
Location: NL
Now we're on the subject of lights, how about construction lights that you can place on the map and that will light up an area...


Re: New feature: dynamic (flash-)lighting[message #318685] Sun, 05 May 2013 00:44 Go to previous messageGo to next message
Maalstroom

 
Messages:343
Registered:December 2008
Location: en route to San Hermanos
Will there be possible to install reflectors ti light in certain directions? Would be very cool to have them triggered by movement.
Re: New feature: dynamic (flash-)lighting[message #318690] Sun, 05 May 2013 03:23 Go to previous messageGo to next message
Flugente

 
Messages:3309
Registered:April 2009
Location: Germany
Sevenfm
One thing is unclear for me:
camo/stealth penalties when on/off?
I did not alter camo or stealth. I simply add or remove light. If one is caught when turning on light, its not because of insufficient stealth, but due to being exposed in bright light.

Hawkeye
Could this be added to light emitting objects in game? Such as lamps outside a doorway, which could be shot to shroud it in darkness?
That has always existed ingame. Streetlights (like in Drassen SAM) emit light at night, but stop doing so when hit with a LAW. I suspect this happens when the structure receives enough damage. Wether or not that can be lowered is very likely jsd-based.

Hawkeye
Perhaps it would pave the way for searchlights used by the enemy?
I assume you mean static searchlights that occupy one tile, which would then be controlled and turned by a merc behind it. This is actually very hard. I did not implement this for some of the same reasons I struggle to implement static MGs:
  • MGs/searchlights need a separate structure. This would have to be creatable to all existing maps. We had a minor breakthrough last summer, when we hacked GENERIC_1 to have up to 65536 entries. This theoretically allows us to have one tileset (that every map uses) that has all structures we'd ever need. Unfortunately, structures spawned this way lack functionality (shadows, door properties etc.) as these are more or less hardcoded.

    Having searchlights being soldiers instead (like tanks) is a bad idea, as this lowers the amount of soldiers per team.
  • This would need more or less continuous interaction of player and structure. We do not have anything like that anywhere. Any continuous functionality that depends on a soldier's animstate is a freaking nightmare to do, as the animstate continuously changes.
Apart from that, creating more light sources like flashlights is no problem.

Sevenfm
Turning light on and off in closet?

As we already have map switches, and can already have action items that use light traps, I suspect this has already been possible, but never tried.
Sevenfm
Nice feature! May the enemies counter-attack you when you flash the light in front of them? Do they also get advantage of seeing further if your flashlight is on / can they use the flashlight feature too by night?
Switching on lights gives everybody the chance to interrupt. As people in bright light are highly visible, they do suffer from that, as they are likely to be interrupted.
Bright light increases visibility of the bright tiles for everbody.
The AI can use that feature, but can't handle it properly. The current AI causes them to back down when they are in front of bright light. They turn around... and now the new tile in front of them is bright too! They basically turn nonstop, rendering them useless. As we now have someone seriosly upgrading the AI, this might be easy to solve once we get to such finetuning.

Headhunter
Cool stuff! How long is the step from this to being able to shoot out sentry lights at night?
As said - already possible with street lamps.

Headhunter
Did you change the regular night-time vision range?
No.

anv
Just imagine: pitch black night, enemies with flashlight patrolling the area, your mercs frantically run from one tree by the road into the shadows of another, to hide from the light. May totally turn a stealthy approach upside-down.
I did a funhack that gave all enemies flashlights once their alarm level rose to red an above. The result was quite impressive: Fire a burst, and suddently flashlights pop up all over the map. Sadly, the current AI cannot handle flashlights on enemies as described above.

@merc05: the current flashlight is supposed to be a 30cm MagLite, which one can also use as a club. Could you alter the pic in that regard?

Maalstroom
If the enemies are using the flashlight we should be able to spot them!
Well yes. When you use flashlight, you are visible too, so you will be noticed easily.

Tais
Now we're on the subject of lights, how about construction lights that you can place on the map and that will light up an area...
Use the map editor (or was your point something different?)

Maalstroom
Would be very cool to have them triggered by movement.
This does not fit the game in my view, and would be very hard to implement, so no.


Re: New feature: dynamic (flash-)lighting[message #318697] Sun, 05 May 2013 05:32 Go to previous messageGo to next message
Wil473

 
Messages:2830
Registered:September 2004
Location: Canada
I quickly did up this from a catalog's tumbnail image of the flashlight you specified Flugente.
http://www.bears-pit.com/board/gallery/80/full/93.png

However when shrunk to 39x23 (medium slot), let alone 29x23 it turns into an indiscernible blob. With your permission merc05, I was thinking that your interface image could be used with this large graphic to represent a 30cm flashlight.

EDIT: Noticed that Merc05's flashlight was a little too long (30x21 pixels). Decided to create my own interface sized for smaller than 29x23, and used a non-Maglite of similar size (30cm/3x C cells) as the base. Ends up very similar to Merc05's - with this few pixels it also no longer gives an impression of being 30cm long.
http://www.bears-pit.com/board/gallery/80/full/94.png

[Updated on: Sun, 05 May 2013 07:12] by Moderator



Re: New feature: dynamic (flash-)lighting[message #318704] Sun, 05 May 2013 12:56 Go to previous messageGo to next message
tais

 
Messages:809
Registered:February 2008
Location: NL
Flugente

Tais
Now we're on the subject of lights, how about construction lights that you can place on the map and that will light up an area...

Use the map editor (or was your point something different?)

Well you already kinda answered this one, I was more thinking of being able to place spotlights/construction lights on the map during the game so you could light up certain parts of the map that you're defending.
But as you said, it's like a static mg emplacement so not possible


Re: New feature: dynamic (flash-)lighting[message #318706] Sun, 05 May 2013 13:38 Go to previous messageGo to next message
Maalstroom

 
Messages:343
Registered:December 2008
Location: en route to San Hermanos
Actually reflectors don't need an operator like the MGs. Reflectors just need to be placed the same way mines/sandbags do. And if there are mines triggered by tripwire networks - this newly placed objects (reflectors) could be turned on the same way mines do. So why not?
Why couldn't we place reflectors in the same way you place sandbags, concertina wire, mines and face certain directions just like the claymore does.
Re: New feature: dynamic (flash-)lighting[message #318709] Sun, 05 May 2013 14:03 Go to previous messageGo to next message
Flugente

 
Messages:3309
Registered:April 2009
Location: Germany
@Tais: One could either create flares with a very long duration (like 255 or sth), or create some sort of 'eternal flare' that is always on once spawned - now that I think of it, it wouldn't be that hard (just odd).

@Maalstroom: Sandbags and concertina wire are only placable in maps that have that tileset. Mines that create lightsources are already possible (since 1.00 Smile ). A mine that creates light in one direction, like flashlights do, can be done - but will work only once, as mines blow up only once Smile


Re: New feature: dynamic (flash-)lighting[message #318734] Sun, 05 May 2013 20:19 Go to previous messageGo to next message
lockie

 
Messages:3943
Registered:February 2006
Location: Scotland
I'll just stop whinging now , thank you kind sir ! Very Happy :bunny: And Will Gates had the best trip lights in his rather good mod .

So there !


Re: New feature: dynamic (flash-)lighting[message #318764] Mon, 06 May 2013 00:28 Go to previous messageGo to next message
Wil473

 
Messages:2830
Registered:September 2004
Location: Canada
Headlamp is no go, I'll be reusing the item indexes/graphic slots, and the Item Transform for a compact flashlight that I still need to draw. EDIT: the resources will be used for a Russian Tac Light.

The Flashlight, as copied from the v1.13 XML's, is a deadly melee weapon - thought it would be a good idea to replace the box cutter Shark carries with it in that first UBT map the player is "encouraged" to visit in Urban Chaos.

[Updated on: Mon, 06 May 2013 01:05] by Moderator



Re: New feature: dynamic (flash-)lighting[message #318824] Mon, 06 May 2013 22:21 Go to previous messageGo to next message
merc05

 
Messages:78
Registered:January 2013
After playing for a longer time I noticed there's something odd with the batteries. They get used up if the flashlight is held, no matter if it is actually turned on (item has FlashLightRange>0) or not.
Re: New feature: dynamic (flash-)lighting[message #318829] Mon, 06 May 2013 22:46 Go to previous messageGo to next message
Flugente

 
Messages:3309
Registered:April 2009
Location: Germany
Seems I somehow deleted a check there, will correct.


Re: New feature: dynamic (flash-)lighting[message #318842] Tue, 07 May 2013 01:59 Go to previous messageGo to next message
Flugente

 
Messages:3309
Registered:April 2009
Location: Germany
Fixed in r6067. I also fixed significantly inefficient code I introduced in 6061 in 6068 - realtime night combat with many opponents causes slowdown. Please use 6068, 6061 - 6067 are bad due to this.

:uhh: :heavy: :sadyellow:


Re: New feature: dynamic (flash-)lighting[message #319372] Sat, 11 May 2013 18:46 Go to previous messageGo to next message
Strohmann

 
Messages:288
Registered:August 2011
Location: Division Thought Crimes
revision 1670 with 6068 exe

- flashlights need batteries to work even without the -tag (probably intended)
- battery attachment slot overlaps with the stock slot, cluttering the interface
- the max sight range isn't the same for all angles
- NE/E-angle: the light cone doesn't spread evenly, instead is slightly biased to the right.
- Rifle LAM-Flashlight Combo uses the flashlight even without raised weapon, can look unintentional funny if the weapon carrier is swimming

[Updated on: Sat, 11 May 2013 19:06] by Moderator

Re: New feature: dynamic (flash-)lighting[message #319398] Sun, 12 May 2013 01:43 Go to previous messageGo to next message
Flugente

 
Messages:3309
Registered:April 2009
Location: Germany
1. yup.
2. might be... I didn't touch the attachment system, as it is pure horror.
3. hum? should be, at least roughly... I'll check once I'm back at coding.
4. same.
5. I only check wether a flashlight is inm our hands, checking for animation states would mean hardcoding, which would suck to no end.


Re: New feature: dynamic (flash-)lighting[message #319442] Sun, 12 May 2013 19:56 Go to previous messageGo to next message
Flugente

 
Messages:3309
Registered:April 2009
Location: Germany
http://i42.tinypic.com/krx8j.jpg
Careful viewing shows that the light doesn't spread as much to NE as it should (compared to Sw, SE, NW). Not sure where that can fixed.


Re: New feature: dynamic (flash-)lighting[message #323175] Wed, 24 July 2013 23:14 Go to previous messageGo to next message
nhja2fan

 
Messages:27
Registered:March 2012
I'm running 6232 and although I turn the Rifle-LAM flashlight on, I don't see any visible light in tactical. Any setting I'm missing?
Re: New feature: dynamic (flash-)lighting[message #323177] Wed, 24 July 2013 23:31 Go to previous messageGo to next message
Flugente

 
Messages:3309
Registered:April 2009
Location: Germany
Do you have batteries attached, the light in your hands, an is it night?


Re: New feature: dynamic (flash-)lighting[message #323178] Wed, 24 July 2013 23:34 Go to previous messageGo to next message
nhja2fan

 
Messages:27
Registered:March 2012
Rifle-LAM-Flashlight is attached to a colt commando, at night, with batteries, with the text indicating that the flashlight is on. Tried commando raised/not raised, didn't change anything.
Re: New feature: dynamic (flash-)lighting[message #323179] Wed, 24 July 2013 23:42 Go to previous messageGo to next message
Flugente

 
Messages:3309
Registered:April 2009
Location: Germany
Does your flashlight have the correct tags? The xml editor likes to eat those...


Re: New feature: dynamic (flash-)lighting[message #323180] Wed, 24 July 2013 23:52 Go to previous messageGo to previous message
nhja2fan

 
Messages:27
Registered:March 2012
Searched through the xml files and couldn't find any instance of FlashLightRange. Is that the tag you mean? I have run the xml editor and saved 1.13 data, does the xml editor strip out some of the tags?
Previous Topic: New feature: anti-materiel ammo
Next Topic: New feature: Improved trade menu
Goto Forum:
  


Current Time: Thu May 24 04:52:07 EEST 2018

Total time taken to generate the page: 0.01157 seconds