So the first month of 2016 has come and gone. We begun January with finishing up the prototype we made for Christmas. The game was far enough along that dialogue was sort..of.. displaying? You could click a button to open up a facsimile of a dialogue window which read content from an xml file. The basics of importing text from Articy into Unity was in place. You could select your options and get your answers based on the dialogue node tree.
Some stuff didn’t work so well however.. The main character was a black ghostly silhouette of a man which could path-find its way around but on some computers got stuck in a Lynchian horror nightmare where you run as fast as your legs can go yet move at a glacial 5cm/h pace. We’ve since fixed that but as with all bugs and graphical glitches it’s excellent dream sequence fodder.
So here’s what got done in January:
Interior lighting system
We tried a bunch of different ways to light up our interiors with natural sunlight which would change by time of day. Four states in total: morning, noon, evening and night. For a while we had an additive system which used a basic background image, a neutrally lit render for me to paint over. Upon the background we added a light map with information about how much light and what colour came from which window. This had information on bounced light and transferred colour from object to object. While this gave us beautiful rich colours and a realistic global illumination look it also had the downside of adding several full resolution images to the pile of assets making up levels. That’s a map per time of day + the neutral base map. What’s more the additive layer contained too much information which meant that it tended to overwrite any hand painted brushwork I had done on the neutral background image. So that’s no good.
In the end the breakthrough came while we were trying to figure out how to light up characters in interior scenes.
A naive implementation would have cast the neutral background image in shadow and used in-engine lights to illuminate the scene and light up characters in one go. This is essentially what we do with exteriors during the night. However this method would have looked bland since real time doesn’t really get us that coveted and beautiful diffused bounce light ambience that we can get with prerendering. In the end we lit characters up with a mixture of a lightfield map for natural light coming in the window and in engine light sources for artificial illumination such as desk lamps and the sort. The lightfield map is essentially a normal map which dictates which direction light is moving on any given pixel. It’s also very small since we don’t need it to be terribly precise.
Turns out that the lightfield map is useful for other stuff as well! We can render out a single channel B&W image of the background as illuminated only by natural light. By using this shadow map with the lightfield map we can dim and colourize background art based on time of day and the weather outside. While not as exquisite as the additive method it’s a lot more efficient, saves us a ton of hard drive space and makes the base background layer the only image with color information which means I’m free to paint over it as I wish!
Highlighting of interactables
This was apparently a headache and a half! I consider myself pretty knowledgeable in common game graphics techniques but it came as a surprise that apparently finding the outlines of 3d objects is a relatively difficult task. Shows what I know. I’m told it’s done by enlarging 3d objects along the normals? We ended up using masks and edge detection for various reasons but that’s another post by kuubaas waiting to happen.
Attaching dialogue to interactable objects
Combine this with the highlighting and you have a game! There’s this imposter syndrome article making the rounds on the internet about creatives who feel like they’re still faking it. Not for me, no sir, the moment an object got highlighted on mouseover and clicking on it opened up a dialogue I felt like a super-MLG-pro-designer. What I’m trying to say it it feels good to have immediate feedback mechanics in the game finally.
Character scale matrix
We dicked around with a character shape matrix, a simple two slider system for adjusting thickness and height for npc variety using blend shapes. This posed some problems with floating feet but in general the proof of concept implementation seems promising so far. We’re also working on an IK system for placing feet on stairs which might tap into the floating feet problem.
Basic inventory & equipping system
Take all your clothes off, put them back on again, like a normal human being does every day.
Functional doors
They block pathfinding and can check said inventory for keys. Imagine a world with door tech which helps you out by checking whether you have your trousers on or not.