top of page
TOUCHED BY A SPECTRE
DESCRIPTION
Game project #3 at The Game Assembly
MY CONTRIBUTIONS
-
Visual scripting system in Tiled
- Dialogue and cutscene systems
- Particle emitters
- Gameplay features
TIMEFRAME
8 weeks (20h/week)
GENRE
Bullet hell
TEAM
4 programmers, 4 artists, 2 level designers
ENGINE
The Game Assembly's in-house 2D engine

"Help a young boy-turned-ghost on his quest to reunite the members of his favorite metal band by shooting down their egos... literally!"
Being our first game made entirely in one of TGA's in-house engines, development of Touched by a Spectre presented us with a number of new challenges. For one, the functionality provided by the engine is intentionally limited mostly to sprite rendering, so it was up to us to implement everything else, from the level loading pipeline to VFX.
As the main pipeline programmer for the project, I worked closely with our level designers to ensure they had the necessary tools to design and build the game's primary gameplay feature, namely its intricate and challenging bullet patterns. To do this, I had to figure out how to get data from Tiled (our editor of choice) into the engine, and also how to meaningfully convert this data into game objects. It didn't help that the engine doesn't have any built-in game object system, either!
After eventually coming up with a satisfactory solution in the form of a visual scripting system, I went on to make a couple of other tools and systems, and also implement some gameplay features. All in all, working on Touched by Spectre taught me a lot about what it takes to make a game from scratch.
As the main pipeline programmer for the project, I worked closely with our level designers to ensure they had the necessary tools to design and build the game's primary gameplay feature, namely its intricate and challenging bullet patterns. To do this, I had to figure out how to get data from Tiled (our editor of choice) into the engine, and also how to meaningfully convert this data into game objects. It didn't help that the engine doesn't have any built-in game object system, either!
After eventually coming up with a satisfactory solution in the form of a visual scripting system, I went on to make a couple of other tools and systems, and also implement some gameplay features. All in all, working on Touched by Spectre taught me a lot about what it takes to make a game from scratch.
VISUAL SCRIPTING SYSTEM IN TILED

BACKGROUND
We chose early on to use the Tiled level editor. Since I took on the responsibility of setting up the pipeline for importing levels into our engine, it was also my job to figure out how Tiled could be used to design bullet patterns.
Having played a fair bit of Touhou myself, I was familiar with the high complexity of its bullet patterns. Also, our level designers wanted the ability to create patterns that fit each boss' motif, such as a Guitar Hero-like pattern for the guitarist and Tako no Tatsujin-like pattern for the drummer. Naturally, I was at first unconvinced that Tiled, at its core a grid-based editor, could even be used for this purpose.
Then it occurred to me: Complicated patterns can and should be built up out of simpler patterns. Moreover, Tiled has support for putting arbitrary data on entities and linking them together. The last puzzle piece came in the form of the Composite design pattern, where nodes higher up in a tree can delegate execution to its children. With this in mind I set out to create a visual scripting system that could satisfy the needs of our level designers.
Having played a fair bit of Touhou myself, I was familiar with the high complexity of its bullet patterns. Also, our level designers wanted the ability to create patterns that fit each boss' motif, such as a Guitar Hero-like pattern for the guitarist and Tako no Tatsujin-like pattern for the drummer. Naturally, I was at first unconvinced that Tiled, at its core a grid-based editor, could even be used for this purpose.
Then it occurred to me: Complicated patterns can and should be built up out of simpler patterns. Moreover, Tiled has support for putting arbitrary data on entities and linking them together. The last puzzle piece came in the form of the Composite design pattern, where nodes higher up in a tree can delegate execution to its children. With this in mind I set out to create a visual scripting system that could satisfy the needs of our level designers.
IMPLEMENTATION
In the Tiled editor, each entity has an ID and a blackboard that can contain named variables such as floats, ints, strings, etc. For our codebase, I designed and implemented a GameObject system that took advantage of this by letting each game object copy and keep these properties during the import stage.
Each visual scripting node in the editor then had a corresponding derived class that implemented the desired functionality. For example, some nodes had the ability to spawn a particular shape such as a single bullet, a line of bullets, a circle, or even a user-drawn shape (like a pentagram). Some nodes acted like flow control for other nodes and could repeat a spawn command a number of times, or switch sequentially between nodes. Still other nodes had functionality such as signaling the boss to move to the other side of the screen.
During runtime, the boss (which had a link to a starting node) would each frame send out a tick, which would then get passed down the Composite structure of the node tree and eventually result in the spawning of some particular pattern of bullets. When the boss changed form after taking enough damage, it would switch to the next node in its list and a new set of patterns would begin.
Each visual scripting node in the editor then had a corresponding derived class that implemented the desired functionality. For example, some nodes had the ability to spawn a particular shape such as a single bullet, a line of bullets, a circle, or even a user-drawn shape (like a pentagram). Some nodes acted like flow control for other nodes and could repeat a spawn command a number of times, or switch sequentially between nodes. Still other nodes had functionality such as signaling the boss to move to the other side of the screen.
During runtime, the boss (which had a link to a starting node) would each frame send out a tick, which would then get passed down the Composite structure of the node tree and eventually result in the spawning of some particular pattern of bullets. When the boss changed form after taking enough damage, it would switch to the next node in its list and a new set of patterns would begin.


RESULT
Using my system, our level designers created a broad selection of patterns, from simple to very complicated - and sometimes very challenging! The guitarist had the pattern seen in the gif, the keyboardist could send patterns reminiscent of giant sound waves, and the singer (having a pope motif) would during a later phase send out bullets in the shape of a giant Christian cross.
All in all, I had as much fun seeing the vision of our level designers come to life as I had creating the system. At one memorable moment, a designer created a bullet pattern in the shape of the other's face, and seeing another discipline find the time to just fool around with tools I've made is for me the greatest possible compliment.
All in all, I had as much fun seeing the vision of our level designers come to life as I had creating the system. At one memorable moment, a designer created a bullet pattern in the shape of the other's face, and seeing another discipline find the time to just fool around with tools I've made is for me the greatest possible compliment.
DIALOGUE AND CUTSCENE SYSTEMS

DIALOGUES IN-EDITOR...
Having already used it for visual scripting, I realized there was so much more potential in Tiled as a general-purpose editor for our game, since TGA's in house engine has none. To satisfy a requirement we had on the inclusion of scripted events, I therefore created a cutscene system where images and parameters could be specified in Tiled and then imported into our engine. This system was used before and after each boss fight as a way to advance the story.

...AND IN-ENGINE

CUTSCENES IN-EDITOR...
Similar to but different from the dialogue system, I created a cutscene system which was used for the game's intro.

...AND IN-ENGINE
PARTICLE EMITTERS

IMPLEMENTATION
Using the Flyweight pattern, each particle stores just a few member variables while the emitter itself carries most parameters relating to visual appearance. The particles themselves are stored sequentially in an std::vector, updated in order, and removed using the swap-and-pop idiom once their lifetime is over. Graphically, each particle is essentially just a transformed and re-colored sprite, but for optimization purposes is rendered as part of an instanced sprite-batch of similar particles. Additive blending is also used for some emitters.

RESULT
This system was used both in-game for hit effects and to add interesting visual elements to menus.
GAMEPLAY FEATURES

COLLISIONS AND PLAYER STATES
I implemented the game's collision system as a simple circle-vs-circle test running over all colliders in the scene, where the collider radius and also a collision layer of the entity could be specified in Tiled.
For the player, I used a simple system where each player state was implemented in a method, and the current state to execute was determined by a method pointer held as a member in the Player class. In addition to implementing the fundamentals such as movement and shooting, I also implemented a "death bomb" feature as seen in Touhou, and a visual feature where defeated bosses would follow the player around as a tiny flame - a spectre, if you will.
For the player, I used a simple system where each player state was implemented in a method, and the current state to execute was determined by a method pointer held as a member in the Player class. In addition to implementing the fundamentals such as movement and shooting, I also implemented a "death bomb" feature as seen in Touhou, and a visual feature where defeated bosses would follow the player around as a tiny flame - a spectre, if you will.