Lighting Looking Good!
Hey Folks! As predicted, yesterday was a bit of a wash for productivity. Most of the day was chewed up by the baby's doctor appointment and a vet run. Fortunately, GOG.com's sale finale was worth writing about!
Even so, I did manage to get a small but important fix in for the lighting model. It corrected the star-pattern that was appearing in light calcs, which were due to the edges along each octant getting double light calcs in some cases.
And today, after some testing, tweaking, and feature-making, check it out!
What we see above is a combination of a few things.
First, the line of sight code is enabled here, so we can only see things that "Mal" can see from his current position. Namely, the current room, a bit into the blue room on the left, and a dark area of the room below (a bit hard to see, but there are totally dark tiles revealed down there).
Additionally, the fixed lighting model creates those nice blobs of color we see on the floor and walls. Light fades out from the center until it's gone, and where lights overlap, a blended color appears. It also uses the same line of sight checks that Mal does, to cast shadows. I ended up turning off symmetry in the visibility and shadow-casting code, as it looks better. I'll have to see how that affects AI later.
Finally, there are some snazzy glow effects on the map. I've seen some pixel-art games out there with some really fantastic lighting, and I wanted to see if I could replicate it. In the end, it turned out to be pretty simple to do. Each light has a "glow" image specifically tailored to it, and attached to it.
The light fixture itself is a dull cray rectangle (the lamp housing), and is hardly visible with the lights on. But the real magic comes from a wide bloom or glow effect, which is just a special image drawn with a soft brush and hard, bright center. The fixture is on the same layer as all ship items, like furniture, but the glow is on it's own layer atop that. This way, the fixtures can get the same tinting the rest of the ship gets, but a light's glow is not darkened by any shadows.
When you put it all together, I think it creates a really visually interesting space. It feels futuristic, and particularly with the glow, a bit cinematic, too. (Basically, it's a faked lens flare.) Colors can be used to set moods (cold and clinical, warm and inviting), and shadows can cast doubts.
There's way more that could be done, such as directional lights (flashlights?) or animated lights (sparks?). But for now, this should be robust enough to see if it's worth doing more. From here, I may swing back to item interactions and inventories, to flesh-out the crew sim aspect some more. I may also need to side-step into tool-making to help me manage the growing data files in this prototype.
And I'm also probably due for some NEO Scavenger work, if not a new build. Lots to do! For now, though, it's the weekend. Have a good one, all!