Item Placement and Lighting

Hey Folks! I managed to get another day of mostly coding done, which always feels good.

First up was item placement. Yesterday's issue I noticed with the items ignoring placement rules turned out to be a minor one. For some reason, the check I added to make sure items couldn't be placed illegally was just being called in the wrong place. I'm not sure if I moved it when working on another thing, or if I was testing it some weird way. But after some moving around of code, that was working normally again.

Then, I wanted to see if I could expand yesterday's line-of-sight (LoS) code to also work for lighting. The good news, it does! It didn't take too much work to figure out how to use the LoS code to calculate where a light shines vs. casts a shadow. And it even supports color and color blending (e.g. with other, overlapping lights)!

The bad news: the way the light intensity diminishes over distance looks a bit weird. I'm still trying to figure out what exactly is happening, but it appears that the light goes really far in each of the diagonal and cardinal directions. So I get these sort of star-shaped patterns in lighting blobs.

At first, I thought the LoS code was somehow doubling up on those tiles. It uses something called "octants," which basically divides a full 360 arc into 8 equal arcs, and perhaps where those octants meet, tiles were getting light added twice. So I cleverly halved light intensity along each of those directions.

That worked at first (with a red light), until I started using other light colors. The star pattern seems to come and go depending on color, which means this may be a perceptual color blending issue. It also may be a falloff issue, since I was trying to do realistic attenuation based on inverse square law.

So as of now, I have a really cool lighting system with some distance-fading bugs, on top of a really cool LoS system. I might get some really neat ship interiors if I can get this working, so more on this tomorrow.

Which reminds me, I may not get much done tomorrow. We have a doctor's appointment for the baby, as well as a vet's appointment for the cat, so it could be a wash as far as productivity. I'll do my best, though, and maybe catch up in the evening or weekend. Or say "hell with it" and call it a day off :)

Anyway, hope everyone has a good night!

Comments

matsy's picture
matsy

Your line of sight system sounds really cool! Not only from a ship design point of view but being able to just see 'your' line of sight really opens up things from a story point of view. Sabotage, mutiny, going as far as some sort of Host virus like in John Carpenter's The Thing!

I think long term it would be beneficial to have the ability to see areas based on CCTV, or where your crew members/mates are with an implant of some sort!

dcfedor's picture
dcfedor

Thanks! And I agree: blind spots can be a valuable design tool, and I'm anxious to see how they can be leveraged. And yeah, I'm hoping I can keep the line of sight system accessible enough to plop down other sources of vision around maps, like CCTV. A paranoid captain is a live captain!

Dan Fedor - Founder, Blue Bottle Games