Game Architecture and Music of Lazuli


Hi everyone! I’m Yuankun Huang (aka. Kun), the gameplay programmer and music composer of IJKL Studio.

As we’re approaching the end of semester as well as the end of the first stage of this passion project, it’s quite an honor to share my experience in architecting the game as a developer, and composing music for the project as an “amateur” composer.

Game Architecture

Without any further ado, let’s jump into the game architecture.

As a passion project on which we did not have an adequately clear vision at the early stage, Lazuli took us a huge amount of time to figure out what we really want to develop and what exact story we’d love to tell. With countless ideas of level concepts and mechanics revealing themselves in our minds one after another, most of them were to be quickly visualized and tested in an “agile” manner, which didn’t allow us to pay much attention to project scalability or code maintainability.

When the story structure became clearer and richer, we were finally able to remake the game where all validated systems and mechanics were smoothly implemented.

Game Architecture and Scripts Diagram

Take the Anger level (chapter 5) as an example–we tried implementing a custom physics system to deal with the slope (ascending/descending) issue as well as one-way platforms. But it turned out to be much simpler to utilize 2D Raycast, PhysicsMaterial2D, Normal and Perpendicular vector operations from Unity’s built-in math and physics system.

Anger Level

With ScriptableObject, we managed to build a flexible game event system.

Game Event Assets
Game Event Listener Components

A dialog template (prefab) is requisite to add in-game dialogs conveniently.

Dialog Prefab Structure
Dialog Prefab Template
Dialog Custom Input (Example)

We also take advantage of some design patterns that enhance maintainability and scalability of the game.

  • Singleton Pattern
    • Event Manager
    • Game Manager
    • Level Manager
    • UI Manager
    • Audio Manager
  • Observer Pattern
    • Custom event system
  • Component Pattern
    • Modular design – maximize reusability of code while minimizing code reliance and inheritance
  • Flyweight Pattern
    • Object pooling – minimize the generation of unnecessary copies of game objects

Game Music

As an enthusiast of video game soundtracks and film scores (as well as a big fan of Hans Zimmer :D), I’ve always dreamed of writing music for storytelling and self-expression, especially with orchestral instruments.

Since I’ve long been enthralled by the power of good melodies, I believe that a good melody with deep and sincere emotions is what makes a piece memorable. Those fancy techniques and music theories would just come within your grasp whenever you need them.

If you know how to tell a story, then you can write music. 

Writing orchestral music requires knowledge in instrumentation and orchestration, as well as basic understanding of the MeHaRyTe method–melody, harmony, rhythm and texture.

To come up with a good melody and harmony is usually the first challenge, while enriching and polishing it to make it a complete track is even more challenging for a beginner like me.

Before doing instrumentation and orchestration, it took me some time to practise writing basic melodies and adding harmonies to them.

An Example of Melody with Harmony on Piano

With a melody and harmony (no need to be 100 percent settled), my next step was creating a palette for the instruments I would use. The instruments should coordinate well with each other in terms of timbre and pitch range.

Take the LAZULI Theme as an example. 


The palette consists of celesta, piano, violins, celli, basses and woodwinds, where celesta was replaced by a music box (taking account of the price difference). Celesta sounds like “stars” and perfectly matches the game design. Piano works in most cases as it is a percussion instrument that can contribute a lot to both melody and harmony. Violins and celli were chosen because of their “gentleness” that helps create a relaxing and moving atmosphere. 

At the beginning, celesta contributes to melody the most, while piano is for harmony. As the music progresses, strings come in to enrich rhythm and texture, followed by celli, basses and woodwinds.

I noted down the initial ideas on paper and moved them to notation software. Though it is quite efficient to write drafts in a notation software like MuseScore or Notion 6 (and it took me no longer than 2 days to finish this piece while developing the game itself), we should still always use a DAW (Digital Audio Workstation) for better mastering and higher quality. In this case I didn’t, so there’s plenty of room for improvement.


That’s all for today! Please don’t hesitate to leave any comments so that we can have a good discussion and learn from each other!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create your website with
Get started