Bay 12 Games Forum

Dwarf Fortress => DF Modding => Topic started by: nop on April 23, 2013, 09:31:37 pm

Title: DF lighting system alpha code
Post by: nop on April 23, 2013, 09:31:37 pm
proto lighting engine for DF. Lost my will to develop it as I was able to obtain a working prototype
check this http://www.bay12forums.com/smf/index.php?topic=119314.msg3802421#msg3802421

(http://dffd.wimbli.com/download.php?id=7141&f=001_td.png)


alpha code is here http://dffd.wimbli.com/file.php?id=7599
What's inside the archive:
1) plugins/mapexport contains modified version of mapexport plugin for dfhack
can be used to export custom DF maps
2) code
3) map, sprites
4) lighting map

I used qtcreator 4.8, c++11
Provided ./lighting executable was compiled under fedora 17 x64 c++11 gcc 4.7 -mavx (I've got core i7 i3610M)

enable GENERATE_DEPTH_FILE if you want to generate an advanced lighting map
try changing WALKING_DWARFS_COUNT as well (for ex, 10-50)

every light is a point 3D-light (light6) that consists of 6 light1-pyramids

take a look here and other videos.
http://www.youtube.com/watch?v=6MmgC6TMkjw

use mouse to close \ open doors

use or modify this code as you want to. It should not contain serious bugs, just limitations

alexanderguzhva@gmail.com
Title: Re: DF lighting system alpha code
Post by: Hugo_The_Dwarf on April 24, 2013, 12:38:38 am
Impressive
Title: Re: DF lighting system alpha code
Post by: Deon on April 24, 2013, 01:22:26 am
If I get it right, it's just a visualizer. Did you plan to make it work with things like Stonesense or make a separate visualizer? I mean, it has nothing to do with the actual game, so what was your original plan for the final version, I wonder?
Title: Re: DF lighting system alpha code
Post by: Meph on April 24, 2013, 06:40:39 am
I love this.

Adding light not only to dwarves but light-sources like braziers, bonfires, candles or torches would really be amazing.
Title: Re: DF lighting system alpha code
Post by: Godlysockpuppet on April 24, 2013, 07:34:17 am
Wow. Me likey ;D
Title: Re: DF lighting system alpha code
Post by: nop on April 24, 2013, 08:21:25 pm
this code was designed to handle hundreds of moving point lighting sources and thousands of static ones, and to be a part of engine. I believe that lighting (and tracing lighted areas) should become an essential part of the game. But then I read that big boss does not accept 3-rd party code, and had no wish to implement a simple stupid visualizer for ladies and kids. Ideally - to make a fortress dark, cold, creepy, with mad dwarves that were lost in the darkness.

I'm done with these hopes. And with this code.
Title: Re: DF lighting system alpha code
Post by: Meph on April 24, 2013, 08:26:53 pm
But why? It is widely known that Toady One never includes anything done by anyone else. Thats why we have mods, or the LNP. You would be surprised how many people use those. If you connect your visualizer to the dwarf fortress.exe, no one will stop you releasing it as a bundle.

I would love to see this work, to make dwarves build light sources, slowly explore caverns, strategically mine with a support crew that brings torches/light... maybe add a day/night cycle based on the seasons (with winter being night, summer being day)

What is wrong with adding this as an utility, similar to the Therapist or Soundsense?
Title: Re: DF lighting system alpha code
Post by: Putnam on April 24, 2013, 09:25:48 pm
But why? It is widely known that Toady One never includes anything done by anyone else.

except the SDL code >_>
Title: Re: DF lighting system alpha code
Post by: i2amroy on April 25, 2013, 02:14:50 pm
But why? It is widely known that Toady One never includes anything done by anyone else.
except the SDL code >_>
Which he has since said that he hated doing. :P
Title: Re: DF lighting system alpha code
Post by: Mohreb el Yasim on April 25, 2013, 07:03:52 pm
nice images nop, i feel your lighting a bit harsh on the edges, reflected secondary ligth seems completly ignored and the perception wise the degrading should be slower on the dark ends as our eyes work more that way so it would give it a more real-like feeling ...
Meph, i do not think this thread was addet to be merged with DF and even if there migth ghave been such intention we all know it wont happen, (for gameplay wise it is better to not have lighting in my opignon for fortress mode anyway) but it is still a nice study of ligthning transmissions in squerical spaces ...
Title: Re: DF lighting system alpha code
Post by: Meph on April 25, 2013, 07:17:13 pm
I know it wont be merged into DF by Tarn Adams, but my question was: Why not develop this as a utility that people can run on the side, like Therapist or Quickfort? I know I would play with it. Seeing everything that is going on in the caverns, without a dwarf far and wide was always a pet peeve of mine. I suggested a fog of war several times in the dfhack thread... somehow porting it from adv. mode. But this here is even better.
Title: Re: DF lighting system alpha code
Post by: nop on April 25, 2013, 09:03:42 pm
Well, man, I have spent two months for writing this code. You want a visualizer - you should do it yourself: find  how to deal with dfhack, stonesense, debug it, and so on. Everybody would be grateful for your job, no doubt.
Title: Re: DF lighting system alpha code
Post by: Meph on April 25, 2013, 09:17:06 pm
But... it already works, doesnt it?  How else could you have done the videos?  Or maybe I should just shut up, because I obviously have no idea what I am talking about.  I dont know a single line of C++, I am no programmer whatsoever.^^
Title: Re: DF lighting system alpha code
Post by: Warmist on April 26, 2013, 10:12:06 am
You can replace the visualizer in df by using dfhack. It's been done a few time (for remote visualization) and is not that hard. Unfortunately visualizer only gets what char or pic to place where without any info about tile passibility or anything else. Of course you could just look into map yourself. So in the end it's not trivial to add something like this into df. But far from impossible.
Title: Re: DF lighting system alpha code
Post by: thistleknot on May 03, 2013, 08:06:29 pm
Can the lighting actually be used?  Like creatures without infrared token can't see in the dark?  Could the light have an ingame effect other than being visual?  Of course it would affect the player since he can't see beyond the darkness, but what about bad guys?  Then again, what about noise?