Search Unity

Smoke, mirrors, and scrolling textures: Behind the scenes of TUNIC

May 26, 2022 in Games | 14 min. read
Cartoon fox, in a forest holding a sword and shield
Cartoon fox, in a forest holding a sword and shield
Share

Is this article helpful for you?

Thank you for your feedback!

Indie creator Andrew Shouldice (ISOMETRICORP Games) joined Unity on Twitch at GDC to share some of the secrets behind his action-adventure game.

TUNIC is a game about discovery and adventure, starring a tiny fox who battles monsters while searching for secrets and collectibles in a sprawling world. While drawing inspiration from gaming giants like The Legend of Zelda and Dark Souls, the game has charted a unique course to success. Currently sitting at a solid 85 on Metacritic, reviewers are calling TUNIC “a masterpiece of adventure and exploration.”

Lead Developer Andrew Shouldice joined Unity’s Hasan Al Salman and Unity Insider Joyce Plokker (@MinionsArt) on Twitch to pull back the curtain on the project he’s been working on since 2015. Read on for insights not included in the GDC session, or scroll to the end to watch the full Creator Spotlight stream.

This content is hosted by a third party provider that does not allow video views without acceptance of Targeting Cookies. Please set your cookie preferences for Targeting Cookies to yes if you wish to view videos from these providers.

Environmental storytelling

“I’ve always held dear that feeling of wonder and discovery we often attribute to old games,” says Shouldice. “They’re full of secrets, but they don’t really tell you anything, other than what's in the manual – but that’s considered a separate artifact from the cartridge itself.” 

Shouldice wanted to guide players with a light touch to emphasize TUNIC’s mysterious atmosphere. The game uses environmental storytelling (communicating events through gameplay rather than expository dialogue) to achieve this, with playful nods to nostalgic elements, such as instruction manuals.

By bringing back the classic instruction manual, rarely seen today, TUNIC transports the pages into the game to be discovered as collectibles. Players who find them are rewarded with tips and tricks, maps, descriptions of enemies, and clues to find other hidden treasures – provided they can decipher the cryptic text and piece everything together.

“The prize you get from finding a secret might be an upgrade or currency, but the real treasure is the question mark,” explains Shouldice. ”What’s behind this door? What’s on the other side of that river? That’s the feeling I wanted to evoke.”

Like Link or the Chosen Undead, TUNIC’s protagonist is silent, but not in the way you’d expect. Most in-game text and dialogue is rendered in an inscrutable, glyphic language designed to make the players feel immersed in a world where they don’t belong. Instead, they must rely on their own intuition and contextual cues to figure out what’s happening. The result is a refreshing take on storytelling that makes TUNIC’s narrative and worldbuilding stand out.

Graphics and perspective

TUNIC’s world is rendered in bright, polygonal graphics and viewed primarily through an isometric perspective. Early versions of the game featured blocky, origami-like models with completely flat textures, which Shouldice says reflected his modeling skills at that time. As he grew more confident, the graphics evolved, becoming more detailed and befitting of the ruined world he envisioned, while remaining faithful to the original “low-poly” aesthetic.

From a game design standpoint, an orthographic perspective is the key to hiding many of TUNIC’s secrets. “When you’re using a true orthographic camera, there’s no foreshortening of any elements, so there’s no geometric trickiness – we’re not doing anything special that way. But because we’re using an isometric orthographic projection, vertical lines line up perfectly, and will always line up perfectly, which makes it easy to hide things.”

Shouldice expands on this: “Early in the game, there’s a hidden path behind a waterfall that you can slip through. If we were using a perspective camera with any sort of FoV, it would be obvious. You would see objects moving around and the shifts in perspective would give the secret away.”

Using an orthographic camera introduced perspectival challenges that Shouldice had to overcome to create a sense of scale. “For circumstances where we want to be grand and show the player something very far away, like a giant forest viewed from a cliff edge, there’s some trickery there,” he reveals. “I used stacked cameras. You have your orthographic prism (parallel frustum) and then glued to the end of it is an actual perspective frustum containing the distant objects.”

Lighting and shaders

To ensure optimal performance, Shouldice used dynamic lighting and Global Illumination (GI) in TUNIC, and carefully considered the light count: “Because deferred rendering isn’t supported with ortho cams, light count was something I needed to keep an eye on. I used precomputed GI to do a lot of the lighting rather than Point lights, and leaned on batching to keep draw calls down.”

He used to write shaders by hand, but decided to use Shader Forge’s node-based shaders for TUNIC. “Even though I can write code, I’m a fairly visual person, so it was freeing to be able to see live previews and organize my thoughts spatially,” continues Shouldice. “The node editor clicked with my brain in a really nice way. It’s supremely noodly, and so much fun!”

Shouldice also made extensive use of scrolling textures to light up elements of the game world, substantially reducing the complexity of the task while achieving gorgeous (and highly performant) results.

Early in the game, TUNIC’s hero opens a golden doorway by interacting with a statue that emits a pulse of light when touched. Shouldice achieves this effect by using a few different components in the Unity Editor and Shader Forge.

The initial points of light – known as “starburst” – derive from three animated meshes, each rotating slightly out of sync. A donut-shaped “aura ring” surrounds these meshes, and by projecting a scrolling UV texture along this flattened cylinder, Shouldice makes the texture scroll outward, creating a radial glow. For this effect, UV coordinates are scrolled and multiplied before they’re inverted at the end to create the glow’s white-on-black effect.

By applying the scrolling texture to different meshes, Shouldice was able to change the glow’s behavior. In another example, he funnels the texture up a narrow, cone-shaped mesh to create the effect of magical energy coalescing skyward.

This content is hosted by a third party provider that does not allow video views without acceptance of Targeting Cookies. Please set your cookie preferences for Targeting Cookies to yes if you wish to view videos from these providers.

“One of the things I really like about this technique – applying basic effects to specifically authored meshes – is that by adjusting things like UV coordinates, you can make the same material behave in different ways,” asserts Shouldice. “In this case, for the energy being scooped up and firing into the sky, you’d accomplish it by having the UVs closer or further apart on your mesh.”

Another one of these effects involves motes of light that trace energetic patterns in the air before gathering at a focal point and slamming into a statue. This could have been attained by using particle effects or Bézier curves, but Shouldice returned to an old reliable, asking himself, “What if we scrolled a texture here?”

In this instance, the trails of light are actually long tubes authored and UVed in Blender before being twisted, rotated, distorted, and duplicated. Because each tube has UVs running along its surface, colored textures with soft gradients can be scrolled across them, with post-processing and “the razzle-dazzle of Bloom” applied at the end to conceal any imperfections.

Shouldice was careful about color selection to ensure these balls of energy represented the white-hot heat he imagined for the scene. He notes, “I go for something with a really high chroma, something really saturated, but I pull that saturation down a little bit so that the other channels get to have some fun as well… Don’t just pick chromatic blue or red or green – pick a secondary color and pull it down so the color on the opposite side of the wheel makes a little contribution, so that when you hit that HDR it blows it out to white.”

Character control, combat, and animations

Shouldice called on Unity’s NavMesh system to influence both enemy and player character behavior. By default, putting a NavMesh agent on an enemy will guide them to a specific target. The NavMesh tells the enemy where to go, communicates with the physics system so the rigidbodies representing the monsters can collide appropriately, and also drives root motion-based behavior.

Shouldice similarly used the NavMesh agent to create boundaries in the game world. He consulted the NavMesh agent regarding the direction it might want to go, before feeding that information into an animation controller via parameters, preventing the player character from leaving the NavMesh.

Enemy orientation is a big part of TUNIC’s gameplay, which uses animation-based combat à la Dark Souls. Many of TUNIC’s animations were created in Blender before being enhanced in Unity with animation curves. Shouldice wanted a fine level of control over things like which part of the enemy is facing the player when engaging in an attack, and hitboxes being connected to specific parts of the character models: “If you’re swinging your sword and it hasn’t made contact with the enemy, it hasn’t made contact with the enemy!”

This approach allows for more nuanced combat mechanics, like tricking enemies into hitting each other, and boss fights that require skillful spacing, dodging, and targeted attacks to overcome them.

Shouldice even created a delegate system to randomize how enemies and bosses react to the player’s physical location. For example, going behind a boss might trigger one of several possible mechanics, whether that’s the boss spawning minions, breathing fire, or lashing out aggressively with a left or right claw.

Boss behavior code snippet:

                                         if (far) { // FOX OUT OF MELEE RANGE Mathx.Choose( delegate { cachedAnimator.SetTrigger("ACT_freem"); }, delegate { cachedAnimator.SetTrigger("ACT_deployAdds"); }, delegate { StartCoroutine(gunSequence()); }, delegate{ cachedAnimator.SetTrigger("ACT_advancingSwipe"); }, delegate{ cachedAnimator.SetTrigger("ACT_missiles"); }.); }

Implementation of Mathx.Choose:

    internal static void Choose(params System.Action[] paramList) { paramList[Random.Range(0, paramList.Length)] (); }

Adding polish with playtesting and QA

Great game development can’t happen in a vacuum – even when you’re flying solo. Shouldice sought out many different avenues for playtesting and feedback. He consulted peers in the Halifax gamedev community, a group he’s actively involved in growing, and spent two months in a cabin with other developers in Sweden as part of the Stugan accelerator program.

Shouldice’s publisher, Finji, played an instrumental role in turning his project into a polished game, providing a sounding board for ideas as well as QA testing support. “It would be an understatement to say that they were just publishing the game,” he explains. “We did traditional playtests – watching over players’ shoulders or recording playthroughs – but one of the most valuable things with Finji in particular is having a QA team that is as absolutely phenomenal as theirs is.”

Watching others play and collaborating with the QA team at Finji helped Shouldice sharpen the exploration aspect of the game, so that players could jump in and lose themselves in TUNIC’s nostalgic world without feeling frustrated or confused about where to go next. The response has been overwhelmingly positive: “Whenever someone emails us and says, ‘You made me feel like a kid again!’ it’s like… Yes! It’s magical to me, having a bunch of ideas scribbled down on paper about how I want people to feel, which get turned into bits over seven years, and then compiled into a binary, and then people have that emotional reaction on the other end. It feels sort of miraculous.”

Advice for aspiring indie innovators

So what’s next, now that TUNIC is out in the wild?

“I intentionally did not think about the next project because I wanted to stay focused,” admits Shouldice. “I’m probably going to take a break for a little bit. If I do make a game it will probably be something small, maybe not even commercial – perhaps something with words.”

Closing out the conversation, Shouldice offered advice to aspiring indie developers looking to make games of their own: “Jump right in, share your work with people, and make as many terrible games as fast as you can! Assume that you’ve got this queue of games inside of you, and the first 100 or so are really bad. Make them, get feedback on them, learn from them, and just keep going.”

TUNIC is now available on desktop (PC and MacOS) and Xbox Series X|S, Xbox One, and Xbox Game Pass Ultimate. For more updates and developer tips, you can follow Andrew Shouldice (@Dicey) and @TunicGame on Twitter, and check out the full Creator stream below.

This content is hosted by a third party provider that does not allow video views without acceptance of Targeting Cookies. Please set your cookie preferences for Targeting Cookies to yes if you wish to view videos from these providers.

May 26, 2022 in Games | 14 min. read

Is this article helpful for you?

Thank you for your feedback!