dhmstark
Game Design Articles

CivClicker: A Development Postmortem

The game that was to become CivClicker was born in late September last year. Mostly I'd been playing too much Cookie Clicker and figured that I could do something like that. I knew the basics of HTML, CSS and JavaScript, and I had an appreciation for the underlying mechanics of the game. So, well... I gave it a shot.

Now that CivClicker's development has reached a natural end-point, this article aims to take you behind the scenes of the game's initial development and design, and hopefully gives a little more insight into how this particular sausage was made.

First Principles

When thinking about what I wanted to achieve with the game, what I really wanted was to see if I could reproduce those factors that made Cookie Clicker so addictive. At its base, the joy of Cookie Clicker derives from clicking and then watching numbers go up. It's a very simple concept and executed beautifully, and I wanted to see if I could bottle that lightning.

There were a few other things I wanted to achieve as well - the first was to see if I could even produce a game at all (I was very much a novice at JavaScript, and the game has been a huge learning experience for me), and also to see if there were other principles from game design and the psychology of addiction that I might be able to incorporate. I also knew that I wanted to build something more complex than Cookie Clicker, if only to differentiate it as a game - I didn't want to rip off Orteil's hard work, I wanted to make something that was uniquely mine.

With those principles in mind, I opened up Notepad++ and added the first lines of code in late September 2013.

Implementation

The very first things to implement were the three buttons for food, wood, and stone, and their associated numbers to go up. Next, I'd need the equivalent of buildings to autoclick those resources (like Cookie Clicker's cursors or grandmas), but it clicked that since this was based on developing a civilisation, I could build a system where the player had workers, and those workers could be assigned to whichever job was needed. In a sense this is where the similarities to and inspiration from the Civilization series and the Age of Empires series started to creep in.

Once I had the start of a population mechanic, the rest of the resources and jobs sort of flowed from there. I first decided that I needed resources that you gained randomly on clicking buttons, to give the full Skinner Box effect. These became skins, herbs and ore. Then, it made it natural to require those resources to do things, so I built in a population cap which required those resources to get started. It then became obvious that I could add jobs to allow processing those resources into something even more useful, and so metal and leather were born as were blacksmiths and tanners. Piety followed swiftly afterwards when I was trying to figure out what I'd do with herbs.

Things were starting to come together.

From there the next obvious mechanics were added: buildings. At first, they were needed to house workers. Then they were needed to support the specialised workers. And at that point, I decided that I could add upgrades to the game which unlocked more types of buildings. Once the upgrade system was in place, it was natural to have upgrades that modified other game mechanics, such as allowing players to automatically gather the (now important) secondary mechanics.

Soldiers came from the need to do something with the leather and armour, and wolves attacking came from the need to give soldiers a purpose. Deities came from the need to make piety useful beyond upgrades, and their upgrades were part of a way to allow civs to be different from each other (i.e. starting a tech tree that precluded following other branches).

It would take a while before apothecaries became useful, as developing the sickness mechanics meant I ran into the first major problem with how I'd written earlier game mechanics, and required a complete rewrite of the jobs system, but the framework and concept for them was in place.

Cats? Cats just sort of happened. Mostly they were an experiment because I wanted to see how people would react to a statistic they couldn't control and didn't do anything obviously useful.

The rest of the development, of course, is history.

The Development Process

Most of the initial part of development in September happened over Facebook and IRC. The first Reddit post at the beginning of October was the first exposure of the game to people who didn't already know me.

What I learned during this period was that it was important that I had a vision for the game, but that player feedback was crucial - to improve the way that the game played, to cover features and things I'd missed, and also to maintain my own motivation for coding. I expect that if people hadn't enjoyed the game so much, it never would have gotten past those early stages.

In retrospect those initial stages of CivClicker's development were largely the result of the core mechanics I'd baked into the game from the start - that it was possible to appeal to basic psychological principles of "numbers go up" and "occasionally I get a reward for doing this thing" to get people to keep playing long enough for me to add things. Something else I implemented very early on was requiring players to name the civilisation and name themselves, which generated a degree of attachment to player's civilisations that I seriously underestimated.

Something else that helped in these initial stages was responding to the feedback I was given. I get the impression that people got more invested in the game as they saw me develop it, and particularly as their suggestions made it into the game. Constant iterative improvement with feedback from a core group of fans benefited the game, benefited me, and drew those people in as an audience.

Feedback is really, really important to the game design process. As much as people might accuse me of being an auteur on certain aspects of my game design process, it's clear that games are developed for an audience - and if there's any true measure of whether a game is good or not, it's how strongly it resonates with that audience and how well it achieves its design goals (which, to my mind, should include at their core whether its intended audience enjoy playing).

Growth and Setbacks

Another thing I learned from the whole process is that maintaining the motivation to look at a piece of code (even one you wrote, enjoyed writing, and want to continue writing) is really, really hard. After CivClicker became more popular in November and December and started to spread to various other parts of the internet, my feedback list and my to-implement list started to get quite intimidating, but I was getting slowly burned out on staring and the same code day-in and day-out - since I was doing this on my lunchbreaks and after work, it basically consumed all of my free time.

On the other hand, watching the game grow and watching the audience grow was a massive motivator for me. The point where I started looking at the analytics each day to see whether there were any new referrers (and there usually were) was the highlight of my day. I started getting lots of reddit comments and messages, and even emails from people sending me feedback. It was a huge ego boost to think that people were enjoying something I created, and were invested enough that they had opinions on how it could be improved.

Eventually I even started getting questions about how I made the game, and how people could get started making their own. I made a tutorial which took people through the basics, and it was pretty gratifying to see people using it as a starting point.

But as I kept working through that pile, I realised that it had been months of work and things were starting to drag. By December and January I'd cherry-picked most of the easy and interesting features to implement (new achievements and upgrades were easy and gratifying), and what was left were the challenging and/or less interesting things (like implementing entirely new gameplay mechanics, or revamping/recoding old ones). Worse still, I'd moved to a new city, and as a consequence had started getting sick very frequently. My spare time and motivation started to ebb away and the game's development started to stagnate as a result.

Where did the time go?

Someone asked me where the time was spent. Let's take a break and look at a back-of-the-envelope estimate of how my time broke down through most of the development process:

These are only estimates, and it's hard to track your own time, but this is certainly what it felt like to me. I don't know how representative this is of game development in general, but it definitely seemed like the actual coding part was only a fraction of what development actually entailed.

The Road to v1.0

In later December the lack of motivation I was feeling started to bite hard. This was where I needed to actively make a change to the way I was working, lest the game end up dying without further development.

What I did was to give myself a concrete goal: get to a "release quality" version 1.0 release. This would allow me to cut down the gigantic stack of potential features into a few core things that I knew the game needed before I'd be happy leaving it. The goal was also a pressure valve for the stress of continued development - it would allow me to convince myself that there was a light at the end of the tunnel of constant work. I could hit the final necessary features, check everything off, and in theory I'd not be under any more pressure to continue unless I wanted to.

Going through my list and sorting them into those that would make the cut and those that weren't was hard. There were a few obvious features that needed to be in - a graphical overhaul being one of them, rebalancing various mechanics being another - but there were quite a lot of "nice to haves" that I could have added, including yet more upgrades for deities and an expansion of the raiding mechanics.

In the end I forced myself to just cut everything that wasn't absolutely necessary - the "nice to haves" were really the cause of the problem in the first place, so most of them went. I could do that by convincing myself that if I really wanted them, I could come back and do them later - a nice bit of cognitive dissonance compared to the way I convinced myself to target an end state for the game in the first place!

I was finally back on the development wagon, and in January came back with more motivation and a checklist of features I was burning through. The big decision moment was still to come, however - what would happen once I released version 1.0?

Analytics

As an aside, one of the most important tools for me in the whole project was probably Google Analytics. It was instrumental to my motivation, and helped me keep tabs on where people were talking about the game by looking at referrals and keywords.

It wasn't until later that I realised that most of my players were playing for so long that the analytics no longer tracked their playtime as a single session (limiting "live" sessions to half an hour). I needed to figure out a way to get a better idea of how long people were playing for.

What I settled for in the end was to use event tracking with game's save function. Each time the save function was called, it recorded the save type (autosave, manual save, exporting) in analytics. As a side effect, this would keep sessions alive beyond the half-hour limit that GA imposes. Now, this solution would still have difficulty tracking people with autosave turned off, or with flaky internet connections, but I figured it was better to have some data rather than nothing at all.

After implementing the save tracking the average session length went from 15 minutes to well over 3 hours. Quite a considerable change, and one that made me completely reevaluate the way that people were playing the game.

Here's a few more interesting facts and figures:

Version 1.0 and the GPL

After working through the last features in January and the beginning of February, and then applying a polish and doing lots of bugfixing, it was time to face the music. Checking off the last things from my list, I felt a great weight lifting from my shoulders. The only question that remained then was what was going to happen to CivClicker post-release.

At the time I couldn't imaging continuing to work on it in the near future, so I ended up presenting the options to the community. Would I release the game under a copyleft license and then step away, knowing that if people were interested they could take the game in new and interesting directions, or would I take a break and come back to the game later?

The reason these two options were at the forefront of my mind was that I'd realised that CivClicker meant an awful lot to me - it'd been part of my life for six months, I'd developed it from the ground up - in essence, it was my baby. I am a believer in the principles of copyleft and the open source movement, but equally I didn't want to end up working alongside someone else on the project and I wanted to leave my options open.

In the end, after a lot of thinking and discussions with various people, I ended up releasing CivClicker under the GPL. The game was now free for anyone to use and modify under those terms. So far a few Sourceforge repositories have sprung up and it looks like the surge in popularity the game received during March has meant that there is now some more solid interest being shown in continuing to develop it.

The Future?

So what's left? Will I be returning to CivClicker? At this stage I certainly can't promise either way, but the option is always there. For now I'm intending to explore other projects, and maybe see where things take me.

I hope this article has managed to shed some light on the twists and turns that CivClicker has taken to get to this stage. It's certainly taught me a lot about game development, about JavaScript, and about myself. I feel fortunate that somewhere along the way I made a game that people seemed to enjoy, and I feel fortunate that the game has gotten the attention that it has.

If you've enjoyed playing CivClicker, I would absolutely love it if you could share it with others. If you really want, you can use the Tips link in the top right corner in the game to buy me a beer, but there's nothing cooler to me than seeing CivClicker spreading around the world and hearing from people who've enjoyed playing something I made.

As always, feel free to contact me at this domain name at gmail.com if you have any questions, feedback, or responses to anything I've written here. :)

-Dave