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,'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!

IMAGE( Mal can't decide on which light color to decorate with.

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!


matsy's picture

What are your thoughts/plans for the drawing of the ship/area when the player isn't viewing that characters POV but already knows the layout?

Using your image above. Mal walks to the blue rooms light on the left. Would the room he is leaving grey out like a fog of war, or would it black out completely?

As I imagine, big ships or new ships where you've only just found something of interest would be rather annoying having to remember the exact ship layout from memory but I guess it would add to a level of difficulty having to remember your way around, especially under pressure.

Kaaven's picture

Oh, I totally agree with matsy - at least a minimal outline of the previously seen rooms is a must. Roguelike 101, really ;)

On a separate note - the whole captain's line-of-sight shtick, I'm not sure about it... Not being able to see things basically means no planning ahead. Makes a great tool for building tension, but may kill the strategy/simulation part. Fog of war is good in strategies, where player controls multiple units who share vision (Civ or C&C).

From your previous posts, I got the vibe you may want to limit the vision to the captain alone. That's why I am wondering - how do you plan to deal with "out of his vision" vision? Or is it going to be an adventure game?

<--Mighty (mini)Mod of Doom-->
DeviantArt Gallery of MoD Sprites

dcfedor's picture

Those are some good questions! And ones I can't say I have good answers to. Yet :)

I hadn't decided anything about visited vs. unvisited areas that are beyond LoS. My hunch is that you're both correct that visited areas should still be visible. Perhaps something like NEO Scavenger's hex map fog of war is a good fit. (Visited but out of LoS is dimmed, and no creature activity is visible there.) And as Kaaven says, this is roguelike 101 :)

I disagree, however, that invisible rooms will kill strategy/simulation. One good counter example is FTL. While it's true that the player sees all crews' rooms, the unoccupied rooms start out invisible without CCTV upgrades, and I think that was a fun feature. E.g. there's a fire on board! But I can't see all the rooms to tell how bad it is.

Prison Architect also uses this mechanic, where staff presence dictates tile fog of war.

The question is, will this still be fun if it's just one avatar that has LoS, instead of all crew members? Can we leverage these LoS/lighting systems to make things more interesting? Maybe enhance desirability of ship systems like CCTV, fire detection, motion detection, etc?

Ultimately, this is something that'll be borne out by testing and iteration. And I'm willing to go either way, whichever turns out more fun!

Dan Fedor - Founder, Blue Bottle Games

Kaaven's picture

I can actually see several ways to make the captain-only view potentially fun, but it all would have to include a very competent and logical AI - or a bunch of dirty cheats. After all, the FTL only worked because the player's crew was totally player-dependent and the enemies really brain-dead.

If you want for the player to depend on the actions of the AI crew he cannot see and directly command, against a threats that he cannot see to competently assess, you must be pretty damn sure the AI is pristine and up to task (or make them invulnerable and always successful). Or make their actions insignificant, like in the adventure games where the crew/partners are only tools/set dressing.

Otherwise, there might be a lot of frustrations, I'm afraid.

<--Mighty (mini)Mod of Doom-->
DeviantArt Gallery of MoD Sprites

dcfedor's picture

This is true. The AI could totally hijack the fun if it's hard to understand or unreliable. And you're right that FTL probably got away with it because the AI was pretty simple.

In fact, even my recent "research" (a.k.a. playtime) in Rimworld has taught me that autonomous, indirectly-controlled AI can be a source of frustration. Even with the detailed "work" settings. Probably why they added a "draft" command to switch them to micromanage mode.

I was picturing the AI dealing more with eating, sleeping, fire extinguishing, and light maintenance tasks autonomously, and figured the player would be doing more complex things like rebuilding/crafting a broken ship item from parts. Exploring a ship and tactical firefights are something I definitely haven't worked out.

It may well be that there's a middle ground where the AI does the boring and common stuff (e.g. cleaning, restocking, etc.) and they switch to a tactics/draft mode when things get hot. And it may be more fun if the player can watch them all at once.

Only one way to find out, though :)

Dan Fedor - Founder, Blue Bottle Games