Lighting Levels in adv3 Lite

I noticed a while back that one of the posts in this section (which I can’t now find) mentioned in passing that one reason its author was sticking to adv3 rather than adv3Lite was that his game needed the various lighting levels that adv3 provides and adv3Lite doesn’t. That eventually got me thinking that this was perhaps the one remaining substantial feature of adv3 for which adv3Lite fails to provide any support.

It then struck me that this would make it a good candidate for an additional adv3Lite extension (even if there may not be that many games that would need it). I’ve accordingly now put together a Brightness extension, which represents my first attempt to fill in this gap. This has now been pushed up to GitHub and will be included in the upcoming 1.6 release. In the meantime, if anyone wants to try it out, it can be found as the brightness.t file under the extensions folder in my GitHub repo, adv3lite/extensions at master · EricEve/adv3lite (github.com). There are fairly extensive comments in the source file, but documentation for the extension is also available in the brightness.htm file under the docs folder under the extension folder.

In brief, the extension allows different light sources to have different levels of brightness and different containers to have different levels of opacity that can reduce the brightness of any light that shines in and out of them, together with the means of calculating the brightness of the light available within any room or container. This is just taken to be the brightness of the brightest source, but the extension also provides a hook to allow game code to define how it wants to calculate the accumulated brightness of multiple light sources (such as ten candles in one otherwise dark room). Some support is also provided for the transmission of brightness across a SenseRegion, but it’s inevitably a bit primitive (there are too many different kinds of situation this could be modelling for me to come up with anything much more sophisticated).

8 Likes

Excellent extension! I especially appreciate that a light level value of 1 now has a meaningful distinction from the other light levels (unlike in adv3).

Yes, I mentioned the simulation of light and dark in the post:

One of the Czech text game authors translated the adv3 library, and I mentioned what was missing from the adv3lite library when asked about translating adv3lite into Czech. So thank you very much for this extension, which I will test soon (I am busy with the translation of adv3lite now), if I succeed in the translation, adv3lite will replace the original adv3 completely, at least in my case.

Thank you very much for the great work, adv3lite is a huge reason to create text games even nowadays.

1 Like