The April Update
Progress!(Today’s music is
Progress brought to you by
.)
April was a productive month!
A little story: They’re building a new school campus in my town. This is very exciting for a place in the middle of nowhere with less than 1,000 residents. For the first six months of building work, almost nothing could be seen on the new campus site. As you drove down the hill into town the new site would be laid out below you like a map. And all you could see was dirt and clumps of grass, weeds, and cactus. There
was rather a lot of dirt being moved back and forth by heavy equipment. But it seemed like that’s all that ever happened. Just moving dirt. Preparing the ground.
Then, one day, overnight, like a concrete mushroom, an elevator shaft appeared. The next week, the walls for the gymnasium suddenly stood in the empty field. By the end of the next week the concrete and ironwork for the elementary and high school wings was rising. By the end of the month the shape of the completed building was clearly recognizable. Months of nothing and then, suddenly, there it was – the new school. Not finished, but fully-formed. It was easy to imagine it complete.
April has been that month for me. I have spent
so long preparing the ground and then, suddenly, here it is. Feature complete?
This is going to be a technical summary of the month’s work. There’s not a lot of narrative progress, or stories from real archaeology to share.
Shaders! (I love ‘em?)April began the way March ended, with the ruins of the PreConquest church. I wanted to depict the un-burning of its thatch roof. A good, old-fashioned noise-based dissolve shader seemed like the perfect tool to achieve this effect. So, I cracked open Amplify Shader Editor and started throwing something together. I very quickly created a vertex-colored, dissolve shader with emissive burned edges, and applied it to the thatch. Once I wired it up to the rebuilding code, it worked just fine. Lovely.
Just needs some sparks.ASE was still fresh in my mind and my thoughts soon turned backward toward one of the old chestnuts of this project: flat shading and how expensive it is. Years ago, at the start of the project, I gave up on flat shading by any other means than brute-force 0˚ smoothing. No smooth groups. Every shared vertex was duplicated for every face it was a part of. Fine. It worked and that was that. But it doubled, or even tripled the amount of verts in the scene. I develop on a Mac and Macs just wouldn’t do geometry shaders (still don’t) and it seemed like flat shading required some geometry shader magic. In hindsight, this might have been a mistake in my understanding.
Anyway, I went back to flat shaders and tried again, using partial derivatives (ddx, ddy) which I could have sworn Macs just couldn’t handle. Turns out – now, at least, but maybe always? – they handle it just fine. Flat shading without duplicating verts is a thing Macs can do. So I’ve done it.
Except that it seems like this broke triplanar shading, and I had just made a post about how lovely this is in the game. I spent time deep in
Ben Golus’ tutorial, recreating in ASE what he had created in code, and, eventually, after some gentle encouragement by Ben over on the Unity forums, I had a vertex colored, triplanar colored, partial derivative flat shader with triplanar normal mapping for surface texture. I think it also does dither fading? It’s a beast of a shader, probably wasteful, but it can’t be any more wasteful than tripled geometry. I hope. Anyway, it’s a thing of beauty, and I love it. And I’m going to apply it to absolutely everything in the game. I’ll keep you posted on the difference it makes to the framerate.
I have no idea what I’m doing. A map of my usual baroque logic.Audio: Baby StepsThe toddle of progress continued undaunted into foreign territory: audio.
A while ago (a year ago?) I laid the foundation of the audio system in the game. It’s based heavily on John French’s tutorials over on
GameDevBeginner. (This is also the inspiration for that metronome system where I created that Unity-crashing-infinite-loop that made me despair last year – remember that?). I returned to those foundations and started to re-integrate them into everything else.
Turns out, I’m a real noob with audio. I’ve put together some SFX and composed some “music”. I think they’re flat, lacking in imagination (and competence). However, they’re enough to let me start shaping the sound of the game. It’s not what you would call “adequate,” but it’s a start. It’s a start. It helps me to know what I
don’t want, at least.
See, audio.The best thing about all of this audio work is that I got to fire up the Switch and just stand in an open field in Hyrule for 20-30 minutes, listening to the soundscape and its patterns of environment, SFX, and music.
Timelines upon TimelinesIn this game, time is more important than space. So, it’s handy to have some kind of map of time. A while ago I introduced a timeline to my inventory UI. It serves as a kind of map. It shows where the player is on the span of the game’s history, what date any artifact will let you travel to, and the dates of important events the player might want to see. The problem is, it shows all of this information on a single timeline. This month I started trying to make the timeline more readable. I introduced timespans – showing the full span of time the wormhole the player users to jump around in time covers, and also the full span of the lifetime of each artifact in the player’s inventory. These, I thought, could also be helpfully stacked on top of each other. Nope.
I’ve now split the timeline into three separate lines with each one showing just one kind of information. The timeline showing the player’s date is always visible. If the player is examining and artifact, the artifact timeline animates into view. If there are an events to visit, the events timeline animates into place. The separation of timelines along with the animation conveys information much more clearly. I’m not that happy with how it looks, but I think it’s a lot more readable.
Three timelines. Still some problems.Suddenly, a buildOne morning about three weeks into April I discovered that the game was behaving as it should. You could rebuild buildings, collect artifacts and architectural fragments, jump around in time, and witness special events. It was … feature complete?
Groundwork, groundwork, groundwork and then, suddenly, a building appears. (See, that story at the start of this update paid off.)
I have never attempted to create a build of the game. It’s such a house of cards, a build would certainly knock it over. But, encouraged by suddenly being stable-ish, I thought I’d give it a try. Surely it wouldn’t work.
It built on the first try.
Whaaat??? Sure, it didn’t exactly run, but the problem was fairly easy to diagnose: I had forgotten, like I always do, that Unity does not automatically load the scenes that are loaded in a multi-scene project in the Editor. You have to do that yourself. So, I spent some time coding that – getting the timings right was the hard part – and the next day I had a functional build!
But it was sloooooow. Like, slower than in the editor.
I dug around a bit more and (re)discovered that Mac builds are “special”. It was a problem with filling a retina screen using integrated graphics and crazy geometry that triples the amount of verts (because I haven’t upgraded my shaders to the proper flat shaders yet). So, I quickly created a system which silently sets the resolution to no more than 1920x1080, turned off vsync, and disabled Unity’s retina support. That sped it up to a nice 50-60fps.
I have a build!
Finally crafting a narrative.Remember the road map? I feel like I’m really close to the destination: a demo. I am optimistic that it will be ready by the end of the summer!
Now that the system is … stable … I feel like I have created a toolset to allow me to craft narratives (and some light puzzles) using time, old buildings, and junk people lost or threw away. That has been the goal all along. But now I think I can actually start to do this in earnest. I can setup ruins to rebuild, and scatter artifacts to find, and see how those shape the narrative(s).
I am truly excited!
There are still many, many things to do. There are buildings to ruin and rebuild, artifacts to model, sound effects to find or make, music to compose and record, marketing to ramp-up. The list goes on. But it feels doable. For the first time in a long time. It feels doable.
Crazy!