I participated in this year’s NaNoGenMo, writing a procedural generation script to output a “novel.” This event is inspired by the National Novel Writing Month, in which writers pen a novel in November. I am an avid follower of the Procedural Generation tumblr and I jumped on the chance to join in when NaNoGenMo was covered.
My idea was to write a script that generated stories about all the people passing through the LAX airport – who they were, where they were going, if they were from another country, how they were feeling, and so on. I called my project “Departures and Arrivals.” You can view it on GitHub.
I didn’t get started until around Thanksgiving, but that still left me plenty of time for this simple idea. The dev journal in the README covers the development of my entry in more detail. In the end, I had gathered about 180 lines of data and wrote about 300 lines of code. There’s a lot of things I would’ve liked to improve.
In particular, there’s not enough variety in the types of stories that the script can generate. and I would’ve liked to have it decide for some travelers to write small “sub-stories.” These would follow templates like “something goes wrong,” or “eating at a restaurant,” and have it go into detail there, procedurally-generating more details as it went. I also wanted to write some code that generated stories for the flight crews, the ground crew at the airport, and the employees of businesses.
The code itself is not particularly spectacular. I chose Ruby due to my experience with it. I was able to identify a nice abstraction for inheritance –
InternationalPassenger are subclasses of
Passenger, because they all share some common attributes like
There’s no testing to speak of, and I’d like to dig in a bit more about how procedural generation is unit tested. My guess is largely around ensuring it works without raising an exception, regardless of output, and also checking with the random seed set for particular behavior.
Participating this year has given me a lot of ideas about how I might do procedural generation for content better in the future, as well as made me appreciate even more the procedurally-generated fiction/games that I’ve played. I’ll likely repeat this again next year.
You can read my finished novel, Departures and Arrivals on GitHub.