Bay 12 Games Forum

Please login or register.

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

Author Topic: Dfhack: Rendermax (and it's subplugin light)  (Read 145390 times)

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Dfhack: Rendermax (and it's subplugin light)
« on: July 13, 2013, 06:55:46 am »

So there were few ideas and suggestions floating around about implementing light in df. This plugin allows that (and more).
eye candy:
Spoiler (click to show/hide)
Current features:
Stuff occluding/emitting light
  • Water/Lava
  • Ambient air -> just ocludes
  • Citizens
  • Sun -> just emits, can change color with time, can change time it takes to cycle, can lock
  • Ice
  • All materials
  • Constructions and veins

Things to-do so i won't forget (in no particular order):
  • twbt compatability- currently it sort-of-works with twbt legacy mode. Make it work with both and make it faster
  • Elle ideas - namely make each tile have 4 corner colors this would allow walls to be lit up by two light sources
  • full map mode - a screenshot (or HUGE machine) mode, that takes into account ALL the lights in the map
  • faster rendering - currently it uses quite stupid way of tracking light. Also move occlusion and sun propogation to threads

In more detail: http://www.bay12forums.com/smf/index.php?topic=128487.msg7409464#msg7409464
« Last Edit: April 01, 2017, 04:05:58 am by Warmist »
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: Dfhack: Rendermax (and it's subplugin light)
« Reply #1 on: July 13, 2013, 06:56:24 am »

Example settings:
Spoiler (click to show/hide)
Some explantions (also read included rendermax.lua):
Spoiler (click to show/hide)
« Last Edit: July 21, 2013, 07:23:55 am by Warmist »
Logged

fricy

  • Bay Watcher
  • [DFHACK:ZEALOT]
    • View Profile
Re: Dfhack: Rendermax (and it's subplugin light)
« Reply #2 on: July 13, 2013, 07:58:39 am »

Awesome, PTW.

lightrow

  • Bay Watcher
    • View Profile
Re: Dfhack: Rendermax (and it's subplugin light)
« Reply #3 on: July 13, 2013, 09:33:53 am »

this looks interesting, cant wait to try it out! It also would be nice if we had some sort of "field of view" or "fog of war", so that we don't know what lies within an unlit area, unless a dwarf approaches it, or a torch or something like that is built in there.

Minecraft style: forgotten beasts spawning in unlit areas  :)
Logged

Hommit

  • Bay Watcher
    • View Profile
Re: Dfhack: Rendermax (and it's subplugin light)
« Reply #4 on: July 15, 2013, 03:42:24 am »

Oh WOW!

any torches/lamps/etc planned?

ps: assuming you gave code to Toady, what do you think chances will be that wee see this in main game in current release?
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: Dfhack: Rendermax (and it's subplugin light)
« Reply #5 on: July 15, 2013, 04:55:48 am »

this looks interesting, cant wait to try it out! It also would be nice if we had some sort of "field of view" or "fog of war", so that we don't know what lies within an unlit area, unless a dwarf approaches it, or a torch or something like that is built in there.

Minecraft style: forgotten beasts spawning in unlit areas  :)
Currently the system works as a layer on top of view (to be precise it just multiplies the color value of each tile) thus does not modify the actual working of the game. That being said it is possible to do some features like that but imho it's enough that it's too dark to see.

As for minecraft style, yeah that would be !!FUN!!, but alas we don't have explosions (terrain destroying) in DF so no creepers :<

Oh WOW!

any torches/lamps/etc planned?

ps: assuming you gave code to Toady, what do you think chances will be that wee see this in main game in current release?
for torches/lamps/etc -> i'll let modders do that (by making custom 1x1 workshops). My work is to create a system. Modders -> create implementations (magical crystals?, glowing fungus trees?, maybe lava only lighting and then megaprojects that all the corridors would have lava?) and users to play :)

and for ps: NONE. First of all Toady has said multiple times that he does not want to collaborate, secondly we from dfhack do it quite differently then Toady does (because he has access to source code) and lastly Toady One has his one ideas which (most probably) are totally different from our implementation.

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: Dfhack: Rendermax (and it's subplugin light)
« Reply #6 on: July 15, 2013, 09:35:00 pm »

Yeah :)

You did it :)

I already have brazier, candelabra and fireplace set up as 1x1 workshops, and plan on glowing fungus for the caverns. It will look great. Did you experience any FPS-affects when running this?

I will gladly wait for dfhack r4 for this.
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: Dfhack: Rendermax (and it's subplugin light)
« Reply #7 on: July 15, 2013, 10:12:34 pm »

i love the name for your "ultra high settings" variable, btw

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: Dfhack: Rendermax (and it's subplugin light)
« Reply #8 on: July 16, 2013, 02:34:22 am »

Yeah :)

You did it :)

I already have brazier, candelabra and fireplace set up as 1x1 workshops, and plan on glowing fungus for the caverns. It will look great. Did you experience any FPS-affects when running this?

I will gladly wait for dfhack r4 for this.
It's not as slow as you would think, but it is a bit slower. But due to Japa's persistence it's multi threaded now and hopefully will be more efficient as time goes on. Currently it only calculates lighting for visible part of world (so smaller screen, less of performance drop).

As for waiting for dfhack r4, i am hoping (i.e. procrastinating at the moment) to make a back-ported version of this, so it would work with r3 (does not need to mess with dfhack itself actually. Can work as a dll plugin). Although it has a few nasty bugs (like crashing randomly if you resize screen while running, or try to disable it...)

i love the name for your "ultra high settings" variable, btw
Thanks. That was inspired by a better algo pictured here: image that eats your cpu like crazy (something like O(n!) vs our O(n^2) ) but it looks nice.

Sutremaine

  • Bay Watcher
  • [ETHIC:ATROCITY: PERSONAL_MATTER]
    • View Profile
Re: Dfhack: Rendermax (and it's subplugin light)
« Reply #9 on: July 16, 2013, 05:25:29 pm »

So, screenshot mode then?
Logged
I am trying to make chickens lay bees as eggs. So far it only produces a single "Tame Small Creature" when a hen lays bees.
Honestly at the time, I didn't see what could go wrong with crowding 80 military Dwarves into a small room with a necromancer for the purpose of making bacon.

GSV Urist

  • Escaped Lunatic
    • View Profile
Re: Dfhack: Rendermax (and it's subplugin light)
« Reply #10 on: July 17, 2013, 06:52:59 am »

Damn!  I have been lurking on forums since about 2007 but almost never post.  Just wanted to say this looks amazing, and if it works smoothly would add real flavour to DF. So mad props for doing it!  This kind of tuff blows my mind not being a programmer, can this pass back info to df? Could you use this to simulate gas?  Like saturate a tile in green then kill stuff that enters it? 

Between this and digging invaders there are some really interesting new plugins out.  Sadly I tend bottom out at about 20 fps with 80 dwarves pop limit after a while but hopefully lighting wont impact that too much.

Also wanted to say a big thanks to Meph, who I know has been pushing for this.  I have been playing masterwork almost exclusively now for a while and im kinda in awe of how much work it must have taken.  I know it uses alot of different mods as well to thanks to Putnam et al + anyone else who contributes to masterwork and the DF/Hack collection.
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: Dfhack: Rendermax (and it's subplugin light)
« Reply #11 on: July 17, 2013, 07:08:52 am »

So, screenshot mode then?
That is a whole different idea...
Damn!  I have been lurking on forums since about 2007 but almost never post.  Just wanted to say this looks amazing, and if it works smoothly would add real flavour to DF. So mad props for doing it!  This kind of tuff blows my mind not being a programmer, can this pass back info to df? Could you use this to simulate gas?  Like saturate a tile in green then kill stuff that enters it? 

Between this and digging invaders there are some really interesting new plugins out.  Sadly I tend bottom out at about 20 fps with 80 dwarves pop limit after a while but hopefully lighting wont impact that too much.

Also wanted to say a big thanks to Meph, who I know has been pushing for this.  I have been playing masterwork almost exclusively now for a while and im kinda in awe of how much work it must have taken.  I know it uses alot of different mods as well to thanks to Putnam et al + anyone else who contributes to masterwork and the DF/Hack collection.

It could. But currently it does not (for purity and separability). Also there is an issue that this only calculates everything in viewscreen only, thus anything involving said gases out of screen will not work.

The performance is ongoing battle. It's performance against quality. It would be very nice to have diffuse lights (i.e. it would travel around corners somewhat) and full map lights (maybe with crazy stuff like mirrors that bring sunlight from outside into the fort? or huge crystals that light up ALL the center of huge fort?). Currently it can benefit from rewriting the occlusion and lights stuff into threads (light propagation is already in threads). Occlusion is all the stuff that blocks (colors) light and lights is the step that add light sources (also sunlight is a big performance drain because it checks multiple layers, including constructions and water etc...).

Edit: main thing that it's lacking for me is ability to hack adv-mode so it would not use default vision but instead use this lighting system.
« Last Edit: July 17, 2013, 07:21:27 am by Warmist »
Logged

lightrow

  • Bay Watcher
    • View Profile
Re: Dfhack: Rendermax (and it's subplugin light)
« Reply #12 on: July 17, 2013, 03:53:20 pm »

will it be rendered by CPU or GPU? I mean, will the be any benefit from a good videocard or not?
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: Dfhack: Rendermax (and it's subplugin light)
« Reply #13 on: July 19, 2013, 02:24:20 pm »

will it be rendered by CPU or GPU? I mean, will the be any benefit from a good videocard or not?
Cpu. It is theoretically possible to offload it to e.g. shader but currently the light itself (which could be offloaded) is not very computation intensive and general reading (and computing) the map is taking most of the time and it can not be done on gpu (it also requires locking df, so it would not change the map in the middle of computation)

Btw: i added a pre-alpha-preview version of this. Mostly for playing around and mod makers to get the feel for the plugin. In the next versions the lua file will probably move to raws (thus be world dependant) and arena mode does not work (limitation of dfhack r3).

Sutremaine

  • Bay Watcher
  • [ETHIC:ATROCITY: PERSONAL_MATTER]
    • View Profile
Re: Dfhack: Rendermax (and it's subplugin light)
« Reply #14 on: July 19, 2013, 05:49:52 pm »

Where does rendermax.lua go? I've tried it in a bunch of folders, but the DFHack console keeps telling me: "File not found: rendermax.lua".

It sort of works -- dwarves generate their own light, but nothing else does. Even the surface is dark where there aren't any dwarves.
Logged
I am trying to make chickens lay bees as eggs. So far it only produces a single "Tame Small Creature" when a hen lays bees.
Honestly at the time, I didn't see what could go wrong with crowding 80 military Dwarves into a small room with a necromancer for the purpose of making bacon.
Pages: [1] 2 3 ... 20