Light "Cookies" and Other Improvements

Hey Folks! More incremental improvements to lighting and rendering today, as we approach parity with the features we had with the older 3D system.

One of the most obvious differences today are what Unity calls "spotlight cookies." Basically, they're textures that mask the brightness of lights so you can add noise, patterns, and other details to the area a light touches. They're frequently used to make lights look like they are passing through a grate, an imperfect lens, or other filtering medium.

And in our 2D case, it can limit the effects of a light to a cone instead of a circle. Today's image illustrates this in a few places, such as the headlamp on the NPC. It only affects things in an area in front of the NPC, instead of all around it like yesterday's image. You can also see it in the top right doorway, where the lights have softer edges.

Note, however, that shadows case by objects (like the fridge), and line of sight from the character, still have harsh edges. There may be ways to mitigate this, such as blurring the shadow stencil in the rendering loop. However, I might put that off until more important issues are solved.

Another tweak from today is longer light ranges. Adding these "cookies" dimmed the lights a bit, limiting their range to only a couple tiles. To compensate, I increased the size of the light meshes, which stretches their range by an extra 50%. This allows a light on one side of a small room to illuminate the opposite wall a bit.

The headlamp was always on before, so I fixed that today, too. Now it turns on when the helmet is donned, and off when it's removed.

Zooming the game in and out was temporarily broken due to the new rendering method, so I fixed that. Air pumps and heaters were missing their led sprites, so I fixed that. And I also had to finesse the light sprite scaling a bit so they worked regardless of the size of the object vs. the size of the light sprite. (E.g. the nav console has a really big light sprite, but other objects have smaller ones.)

There's still a niggling bug in the headlamp sprite, which I think I can solve tomorrow. Similarly, the highlighting/dimming code no longer works now that we use custom rendering. I'll have to change the old 3D dimming params to use features in the new system instead.

I'm starting to have some doubts about the line of sight feature, now that I'm using it. One of the big issues I neglected was what to do about issuing orders to NPCs when the target is beyond line of sight. Like, what if we are telling the captain to use the toilet in another part of the ship? Or what if we want to command an NPC whom we cannot see?

There are some ways to deal with this. Perhaps I can brighten up the darkness outside line of sight, so we can see what we're clicking on. Maybe I hide NPCs and anything on the floor in such cases. And for out-of-sight NPCs, maybe I have a comm link I can use to contact them. Then, once they've acknowledged me, I can see their line of sight, too? Or if not, maybe I can still issue abstract orders like "clean" or "fix," and let them figure it out?

Anyway, I have some thinking to do.

The good news is that we're pretty much back to a place where the game looks good, which should enable recording footage for the upcoming teaser video. There are a few gameplay things still missing, which the script calls for. So I may tackle those next. But it's a relief to have the game back on the tracks again :)

Tags: Ostranauts