May 4, 2015 - Ammo is a Resource

Comments

The latest release of C-Dogs SDL is ostensibly about the addition of deathmatch mode, and although it was the original goal and most notable feature, development took twice as long as previous releases, and largely for one reason: ammo. Before this, C-Dogs didn’t have ammo, or in other words, C-Dogs had infinite ammo. How could ammo be that hard to implement; surely it’s just an extra counter? I though the same, but I soon realised this:

Ammo is a resource.

And that leads to a heap of things related to resource management. The player must now contend with many more decisions:

  • Which gun should I use? (some guns have rarer ammo)
  • How should I engage enemies? (close-up saves ammo but is riskier; farther is safer but wastes ammo)
  • Should I run away altogether and save ammo?
  • Should I explore, and gamble on finding more ammo or having to use it up on new enemies?

And as a designer, you now have to contend with:

  • Making sure the player is not too starved, or over-supplied
  • Resetting the player with the right amount of ammo at key points
  • Being careful not to railroad the player into a few play styles due to ammo supply

Of course there are great rewards for implementing ammo. It adds a layer of depth via the decision-making. It gives players an incentive to use different guns, as overusing their favourites will make them run out of ammo. But it’s also an entire game mechanic, and for one that’s so old and common, it’s surprisingly hard to get right.

doom

Games like these are too easy with lots of ammo, too hard without. Ammo placement can make or break a map.

Cyberdogs had ammo!

Fortunately, ammo in games is older than dirt, so there’s plenty of examples of how ammo can work, when it doesn’t, and what to watch out for. Most C-Dogs fans know that the game is actually a sequel to the very similar Cyberdogs, and it had ammo! But the two also play differently. Cyberdogs is slow, tense and methodical; enemies are very dangerous up close, pop out unexpectedly and you had to make your shots count. C-Dogs is sometimes like this too, but it is also fast and frantic, owing to new mechanics like sliding, open spaces, and of course - no ammo. Many players prefer Cyberdogs over C-Dogs for this reason.

cyberdogs armoury

How does Cyberdogs solve the ammo resource problem, that is, make sure the player’s getting enough ammo, and not too much? Armoury. In between levels, the player can spend cash to buy guns and ammo, cash that is earned from completing objectives and killing enemies in the previous level. In a way it is an elegant solution, by fobbing off the problem to the player, who is now responsible for how much ammo to buy. This also acts as a meta-game: too little ammo is dangerous, but too much and you don’t have enough cash to buy the goodies like extra lives and bigger guns. This mechanic is quite widespread too, from shops in RPGs to loadout screens in mech games.

But herein lies the problem: we’re attempting to balance one mechanic by piling on more mechanics! Wasn’t the point to make sure the player gets the right amount of ammo? Now we’ve added a store, buying/selling, cash and maybe more. Wouldn’t this just make things more complex and hard to balance? Let’s look at the ammo resource cycle here:

  • Use ammo to kill enemies
  • Kills earn cash
  • Use cash to buy ammo

Can’t we just cut out the middleman - cash - and keep things simple?

Sources and Sinks

Not quite. The cycle misses some important details: you can earn more money by completing more objectives, and you can also spend money on (expensive) guns. These are crucial to keeping the Cyberdogs ammo/cash system balanced. In other words, sources make sure the economy is never low on cash since players can always go out of their way to obtain more, and sinks make sure there’s never an overabundance of cash, by having big expensive items that the player can save up towards.

Once again, we can find examples in other genres, notably in RPGs, where there are plenty of sources and sinks to keep the cash economy healthy. If the player is short on cash, she can always farm for more gold, or explore dungeons more thoroughly to find expensive loot to sell. Many RPGs also have inventory limitations, which limits the amount of loot you can carry back to a store and sell; if the player is low on cash then she could make repeated trips to sell all the loot. On the other hand, if the player has too much cash, she could upgrade her equipment, which tends to be quite expensive. Most RPGs also feature magical or rare equipment that is obscenely expensive but provide marginal improvements over regular equipment. This Gamasutra article on Diablo’s item system shows how all these aspects work together to create a sophisticated economy. In summary, most of your gear was from loot, shop equipment was extremely expensive, but still worthwhile since the loot was random and often made the player miss out on a particular kind of equipment.

So it is important to have multiple sources and sinks in your economy, and also to make these alternates less desirable, otherwise they distract from the main game. For example, grinding, farming and shuttling loot are reliable money-makers but they are often tedious and less fun than fighting enemies or completing objectives.

ff6 shop

No matter how much you grind, you will barely be able to afford everything here. Inflation really messes with savings.

There’s another lesson from RPGs too, and that is to grow prices superlinearly. That is, for bigger and better items, increase their price much more than usual. Ever wonder why the wooden sword costs 10G, the iron sword 100G, and the silver sword 1000G, even though each one is only a little better than the last? This is to stop players from hoarding cash and making later segments of the game too easy because they can buy the best gear in one go. It’s a neat trick to prevent snowballing and make balancing much easier, by making those upgrades reliable sinks.

A Faustian Bargain

It seems we are stuck between two imperfect options. If we want a simple, ammo-only system, it is prone to shortages or surpluses, one that must be fixed by limiting player freedom, railroading them into a golden path. It is no accident that modern shooters rarely have ammo supply problems, but are also linear experiences. Alternately, if we want player freedom, non-linear gameplay, exploration, then we are forced to contend with the supply problems, which are neatly balanced with an economy. In return, we end up with an entire system which both the developers and players must manage.

But is this necessarily a bad thing? Players often enjoy managing resources as a meta-game, and there’s no denying the satisfaction of earning and spending these virtual trinkets, the clickety-clack sound when picking things up, watching virtual counters increment. When deciding on game features, it is important not to avoid complexity for its own sake, and to keep the greater goal in mind: making fun or enjoyable games. So the take-home message is this: be careful about adding features, because you may end up adding an entire system and meta-game!

Mar 12, 2015 - Killer music

Comments

Music in games is often relegated to the background, little more than filling the silence, pasted on as an afterthought. Recently I’ve contribute to the open source match-3 puzzle game FreeBlocks, and the surprising quality of the music reminded me of the value of music, that it can not only enhance but elevate the game to new heights.

Good music

But first let me show an example of music done right: the main theme of Enter the Dragon. I love music but there’s so much bad and badly-used music out there, and most people don’t care. I have a depressing anecdote where a jazz musician played a gig for a large dinner party, and received the following feedback from the client:

You guys were perfect! We hardly noticed you were playing.

People didn’t care about what they played, let alone how they played it. They only cared that there was something to fill the silence. Most people, from games to movies, treat music the same way. All it had to do was fit and stay unobtrusive; who cares whether it was “memorable” or “moving”? E.g. scoring a desert level? Just find some vaguely-Arabic music and call it a day!

Well Enter the Dragon cared. The main theme tells you exactly what this movie is about, with not a hint of subtlety, and all in the first minute no less. All you have to do is pay attention. Try for yourself: see if you can figure out what the movie is about, by listening to the music alone:

Kiais and Asian instruments? Kung fu. Blending into electric bass? Possibly set in some East-meets-West locale. Funky wah-wah guitar? Blaxploitation. Diminished chord? Something sinister, possibly involving spies and conspiracies. Yes, everything in the music tells you something about the movie, in no uncertain terms. It gets better if you watch and listen, as the music changes right on cue to what’s happening on screen - the stars’ names, their first appearances, changes in the scene. If you were to guess that this is the work of a master composer, you’d be right.

To take a gaming example, one of my favourite video game soundtracks is Sonic 3, due in no small part to collaboration with world-class musicians. For example, stage 1 of the game, Angel Island Zone, takes place in a tropical jungle environment, so the music is suitably cheery and Carribean with steel drums and xylophones. At the end of Act 1 however, the jungle is set on fire, with the level palette changed to an omnious orange and brown, an excellent signal for the ramp-up in difficulty. What’s really clever though is the music: Act 2 has a different track, but listen and compare the two tracks:

Notice anything? The two are versions of the same piece, one in a major key and one in minor! They have essentially the same structure too. The music is saying, “Act 2 is like Act 1 only darker and harder”, which is also what the graphics are saying. The same compositional technique is used in stage 2, where the sleeker and faster Act 2 (with its jets and speed wheels) is reflected in its music.

Match 3 harmony

Moving back to FreeBlocks; I was looking for additional music for the game and found this excellent piece by pixelsphere, and by sheer coincidence the music happened to be in the same scale and tune to the sound effects, which gives the game a very calming, musical quality. Listen and judge for yourself:

Although music theory - and sound design in general - is often overlooked in games, it can be used to give an extra amount of polish that makes a game stand out. Candy Crush Saga is a notable example, where all its sound effects are in the same scale.

Listen to the xylophone play an arpeggio as consecutive matches are made.

Prolific sound designer Aaron Marks puts his musical background to use:

I definitely have some techniques where I ‘tune’ sound elements to be either pleasant or something a little more harsh. I also tend to pay attention to the music that is accompanying a scene or game level and often tune the sound effect to a note which blends well or I’ll go the opposite direction and detune it, especially for evil characters and their weapons, for example. source

All this really goes to show that, yes music is overlooked, but all it takes is a little extra effort to craft something that’s special and above the norm. For me personally, this was proven in our game for Global Game Jam 2015, where I worked with the talented sound and music designer Matthew Chin. In addition to creating a killer music track, we decided to have two layers of the track, one calm and one frenetic, and fade dynamically between the two based on the action on-screen. The effort paid off in the form of taking the best audio prize; listen for yourself:

So next time, hit up your sound designer and make some killer music!

Mar 6, 2015 - Bounties for your game

Comments

Many open source projects are supported by bounties - cash rewards for specific work done. Have you ever wondered about doing so for games? Well I did, and tried it with C-Dogs SDL, and it was awesome.

The Bounty

A month or so ago I looked into open source bounties. I knew that for very popular projects, businesses used bounties to fund the development of features. The sum of self-interested funding improved the overall project, benefiting all users.

But not all projects are in this enviable place. Open source projects, like many things, follow a power law distribution: there are a few that get outsize attention, and a vast majority of mediocre ones languishing in one form or another. C-Dogs SDL is one of them, which gets a few drive-by contributions, but is mostly worked on by me alone. Will bounties help here, by attracting eyeballs, or even contributors who get things done?

I found out more after settling on Bountysource as the funding platform. A first look confirmed my suspicions: most of the funding were for super-popular projects (like Firefox) or those that had strong commercial ties. For games this was even more stark; the only project bothering seems to be OpenRA, one of the top open source games and much more notable than C-Dogs SDL. Either bounties just didn’t work for small projects, or they do but most people either don’t bother, or do it via other channels. I hoped it was the latter.

In the end I chose this task for the bounty: deploy binaries via Travis CI. There were plenty to choose from, but most weren’t suitable; they were wishlist tasks that didn’t have a clear scope, or required deep knowledge of the game code. This one however was almost perfect; it was small and required no code changes. Build and CI procedures were already set up and well documented, so in theory it is just researching Travis CI docs and setting up config files. I posted a modest bounty, and waited.

The bounty languished in obscurity.

The Contributor

One nice thing about GitHub is lots of analytics, including one for traffic, which shows how many views and clones you’re getting, and from where. There were hardly any from Bountysource.

Enter William “meZee”. After more than a month of inactivity, he got in touch out of the blue, when I had all but forgotten about the bounty. “Excellent!” I thought; it seems that bounties don’t bring in visitors, except the ones that count: contributors.

And then, radio silence.

Open source development is a lonely endeavour. The freedom that authors grant to users contributes to this, since people can use, hack, extend, even fork without bothering the authors. Most work is done by unpaid volunteers, who pick up and drop projects on a whim. Did meZee just take a break? Silently drop the task because it was too hard, not worth it, or too boring? I had no way to tell.

One week later, a flurry of activity! It turns out that getting two cloud services (GitHub and Travis CI) to talk to each other can be fiddly - who knew! - but the task was done in short order. I got an annoying task done, meZee got some cash and knowledge, and he even wished to contribute more! I couldn’t have wished for a better outcome.

Do they work?

This was an excellent experience, if a bit belated. It is still early days though, but overall I’m very satisfied and will try bounties again. Time will tell whether bounties:

  • attract other contributors, not just those motivated by the money
  • attract users in general, by signalling that there is real dedication in a project
  • discourage volunteer contributors, since they may as well wait for bounties to be posted

I believe that a lot of potential contributions are held back by small barriers, and most contributions are from extremely motivated and knowledgeable people. Perhaps in this case, the small bounty was enough to nudge one person into becoming a contributor, and that alone is worth the price. Bounties may have a long history but they still have a ways to go, as evidenced by the sparse project selection in Bountysource. But if more people jumped in, it has the potential to become a powerful form of crowdfunding. Is there a feature you want or an issue fixed in an open source project? Post a bounty; you may be pleasantly surprised.

Lessons

  • Open source projects progress at their own pace, as unpaid volunteers work from their free time, so be patient.
  • If you want contributors, break down all the barriers, and even more! No one wants to spend days setting things up, learning a code base, and contributing changes, with no guarantee of it being accepted, so why should your potential contributors? Everyone wants to start small and test the waters, so place a high priority on removing barriers.