Today I did some work on lighting. I added a system that keeps track of whether you’re outside, or in a building, or in a dungeon, and then changes things like light color, intensity, and position to create the right mood. I added torch models with point lights on top, which give a little more lighting to the scene. I had to turn down the shadow resolution to Unity’s lowest setting in order to keep performance reasonable on my laptop. According to Fraps I’m getting about 45 FPS at 720p.
I got rid of the custom physics stuff I had written, so now I’m using Unity physics to handle movement, collision resolution, raycasting, etc. The main reason for that was performance. I liked having control over everything. For example I still need to figure out what I’m going to do about pausing physics when the game is paused. I’m losing some control by using Unity physics, but the performance has improved so I guess I’m sticking with it.
Right now I’m using a ton of little cubes, one for each cell on the map that’s blocked. I have a feeling that might be a performance problem, and I might need to do some smart stuff with joining adjacent blocked cells together into a single physics collider. For now I’m not going to worry about it too much though.
First I turned off the toon shader and added a little smoothness to everything to get a hint of glossiness.
I added a fill light in addition to the directional light and ambient lighting. It’s a wide-angle spot light that hovers above the player, so it gives a similar effect as putting a vignette on the camera. It turns out it was a little tricky figure out exactly where to put it and how bright to make it because of how building go up toward it. You don’t want the buildings to be super bright, but you also don’t want the fill light to be under the buildings’ height so the tops of the buildings are filled at all.
Now there are three lighting colors to play with: ambient, directional, fill. The ambient color is sky blue, directional is lime green, and fill is peach.
Finally I added screen space ambient obscurance and a little depth of field to the camera. I’m not sure how obscurance is different than occlusion but Unity’s manual page said it’s newer, better, and maybe faster, so I’m running with it.
Honestly it’s probably too early in development to show off gameplay video but I’m trying to err on the side of oversharing. Hopefully people understand this thing is still basically a heavy prototype.
I’m working on damage effects. For a little while I had damage modifiers where for example skeletons would be strong against physical damage and weak against ice damage, but I’ve removed that so everything just deals one point of damage.
Instead I have status effects that get placed on a unit when they get damaged by certain types of damage. For ice damage, the unit freezes in place for a couple of seconds. For fire damage, the unit doesn’t take the damage right away but instead takes it over the course of a couple of seconds.
Off-topic, I realized my fonts weren’t scaling with the screen resolution, so when I try to play the game in higher resolutions the font gets really tiny. So I’m working on fixing that — I think I have a fix for it but it means going in and changing how I specify font sizes from point values to percentages of parent UI element size.
I’m back in Seattle after being gone for almost three weeks. It’s good to start being productive again.
I made a new texture pallete with a wide variety of hues, saturations, and values. There aren’t any true blacks, whites, or grays, but I’m hoping that ends up being a nice creative constraint. Previously I had been using a 16 x 8 palette based on NES colors. I’m hoping this will be the last time I change it, it’s a pain to remap all the UVs.
I’m trying to make combat more interesting. In Halo there’s the “golden triangle” which is gun / grenade / melee, so I thought grenades would be a good way to start expanding the combat sandbox. Swords are already melee weapons, and I have wands which are ranged weapons, so I guess now my golden triangle is complete. Still needs more stuff though.
I added damage types and resistances, which I’m not sure is actually going to be fun but I’m trying it out for now.
I’ve also added damage indicators, with numbers flying off units indicating how much damage they took. In this gif the skeleton takes 0.5 damage because the grenade deals “physical” type damage and the skeleton has a resistance to that.