Migrating CitySim from Class Hierarchy Sim to ECS Sim
I've been using Daniel Greenheck's CitySim.js as a sandbox for experimenting with simulation architecture. Not to improve or comment on Daniel's design — his goals are unrelated to mine — but because it gives me a fully-functioning city sim with a Three.js presentation layer I can work with, and it's a stepping stone for my other city sim projects.
I've been making modifications to this project on and off for a while now. The motivation for writing about it now is that the transition from Object-Oriented to ECS thinking has been the most interesting (to me) of my experiments in this code base. But I should cover some ground before getting to the actual topic. In brief: I took Daniel's code, spent some effort separating the simulation from the presentation, moved the simulation to a node.js server using the CQRS pattern, then ported that server from Node.js to C# using Wolverine for the CQRS plumbing. This post is about my latest refactoring — migrating from a per-object, class-hierarchy simulation to an Entity Component Systems architecture — and what that actually involved.
