Post news Report RSS Adding a Bug

In which a table and its contents are completed; shelves gain contents; inventory-item bones are made; a collectible glass jar holding a small creature is made; shader-work is done; the inventory's handling of shaders and of draw-ordering is extended; and one collectible is made to appear as two entries.

Posted by on

Greetings and salutations!

This week's screenshot shows the contents of a shelf:

Screenshot from 2020 11 14 10 40 1

The week just past was primarily a week of decor, of acquirable things, and of shader-work:

In last week's blog-post I showed a table under a window. In the week just past I finished off that table: I improved the stains, enlarged the paper-scraps, changed the texture used on many of those scraps, and rounded the pegs that hold the table-legs, as I recall.

Screenshot from 2020 11 13 16 52

But perhaps the biggest part of the work of the week just past was that related to contents of the shelving beside the table.

Those shelves don't have much on them, just a few items--albeit perhaps slightly more than is shown in the screenshot above. ;)

Nearest the viewer in that screenshot are two small bones--the sort of things that a magic-worker might use. These can be taken, becoming inventory items, used to--ah, but that would be telling! (And indeed, I may become a little more cautious about spoilers from this point on!)

The bones were fairly straightforward to make, as I recall, albeit that they did end up getting a custom set of textures.

Screenshot from 2020 11 14 10 40

Further down the shelf can be seen a large glass jar, closed by a string-tied cloth. Inside--perhaps not very visible in the screenshot--is a small creature, a bug rather like a spider or a crab, quite dead.

This jar is a collectible, and implementing it took a little bit of work.

The making of the jar itself wasn't too difficult--it's a modified version of a jar used in a previous level. I did have to make a new version of the glass shader, one specific to sunlight rather than the player-light, but I don't think that this proved too troublesome.

The creature was a little trickier, both in modelling and texturing, but I think that I brought it to a point at which I'm satisfied with it.

However, the use of a custom glass shader did nevertheless present a problem: the inventory system had its own lighting, and had only simplistic support for custom shaders. Thus the sunlight version of the glass-shader wouldn't work, and the inventory system didn't know how to look for an inventory-specific shader.

So I attended to both of those issues: I created an inventory-specific glass-shader, and I extended the logic of the inventory system to allow it to check for such a thing.

But there was also an issue with the draw-ordering of the jar: it has multiple parts, set to render in a specific order. Leaving that out resulted in a less-effective impression of glass, and leaving it in interfered with either the collectible close-up or the popup that appears on acquisition.

For the collectible close-up, I added some code to find and translate draw-order states such that--within certain bounds--they fit with the expected draw-ordering of the inventory. (And increased the draw-order of the frame around the close-up to make "space" for this, if I recall correctly.)

For the popup, a simple enforced draw-order applied to the controlling node prevents any item-specific draw-orderings from taking effect. This means that its rendering won't be quite right in such cases--but it's sufficiently small and ephemeral that this shouldn't be a major problem, I feel.

(I also slightly decreased the scale of items in the collectible close-up, so that some of the broader ones--like the glass jar--feel less cramped.)

Screenshot from 2020 11 13 16 53

I did have one more issue with this collectible, however: the creature within the jar is intended to be part of what's interesting about the item, but being so small, it was hard to see even in the close-up.

So what I decided was this: when taken, this particular collectible not only adds the jar to the player's collection, but also separately adds the creature alone. This allows for both the jar and the creature to be easily viewed.

Doing this called for a little custom logic, but nothing too tricky at all, I believe!

And along the way, I made a few other changes, additions, and tweaks that don't seem worth detailing here! (Including the addition of an "entrance" object to the level.)

That then is all for this week--stay well, and thank you for reading! ^_^

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: