Roads and Zones on a Map with Lakes

Residential, commercial, and industrial zones along a few roads.

Two and a half weeks ago I found myself in a bit of a difficult situation. I was satisfied for the time being with the knowledge I had gained from my pathfinding experiments, and there had recently been some good discussion on Simtropolis regarding traffic simulations.  I was left with the question, “What next?”  It was a more difficult question than I had anticipated.

After flailing around for a few days, I decided two weeks ago to force myself to do some project planning; I obviously needed the guidance.  I had to go through a few stages that I’ll describe below before I had any kind of actionable plan, but what I eventually ended up with was a three week plan.  By the end of the three weeks I hoped to have a city builder prototype with what I considered incredibly primitive implementations of the most core elements of what I currently envision as the end product.

Project planning in software development (and other fields, I am sure) is notoriously difficult and unreliable.  I’m sure people often question its value.  When I came up with my three week plan, I noted on Twitter that it would probably be completely inaccurate by the time the three weeks were up.  But even if that were true, it had real value because it gave me a place to start; it gave me traction when I had been spinning my wheels.  I am now about half way through that plan, and things are going well.

The biggest challenge was that although I could envision the final product, and even intermediate versions, I had a hard time figuring out how to get to any of those versions from the blank slate that I was currently facing.  So I began with what I knew:  In a free-writing style, I described my vision of what I loosely considered version 1.0 of my city builder project, hoping that I might be able to work backwards from a concrete description.

No significant revelations arose from that, so I went back over it and tried to identify the overall patterns into a few different categories.  I came up with the following four:  framework, graphics, simulation, and interface.  Regardless of the details, every version of the game would contain something for all of those categories, and it didn’t seem daunting to get an initial version rolled out for each of them.

So here was my nugget of conceptualization (well, four nuggets) that would allow me to actually start somewhere.  Before jumping straight back into programming, though, I wanted to make sure that I had a proper roadmap for getting from my still blank slate to a version that contained rudimentary implementations of these four categories.

First step would be to get my tools up and running.  I had decided to switch from Microsoft Visual C++ to Code::Blocks + MinGW, so I knew that would require some time at the beginning.  At the very least, I’d have to learn how to setup projects and rebuild some of my third party libraries, such as Boost and SDL.  (It turned out that the UI library CEGUI was the biggest chore, as it had multiple dependencies that all had their own idiosyncrasies, but the effort in the end was definitely worth it.)

I decided the next step would be the main menu interface.  I wanted to make sure that at every stage, whatever I wrote actually had a context within which it would fit.  Jumping straight into simulation code is my typical desire, but that has ultimately led to a lack of direction in many cases, due to the simulation existing in a vacuum.  I wouldn’t make that mistake this time.

Next would be the data models for representing the city, the map, and “projects” which are plans for city development that can be designed outside of the simulation before being enacted and using the requisite city resources.  Along with the data models, I would also implement basic graphics and user interface elements.  Again, I wanted to stay away from getting into simulation code before it had the supporting elements around it.

I am currently near the end of this no-simulation stage of development.  I can view cities, create new cities, save and load cities, create projects, and design roads and zones for individual projects.  The next step will be to lay down the groundwork for agents (entities in the simulation that make decisions, such as residents or businesses) and resources, enable the ability to approve projects, and add simulation time to the system.  Once I get to that point, I should be able to unpause the game and watch agents interact with the roads and zones in a vaguely interesting way.

Once I get that going, I’ll ensure that there is some primitive form of an economy, that roads play a relevant role in the simulation, and that agents are given a few primitive motivations for making decisions, such as wealth or happiness, along with the various simulation elements that affect such motivations.

For now, that’s the extent of the plan.  All four categories, the framework, graphics, simulation, and interface, will definitely undergo significant amounts of additions and modifications from version to version, and perhaps the occasional rewrite.  But I’ll now have a foundation to start with, and it’s a lot easier to know what to do next when it comes as packages of “add feature X to component A”, “modify/fix component B”, or “replace component C with a new implementation”.

I expect to go through a similar project planning pass in a couple of weeks.  Definitely in order to come up with another short-term plan, but I’m also interest in trying to work out a better long-term plan too.  It certainly won’t be as detailed, and will be subject to much more change over time, but it would give me a clearer picture of how my short-term plans would move me toward version 1.0, and thus guide my priorities in choosing short-term projects.

No Comments

Leave a comment