![A screenshot of one Memory City output.](/sites/default/files/styles/large/public/2024-01/Memory%20City.png?itok=8u-gBXAf)
In 2013 the US Air Force had a "game" that you could play in a browser to test your memory: one of three 3D renderings of a town or city would be presented for a limited time, then removed from your screen, followed by questions about the image you just saw. Questions would range from "approximately what time of day was it" to "how many houses were there?" and "what direction was traffic flowing?" A friend of mine issued a challenge: that I could create a game that did this same thing, with entirely procedurally-generated images and test questions.
What emerged on my new Github account was a Node.JS project that takes a random seed and creates a very basic town outline using three.js. My main intent was to make it extremely plugin friendly; that is, contributors to the project could define entities like zones or buildings, and define what rules those buildings had for propagation, then plug them into the program and see what happened.
I created a few different NPM modules that assisted with this undertaking: JSONAutoTree parses through a given folder of JSON files and builds a hierarchical tree from "type" and "parentType" properties, then provides functionality to "walk" down the tree based off of "chance" properties; threegrid takes a defined array of arrays of objects in order to construct and render a grid using three.js. When combined using my defined shape functions, which pull from pre-defined 3D shapes of grid items, you can render out what could potentially be seen as a city.
Now, eight years later, Memory City remains unfinished, but every few years I return to it and poke a bit more.