Blog post (6th of April, 2020)
Darkness and LightGreetings and salutations!
I feel that, slowly, this game is starting to look--somewhat at least--like itself. ^_^
Work has continued on filling out the environment of the temple proper: In particular, the refectory is pretty much done, save for some work related to an in-game progression of time.
The player-character's room has also been furnished--although I forget whether that was done before the previous devlog, and thus whether it more properly falls under that entry. ^^;
On the technical side, a number of features have been implemented and bugs fixed. (Including the reworking of what in retrospect was a slightly-silly approach to loading characters. ^^; )
One new feature that is perhaps particularly salient is that of "proxy characters". These, in short, are characters that response as though they were some other, specified character: when asked for their list of options, they pass the request on to their "target" character, and likewise when asked to hide their list of options. In effect, this allows the game to include multi-tile characters.
For example, consider the refectory table, shown above. When approached early in the game, it presents a list of breakfasting options. However, given a table so long, I don't want players to be required to look at some specific tile in order to activate those options. So I line it with proxy-characters, all referencing the single "real" breakfast-table character--thus allowing the player to approach any of the relevant tiles to breakfast!
I've also added the ability to "tag" decor-items. This allows for them to be quickly and easily accessed in script-methods, and thus to be easily changed. For example, certain candles might be snuffed as time passes, or the lighting of the views through windows altered.
Similarly, I've added the ability to "tag" tiles. However, unlike the decor items, this isn't intended to provide easy access to them--that access already exists via another feature. Instead, what this does is group the geometry for those tiles together beneath a single parent-node, and provide easy access to that parent. This then allows scripts to change the appearance of a set of tiles.
And one place that this sees use is in the basement.
This area is quite dark, save for one--unexpectedly--well-lit region. By tagging the well-lit region, I can tint it to suit the light-source in question, and dim the rest of the region.
However, I wanted the basement to be more than just dim: I very much wanted the player to be able to see only a little distance ahead of themselves, to be centred in a little pool of light.
Now, I could have simply used a standard light for this. But such lights have a soft falloff, and may still illuminate paler objects in the distance. While technically accurate, this wasn't the effect that I wanted.
Creating a custom shader to do this would have been easy, I imagine. But I'd taken the decision that, for this project, I wanted to use only out-of-the-box features, and so I set aside the idea of a custom shader.
I considered a variety of potential solutions: trickery with texture-projection, or spotlights, or blending of texture-stages. But none of these seemed like a good idea--especially for a side-project.
Then a much simpler idea came to me: I could simply attach a black sphere to the camera (or better yet, two, one fully opaque and one smaller and semitransparent, providing two-level lighting). This would naturally cut off the view in the appropriate shape, and do so quite easily!
The illuminated area, then, could simply be set to render after the "darkness spheres", with those spheres set to not write to the depth-buffer. Said illuminated area would thus be drawn over the spheres, and so appear as a light in the dark. ^_^
I tried it--and it works!
That then is all for now--stay well, and thank you for reading! ^_^