What comes before: some technical notes about What Comes After
6 min read

What comes before: some technical notes about What Comes After

"Do you want to make a game?" asked @fahmitsu. Hell yea? Then my nights and weekends filled with sitting in front of my laptop. What a terrific way to getting through this year
What comes before: some technical notes about What Comes After

2020. What a year. Started with the largest forest burning in Australia, then a pandemic storm over the world.  And what do you know, after years of making games finally I have my first ever steam-released game!

The game is called What Comes After. It delivers a story about a girl who overslept on a night train, and it turned out at night the train was sending people to the afterlife.

This is a side-scrolling adventure narrative game. Basically you just walk and talk to interact with characters in the game.

What Comes After on Steam
What Comes After is a side-scrolling adventure and a short heartwarming story about learning how to love yourself. Help Vivi in her journey on the train to the afterlife and back.

Sprinkle of Codes

I'd never made such a good game with only a walk and talk mechanic. I mean, look at this.

my version of what comes after

But thanks to the amazing story, art, and music, my task was just sprinkle some codes and then everything interwoven into this piece of art.

This game actually was a side project from a bigger project which began around early 2020. It then got suspended for a while for some reasons. Many building blocks in this game were borrowed from that bigger project and then furtherly developed to fit its needs.

Building Blocks

We are using Unity for our game engine. Specifically version 2019.4.1f1. We preferred this version because it's an LTS (Long Term Support) version of Unity, so if there's any fix or patch we can (hopefully) update it swiftly.

Initially the project called as Train of Thought

We're also utilizing tons of premade tools. Thanks to Unity's user base community and its asset store, there are thousands of them. Was it made the development easier? Yes and no. Yes, you don't have to code everything from scratch. No, because you should understand how the plugins work and make sure they work together.

Here's the list of plugins that we used on this game:

  • Corgi Engine, a platformer engine. I was too lazy to code sidescrolling game. I've ever made a platformer game. I understand we need to implement animating the player, making sure it stands on the floor, switching between its states, doors and teleporters, uh... no thank you. Thanks to Corgi Engine, those things already pre-made!
  • Pro Camera 2D, a camera plugin that acts as cameraman for your game. Do you want to put boundaries so the camera doesn't enter a certain area? Do you want to make it smoothly transitioned into a specific place? You can do it easily with this.
  • Yarn Spinner, a story engine. This plugin main usage is to show stories line by line. We heavily extend this tool and mainly design our story logic (and even cinematic!) here. Why yes, you can put logic and write custom commands to call Unity's functions from here too! We'll talk about those custom commands later.
  • I2 Localization, to localize our UIs. It still amazes me how easy it was to fetch the localization from Google Docs and preview it directly inside the editor. Yes, it's pricey, but oh boy the features easily exceed the price.
  • EnhancedScroller, to show data driven scrolling UI.  Why? Because it can load and show hundreds of story line data really-really fast into the UI.
  • DOTween, a tweening plugin.
  • EventManager, so we can loosely coupled the implementations.
  • TextAnimator, to show squiggly and fun text animations.
  • Procedural UI Image, for easy UI prototyping and making a plain rectangle with rounded corners.
  • Steamworks.Net, for connecting our game with Steam.
  • SoundManagersPro 3, for managing sounds... obviously, heheh. Sadly this plugin is no longer updated, but fortunately it's free and opened its source so we can fix some things and add some functionality further.

Folder Structure

Because we are using lots of plugins, and each plugin has their own folder structure, it's better to separate our code to their own place. We put all of our game-specific assets into a folder called "Core" so there's no plugin interfere with ours.

Unless.. if there's any plugin which also has folder named "Core". Hope there's not any.

our foldering system

Yarn Spinner

At first we planned to use Fungus for the story engine. I even made a parser to convert spreadsheets to Fungus' nodes so story editing can be "loosely coupled" from Unity. But somehow even the smallest cinematic need so much work and still need Unity's Editor too much.

Fortunately I've seen Yarn Spinner when I was following Night In The Woods (NITW) development. "NITW is a platformer, it also has dialogues, and also cinematics, hm.... maybe... maybe I can use this?" Yes, me, you can use it, and I'm glad you used it.

Compared to Fungus, Yarn Spinner is so barebone and almost got nothing beside the dialogue system and calling Unity's functions. But that's why I love it! We can build our own commands and not be overwhelmed by any other commands.

For an example on What Comes After we made these commands:

  • moveAndWait, move the character and wait for some seconds before continuing to next line
  • teleport, immediately move a game object to specific place.
  • playSound, to play sound of course
  • disallowPause, prevent player to pause the game
  • fadeOut, fade the screen to black

and so much more.

how we created the cinematic to shake the camera, move the characters, and play sounds

To trigger the dialogue, we simply call a specific talk node to run when the player hits Corgi's collider.

NPCDialogue component will trigger which node to trigger

One thing I love from Yarn Spinner is it has its own node editor! So convenient to look at connections between nodes. But still I prefer VSCode to edit the yarn file because sometimes this editor kinda buggy.

our whole game

World Placement

Because we're trying to use the Yarn Spinner as versatile as possible, many game objects called by its name by using GameObject.Find(). Yes, yes, not the most efficient thing, but it works okay as it is not called very often. Because of that, we need to make sure there's no two NPC game objects with the same name.

As a bonus, here's how we organized the game objects on each train's platform.

Pro Camera 2D + Corgi

Corgi has its own camera system, but I prefer Pro Camera 2D because it has more functionalities. To tackle this issue... I need to understand how Corgi's camera works. Blessings and curse of using too many plugins, haha.

After some readings, the camera simply needs to listen to Corgi's event. Here's a little script that I wrote to connect them. Put it on your camera instead of Corgi's camera

End of the Line

It was a journey and it was fun. Moreover this project is a small project but has that "carry on to the next project" kinda thing. What comes after? Next project of course.

Enjoying this blog? Support me!