Built a series of playable ads, improving the development workflow step by step with the move to TypeScript and ECS.
Overview
A series of playable ads, around five or six in all, built with Phaser.js at GameDuo.
My work
- Built about five or six playable ads with Phaser.js
- Gradually moved from JavaScript to TypeScript and moved the build pipeline onto TypeScript types
- Adopted an ECS approach and then a Pure ECS framework
- Managed hierarchy in an ECS layer and applied it to Phaser.js
- Described skills, enemies and more in a data-driven way
Cases
Case 1 Gradually moving from JavaScript to TypeScript, down to the build pipeline
- Situation
- I made several playable ads in a row, and the existing code was JavaScript.
- Task
- While continuing to build new ads, I needed a way to keep the existing JavaScript code and the build tooling stable.
- Action
- From the second ad, I gradually replaced JavaScript code with TypeScript. From the third ad, I also rebuilt the build pipeline on TypeScript types.
Result
The tools, including the build pipeline, ran stably.
Case 2 Managing hierarchy in an ECS layer and applying it to Phaser.js
- Situation
- Much of the content I had to build could be assembled from components with ECS, cutting duplicate code. Phaser.js, however, lets only a Container hold a hierarchy. To represent a character made of several parts, I had to put the images inside containers and arrange the containers in a hierarchy.
- Task
- With the goal of more flexible development and better performance, I needed a way to use ECS while also working around Phaser.js's hierarchy constraint.
- Action
- From around the third or fourth ad I began using an ECS approach, and around the final project I introduced a Pure ECS framework. It had component stores and an EntityId that packed generation and identity into a single integer. Hierarchies were managed in a separate ECS layer and the results applied to Phaser.js. Skills, enemies and so on were described in a data-driven way.
Result
Work became noticeably faster from around the third or fourth ad, and because skills, enemies and more were described in a data-driven way, I could respond quickly to related change requests.