Construction Game II – The Idle Winner

The game discussed in this entry is located here: The Townsfolk Cartel.

The success of idle games came as a surprise to many. Take Cookie Clicker, for instance. All you do is click around the screen and buy upgrades to make your numbers increase quicker. Yet, they caught on. Nobody knows the precise reason why. One suggestion from Wikipedia: they’re “unchallenging distractions,” just interactive enough to hold a player’s attention. Likewise, the games are simple, but at least appear to be sophisticated.  Personally, I bet there’s a strong correlation between people who enjoy idle games, and people who like saving money and watching their bank account grow.

game1.png
Unlike other idle games, I added cutscenes to The Townsfolk Cartel to establish a basic story.

Whatever the case, after a bit of research and finally learning the Phaser.io framework, I created my latest HTML5 game, The Townsfolk Cartel. I came up with a humorous game premise, taking traditional fantasy RPG tropes but viewing them from an entirely different point of view. This, it turns out, was one of its most appealing features, at least to the reviewers at Newgrounds.

Anyone who’s played RPGs knows the story. A group of adventurers comes to a town, fights monsters, and gathers treasure in the nearby dungeon. However, although the adventurers are carrying a small fortune, and despite the fact that the town is the only outpost of civilization for many miles, the town-dwelling NPCs never change the price of their amenities. The inn still costs 5 gp a night. The item shop prices never go up.

Now, it’s rather obvious to me that, if NPCs were real people, the first thing they’d do is gouge the hell out of all the adventurers. They have them over a barrel. I’m not alone in this assessment – in L.E. Modesitt’s fantasy novels, you can be certain the heroes will get ripped off at the local inn (and the local marketplace…and the local armory…).

This scenario meshed well with the idle game format. The player (as one of the “townspeople”) needs to recruit as many adventurers as possible, then upgrade the local amenities to squeeze money from the hapless adventurers.


game2.png
My first open-source plugin for Phaser.io – a bar graph plotter that updates in real time with the latest numbers.

The most challenging aspect of an idle game is balance. You need to establish, at the beginning, how pricing and income are going to work. If the income comes in too quickly, there’s no game. If gathering money for upgrades starts taking too long, players get bored and leave. There’s a very insightful essay on idle  mathematics here. The best advice was to use “nonlinear increases” to both upgrades and the income that results from them. Specifically, the author suggested using “linear improvements with exponential cost.” He suggested using the following cost function for upgrade costs:

Price = BaseCost \ast Multiplier^{Number of Upgrades Already Owned}

It’s a single step from there to a JavaScript function:

GameModel.shopUpgradeCost = function() {
return Math.floor(3000 * Math.pow(1.5, this.shopLevel));
}

But the amount of income the upgrades provide should only increase linearly.  Hence:

var gold = Math.round(this.gold * (shopLevel / 500));


While this was all mathematically correct and in line with other idle games, it did create a slow game. So I turned to the second type of “upgrades” the player could make.

The goal of the game is not just to collect the most money, but to use it to buy up all the local resources and industries, from ore mines and vineyards to smelters and wineries. Hence the “townsfolk cartel:” a medieval version of vertical integration.

Moreover, when I published the game, I received quite a few complaints on the resource/industry costs. The highest-level industries cost a trillion dollars, and if income only comes in linearly, players are going to be there a looooong time. The gap between a billion and a trillion is much larger than between millions and billions.

So, I decided that resources would provide the player with an exponential amount of interest on all gold collected that turn. To get that exponential growth, I used this:

GameModel.getResourceExponent = function() {
  var baseExponent = 1;
     //each building level adds to the exponent
     for (var key in this.buildingMap)
         if (this.buildingMap[key].purchased)
             baseExponent += this.buildingMap[key].level * .005;
  return baseExponent
}
...
totalIncome += Math.round(Math.pow(goldIncome, this.getResourceExponent()));

Note the small size of the exponent. In my original draft, it was even smaller (a .001 increase for each industry level). Exponentials grow very large very quickly, and I wanted to be cautious.

However, the players at Newgrounds started getting impatient waiting for that first trillion to come in, so I increased the exponential. If the player purchased every single industry, the exponential could never go over 1.3. But that was sufficient – afterwards, players reported they could complete the game within a half hour.

A brief aside: I needed players to be able to see their income trends. Using text didn’t work out very well, so I decided to use a graph. Phaser.io doesn’t have a graph plugin, so I went ahead and made it myself. After only one project, I’m already doing some open-source contribution.

game3.png
Keep upgrading your blacksmithy and watch the money roll in.

Now for the biggest surprise: my idle game proved somewhat popular on Newgrounds, at least compared to my previous games. My last two games were a cerebral combination of old-school RPGs and solving mysteries. The most reviews any of them received was 4, and the number of players plateaued at about 3,000 and 3,500, respectively. In contrast, The Townsfolk Cartel, in less than a week, is already approaching the 9,000 player mark.

My games are usually not popular, but the day after its release, there it was, listed in Newground’s Game Portal “Popular Games” section. The votes stand at about 3.5 / 5 stars (the last two barely hit 3.0). Most of the reviews were extremely positive. The indie-rock soundtrack finally found a lot of fans (Brian and his band should feel proud).  My departure from a traditional idle design, especially the frame story and the ability to win, pleased a lot of players.  Perhaps the most flattering tribute was this YouTube video of the game’s ending, uploaded by one of the players (unfortunately, the video has no sound, which is a shame given how well the music was received). When you see players posting walkthrough videos of your game, you know it hit a decent-sized audience.


Overall, for the storyline and premises I had, an idle game (albeit with many non-conventional changes) was a great choice. I also realized something else – most casual players don’t want in-depth storylines, extensive dialogue, or overly difficult challenges. As one reviewer put it, my game was “very cute in the good sense of the word.” Compared to my two RPG’s, the idle game was easier to both code and play. And at the end of the day, that seems to be what players are after.

I plan to create a “tower defense” game for my next Phaser.io project, but it may be awhile since I have some web development projects to work on.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s