Light sources (in-game)

Discuss coding questions, pull requests, and implementation details.
User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Light sources (in-game)

Post by Hazelnut »

So recently options for changing ambient lighting were added, followed by the light spell. (very cool BTW!)

I'm very keen that DFU is playable without magic, so it troubles me that players that want to remove the ambient lighting and free always-on player torch for the atmosphere are forced to use magic for the light spell.
I actually like magic in games, I've got nothing against it honest! However, this is a RPG so it should be a choice, and that's one of focusses of the Archaeologists guild mod - it will have items of recall for sale! ;)

It seems obvious that there were plans to have darker dungeons for sure, especially when there are unused items in the game like: Torch, Candle, Oil, and Lantern. I figured these should have a use in DFU so I've spent this evening implementing simple in-game light sources. :D

There's a new setting for the player torch light to be enabled by in-game light sources:
  • Candle (1hr of dim light, 5.3mins playtime, 1gp, 0.1kg, range 8)
  • Holy Candle (1hr of light, 6.7mins playtime, 5gp, 0.25kg, range 10)
  • Torch (3hr of light, 16mins playtime, 10gp, 0.5kg, range 14)
  • Lantern (6hr of light when full, 32mins playtime, 40gp, 1kg, range 16)
Range is the effective brightness, so candles are quite dim but lanterns penetrate the gloom much better. (light spell is range 15 for comparison)
Lantern can be refilled by Oil bottle (5gp, 0.25kg) and it takes 4 bottles to go from empty to full. Probably going to have to make it easier to buy in bulk.
As fuel is used, the light source condition decreases until it goes out. During the last 20s of fuel, the light dims and flickers to warn the player.

When the new setting is switched on, a light source is lit by 'use' in inventory which activates the normal player torch. The existing slider is still used to tune the intensity of the light.

All done with fairly minimal changes to codebase. :ugeek: What do you think? Is this something good to add to DFU?
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Light sources (in-game)

Post by Interkarma »

Mate, you and I are completely on the same page with this one. When I added those two features (ambient settings and Light spells), I had to tear myself away from building more stuff like dropping candles and torches around dungeons - it's all I could think about for a couple of days. But I ultimately wrested myself back to roadmap.

But if an interested and talented person like yourself was to start building out these features in the way you described, I would be most happy to play test them. :)

User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Light sources (in-game)

Post by Hazelnut »

PR #1006 submitted. :D

Lets see what you think when you try it in-game. I tested it with full player torch intensity and 0.1 for ambient light in dungeons.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Light sources (in-game)

Post by Interkarma »

Yay! Will check this out when I can. :D

MrDowntempo
Posts: 38
Joined: Fri Sep 15, 2017 4:01 pm

Re: Light sources (in-game)

Post by MrDowntempo »

Any chance that we might see enchanted versions of these new items, or at least allow for mods to let that happen. Specifically to enchant lanterns to last longer and shine brighter?

User avatar
Jay_H
Posts: 4062
Joined: Tue Aug 25, 2015 1:54 am
Contact:

Re: Light sources (in-game)

Post by Jay_H »

I do think 16 minutes of light from 10 charges of oil is a bit short. That said, I haven't playtested it yet so I can't be sure.

However, I do want to say this is an excellent idea, one that should definitely be a part of DFU :)

User avatar
Midknightprince
Posts: 1324
Joined: Fri Aug 11, 2017 6:51 am
Location: San Antonio TX
Contact:

Re: Light sources (in-game)

Post by Midknightprince »

Oh man, this is gonna be awesome...
Check out my YouTube Channel!

User avatar
pango
Posts: 3347
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Light sources (in-game)

Post by pango »

Excellent indeed!
I was hoping for such feature, I'm eager to playtest it.

Do they burn while you sleep?
Can they be turned off? (I'm not sure how easy it is to do with a torch in real life :?)
Otherwise I assume one strategy will be to use a lamp and only refill it small amounts at a time...
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
Hazelnut
Posts: 3015
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Light sources (in-game)

Post by Hazelnut »

Light sources don't burn during rest or fast travel, it's assumed that you extinguish it and light it again after. They can be manually turned off, and players will have to remember to do this when leaving dungeons in daytime. :-)

Jay, burn times may well be tweaked. This was an initial go at it, but I think you're right that is too short. I want to be careful not to be much better than the spell so it's no choice any more. I've updated my first post with my new proposed times, what do you think?
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
pango
Posts: 3347
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: Light sources (in-game)

Post by pango »

Real life candles can last for hours, but they don't give out much light, the flame is small...
If they're cheap, and since they don't weight much either, they could be "last resort" kind of light source.
(and a few be part of starter kit?)
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

Post Reply