Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2] 3 4 5

Author Topic: DF lighting system (I wrote a c++ code) + video  (Read 11493 times)

Starver

  • Bay Watcher
    • View Profile
Re: DF lighting system (I wrote a c++ code)
« Reply #15 on: November 18, 2012, 06:43:25 pm »

I agree it would be visually interesting.

I don't think it's that useful in Fortress Mode, right now, as you're (virtually) omniscient anyway when it comes to everything except totally undiscovered caverns and deliberately sneaking invasion forces and kidnappers, and your dwarves have equal omniscience (although not always total sense) as to how to get from one place to another, and their 'artificial stupidity' would need to be developed further before you could assume that dwarves could get lost in dark passages (visible to you or not.)

Adventure Mode has its own visual limits, and maybe something could be tacked into that (but with "light a campfire and you can see further into the cave/night-time landscape", perhaps.  Unless you're too close in which case it might make you miss something, I suppose.)  I'd be tempted to suggest something similar is implemented.

I believe the curses-esque display engine isn't really geared up for all these subtle variations (see also better verticality/inter-level visualisations, partially transparent tiles, other subtle things), but I'm not overly familiar with it and there might be a tweak or two that could be applied, but it probably needs awaiting some "next version" of the visualisation engine or other.

Also, you ought to see what I'm trying to knock together with POVRay scripts and renderings...  but that started off as a potential "DevLogs from 2050" post, and sort of blossomed out of control. ;)
Logged

AutomataKittay

  • Bay Watcher
  • Grinding gears
    • View Profile
Re: DF lighting system (I wrote a c++ code)
« Reply #16 on: November 18, 2012, 06:46:07 pm »

I agree it would be visually interesting.

I don't think it's that useful in Fortress Mode, right now, as you're (virtually) omniscient anyway when it comes to everything except totally undiscovered caverns and deliberately sneaking invasion forces and kidnappers, and your dwarves have equal omniscience (although not always total sense) as to how to get from one place to another, and their 'artificial stupidity' would need to be developed further before you could assume that dwarves could get lost in dark passages (visible to you or not.)

Adventure Mode has its own visual limits, and maybe something could be tacked into that (but with "light a campfire and you can see further into the cave/night-time landscape", perhaps.  Unless you're too close in which case it might make you miss something, I suppose.)  I'd be tempted to suggest something similar is implemented.

I believe the curses-esque display engine isn't really geared up for all these subtle variations (see also better verticality/inter-level visualisations, partially transparent tiles, other subtle things), but I'm not overly familiar with it and there might be a tweak or two that could be applied, but it probably needs awaiting some "next version" of the visualisation engine or other.

Also, you ought to see what I'm trying to knock together with POVRay scripts and renderings...  but that started off as a potential "DevLogs from 2050" post, and sort of blossomed out of control. ;)

Oh, I think it could be useful, even without it affecting the overseer! Dwarves now have to be able to see bodies to report death, otherwise it goes missing. It could make things more interesting if they need light to see things underground to aim at or report among themselves, even if the overseer never actually see the effect of lighting/darkness/distance ( except maybe flipping on a mode, like shift-d does for trade depot ).
Logged

Starver

  • Bay Watcher
    • View Profile
Re: DF lighting system (I wrote a c++ code)
« Reply #17 on: November 18, 2012, 07:06:36 pm »

Ah, you got there before me with the "Trade Depot-like" suggestion.

I was about to follow up my own post (but, yeah, had still forgotten about hidden deaths, in the latest version) to say that you'd need to have to introduce into the game some form of "make light-source" and place such items in strategic locations and then maybe (under the current engine limitations) switch mode to see what areas were dark or not.  Which you just covered (at least the switch mode bit).

Beware, of course, that we're not going into "copy Minecraft right back again" territory.  It needs to be as unique as it can be made, and not just "put torches on the walls and we're happy" time.  Certainly, if we ever get so far as to have random monsters spawn in unlit+unobserved areas, it'd be a pain to look original.  Even though MC isn't the originator of that style of mob generation, either.

Personally I'd suggest "oil tracks" one could lay down, to create a linked set of illuminated corridor lighting along the ceiling, walls and/or floor.  Needs to be kept supplied by an oil production or similar (thus not ubiquitous, and needs supporting).  Gas is also a possibility, but for some reason I see this 'artificially poked' 1400s-type tech level as being oil-fired, and we already have an oil-producing capability (a vegetable oil, via presses, not mineral oil which would bring its own challenges and perhaps MC/Tekkit-looking similarities) which could be subverted/advanced for this purpose.

Apart from various essentially perpetual sources (glowing fungii extracts, for example although that'd not be strictly everlasting either, while certain ores could be considered useful and essentially be light sources forever), I'm not entirely sure I want a "Lamplighter" job, either to maintain all underground lighting systems (topping up, if not tube-fed or otherwise automated) or to activate all overground lights during the 'night' (not currently a concept that exists in Fortress Mode, due to the seamless passage of day/night, at least compared with the various inexorable calendar progressions), but that's not a great dislike and I could see it being implemented at some point where lighting actually becomes of concern.
Logged

nop

  • Bay Watcher
    • View Profile
Re: DF lighting system (I wrote a c++ code)
« Reply #18 on: November 18, 2012, 08:41:11 pm »

More images with an updated code

This demo required about 3700 lighting sources, and 10 ms to calculate all light maps. My next step is a lighting maps cache. 8)
Also, tell me if you have an interesting fortress \ layout for me to test.













Logged

nop

  • Bay Watcher
    • View Profile
Re: DF lighting system (I wrote a c++ code)
« Reply #19 on: November 18, 2012, 08:51:49 pm »

Also, you ought to see what I'm trying to knock together with POVRay scripts and renderings...  but that started off as a potential "DevLogs from 2050" post, and sort of blossomed out of control. ;)
Well, it took about a month full of thoughts about the way this idea should be implemented. So, I believe that I will be able to deal with thousands of *static* light sources, especially with the the help of the smart cache. And no realtime raytracing is required. Common *static* light takes hundredths of millisecond to be processed. But every 'dynamic', 'moving' light may create a relatively large performance hit. Maybe, engine will handle about 2 dozens of dynamic light sources to keep 50 FPS. Who knows...
« Last Edit: November 18, 2012, 08:54:02 pm by nop »
Logged

Vattic

  • Bay Watcher
  • bibo ergo sum
    • View Profile
Re: DF lighting system (I wrote a c++ code)
« Reply #20 on: November 18, 2012, 09:13:55 pm »

In adventure mode you can still see explored areas even if they are out of sight. This works as your characters memory and Toady has even mentioned messing with it. I wonder how memory might be displayed if your lighting was implemented.

One reason I wonder this is because it could solve the problem of how to display areas of the fort that have been but are not currently lit. You can see the general layout but not what is actually going on.
Logged
6 out of 7 dwarves aren't Happy.
How To Generate Small Islands

Robosaur

  • Bay Watcher
  • [POOP:INORGANIC: NUCLEAR_BOMBS]
    • View Profile
Re: DF lighting system (I wrote a c++ code)
« Reply #21 on: November 18, 2012, 09:19:21 pm »

I think it looks really pretty.
Logged
You are a terrible person and the sad truth is deep down you know it.

Starver

  • Bay Watcher
    • View Profile
Re: DF lighting system (I wrote a c++ code)
« Reply #22 on: November 18, 2012, 09:37:45 pm »

In adventure mode you can still see explored areas even if they are out of sight. This works as your characters memory and Toady has even mentioned messing with it. I wonder how memory might be displayed if your lighting was implemented.

"Memory" areas are in a different colour-palette (at least in the CodePage set, not sure about how custom tilesets work this) as are visible things at night.  Interestingly, living creatures that (without any other effect such as blood spattering or vomit around them) have black backgrounds in night-time in-view positions[1] get a background colour (dark magenta, isn't it?) in 'memory-only' areas, while dead bodies that are non-black backgrounded within view merge into black-background at locations beyond sight.


Anyway, for this lighting-system revamp, I imagine tone (monochromatically) might be implemented for memory-zone tiles, with the light-limit being a fade of colour contrast to the edge of the visible area, to then solidify into the (darker, but still distinct) monochrome versions of what the visible tile would have been.

I wonder if OP could mock up a default tileset equivalent of some of the things he's using currently displaying in tileset, though?  It'd be useful to see how it would work "natively".  (Especially if you start to incorporate silly ideas like the one I just gave out.)


[1] Also daytime, but with the smaller viewing circule you get to see the effect transitioning more, at night.
Logged

GreatWyrmGold

  • Bay Watcher
  • Sane, by the local standards.
    • View Profile
Re: DF lighting system (I wrote a c++ code)
« Reply #23 on: November 18, 2012, 11:15:11 pm »

Wow, that code is great.
Maybe if you made magma a light source and let users choose points to be additional light sources...

Back on-topic...lighting is planned in some form or another, so no use arguing against it.
Logged
Sig
Are you a GM with players who haven't posted? TheDelinquent Players Help will have Bay12 give you an action!
[GreatWyrmGold] gets a little crown. May it forever be his mark of Cain; let no one argue pointless subjects with him lest they receive the same.

Cool Guy

  • Bay Watcher
  • inlcude <iostream>
    • View Profile
Re: DF lighting system (I wrote a c++ code)
« Reply #24 on: November 19, 2012, 09:25:07 pm »

I would fucking love to see your code if you'd allow it and if you get this working real well you need to publish it as a mod. I suggest you don't make unlit areas totally black for the overseer, maybe 50% opacity as I would still want to see the cavern layout, even if dwarves can't, and also that dwarves can still get around but at maybe -15% speed. As someone before me said, I think that if it's too dark then dwarves shouldn't be able to report dead bodies or found minerals.
Logged

nop

  • Bay Watcher
    • View Profile
Re: DF lighting system (I wrote a c++ code)
« Reply #25 on: November 19, 2012, 10:21:18 pm »

Maybe Lighting is not very useful in fortress mode unless moving objects / dwarfs carry light sources. I got some programming ideas about implementing that...
Logged

nop

  • Bay Watcher
    • View Profile
Re: DF lighting system (I wrote a c++ code)
« Reply #26 on: November 19, 2012, 10:25:53 pm »

Maybe Lighting is not very useful in fortress mode unless moving objects / dwarfs carry light sources. I got some programming ideas about implementing that...
Logged

Gavakis

  • Bay Watcher
  • some loser meme
    • View Profile
Re: DF lighting system (I wrote a c++ code)
« Reply #27 on: November 20, 2012, 06:18:46 am »

This is fucking geinus! But we need two different versions, one with and without lighting, amright toady?
Logged

Starver

  • Bay Watcher
    • View Profile
Re: DF lighting system (I wrote a c++ code)
« Reply #28 on: November 20, 2012, 11:14:39 am »

Make it an Init setting, like temperature, invasions and economy[1]?

(Not that they made Vampires an Init setting, that I know of, of course...)


[1] When re-enabled in the core.
Logged

10ebbor10

  • Bay Watcher
  • DON'T PANIC
    • View Profile
Re: DF lighting system (I wrote a c++ code)
« Reply #29 on: November 20, 2012, 11:43:57 am »

Make it an Init setting, like temperature, invasions and economy[1]?

(Not that they made Vampires an Init setting, that I know of, of course...)


[1] When re-enabled in the core.
Isn't vamps a world gen setting?  I know you can disable them. Maybe it was in the raws?

You'd need to have some sort of a switchable overlay, between light version and memory. Or different palletes might work too. However, I would like if we could work from both views. It would be a pain if we couldn't designate light sources without leaving the light version, or having to switch back to memory to see the entirety of your megaproject.
Logged
Pages: 1 [2] 3 4 5