Jan 22, 2022 - RPG Game Loops

Comments

Role playing games come in many different flavours but the game loop is a common element in all of them. Whether the game is combat oriented, or it focuses on stats and progression, exploration, or story telling, almost all RPGs follow this simple loop:

rpg loop

The terms and mechanics may differ between games but the loop is the same. The dungeon may not be a literal dungeon, but a forest, ruins or wilderness.

What’s interesting is how different RPGs use mechanics to compel players through this loop. Let’s look at a few classic mechanics:

Quests ❗️

There wouldn’t be much of a game if there’s no reason to enter the dungeon where you can get killed. Most RPGs have a main quest, the call to adventure that compels the player to venture forth.

yendor

But RPGs, especially Western ones, have lots of side quests, big and small, which give players a more immediate reason for fighting. They could be as mundane as killing 20 rats, or as involved as pulling off a heist.

the ultimate heist

In Oblivion, The Ultimate Heist is a 7-part quest that involves stealing a unique item from the most heavily guarded location in the game.

Quests are extremely flexible and are only limited by the quest designer’s imagination. They can direct the player to arbitrary places and perform arbitrary tasks, thereby showing parts of the game that the designer wants. In return, players want the quests to make sense in the game world, and reward them with game lore in addition to mechanical rewards. Players tend to look down on lazy, highly mechanical quests such as “kill X creatures” or “fetch some item”.

Once quests are complete, the prospect of returning to the quest giver to collect the reward can be an incentive to return to town, so quests can work in both directions in the game loop.

Energy 💚🏥

This is where dungeon fighting consumes a form of energy, which is replenished back in town. The most common is health or HP; fighting almost inevitably involves getting hurt, and the most effective way of getting healed is returning to town. A great example is in Final Fantasy: although alternate healing methods exist, resting at the town inn is always the cheapest option, by far. Pokemon takes this even further, with its free healing Pokemon-centers.

ff4 hp

Health is an unforgiving energy system because the penalties for losing it are harsh - your party dies and you lose the game! But it is not the only type of energy, and the penalties don’t need to be as harsh for it to work. Mana, or MP, is also common. For magic-focused characters, fighting without mana is much harder, which is a strong incentive for returning to town.

A side note on restoration items: they can alleviate the harshness of energy penalties, but usually they are expensive, so that they don’t completely bypass the energy system.

Encumbrance 🧳

Loot is a big part of many RPGs. Many older RPGs had limits on how many things a character could carry, due to technical constraints. But others set limits deliberately, so that characters could not loot items indefinitely, and must return to town to sell excess loot.

Diablo in particular, focuses on inventory management and looting to drive its game loop. A typical dungeon run will have the player pick up mostly useless items, return to town to sell them off, and only occasionally do other things typically done in RPG towns - heal and recover, buy restoration items, upgrade equipment. This focus on looting was done to focus the game on the excitement of finding rare items.

loot loop

Other RPGs, like Fallout, The Elder Scrolls and various Dungeons and Dragons-themed CRPGs use weight limits, coupled with the fact that stronger characters can carry more items, for more flavour.

Compared to energy systems, encumbrance has the advantage of not harshly penalising the player, but still simulating the fatigue of adventuring that feels thematically apt. The obvious downside is that the encumbrance system needs to be designed just right - the game must not give the player too much or too few loot items - otherwise, in the case of too much loot, it can push players to return to town too often to avoid missing out on selling loot.

Crafting and Identification 🔨

Crafting is a game mechanic that has grown popular in RPGs over time. It adds flavour to the game world, but also acts as an additional force on the RPG game loop, by making loot more valuable if it is taken outside the dungeon.

Consider in The Witcher, where alchemical ingredients are usually harvested in the wilderness, but the player must return to a safe resting zone in order to make potions, oils or bombs.

craft loop

As a general rule, crafting ingredients are virtually useless on their own, but are also hard to gather unless the player travels to many different locations. This creates a weak, bi-directional pull in the game loop - players are encouraged to return to town to create useful crafting items, but also to travel to different locations to gather more ingredients.

Incidentally, item identification - with roots going all the way back to table-top RPGs - is somewhat similar to crafting, in the sense that unidentified items are useless, giving an incentive to return to town to identify them and make them useful.

Compared to energy systems and encumbrance, the influence of crafting on player behaviour is very weak, since crafting ingredients are usually very lightweight, meaning players are free to hoard them and not go back to town just to consume those ingredients. Many crafting systems are secondary in nature, so that players can often ignore crafting altogether.

Afterthoughts

After examining these different mechanics, all designed to keep players in a hamster-wheel-like loop of town-dungeon-town-dungeon, it may seem arbitrary and player-hostile. Indeed, many RPGs have added quality-of-life conveniences designed to shorten this loop, reduce its urgency, or in some cases to skip it altogether. These include things such as:

  • Fast travel / town portals
  • Torchlight’s pets who can return to town to sell loot and buy potions on your behalf
  • Item stashes, pack mules to carry more loot
  • Special items that replace town functions (full-healing items, identify scrolls)

So why do we even need this loop, why not keep the player in combat the whole time, and allow them to do everything there?

Delayed Gratification

A lot of the “pull”-type mechanics give the player something to look forward to, by delaying the immediate reward. Items that must be crafted elsewhere, rare items that need to be fixed or unlocked, quest rewards that need to be collected, these all act as mini-cliffhangers, something to keep the player in the game, or for them to look forward to once they return.

Pacing

Games need a regular pacing in order to keep the player engaged, without being bored or fatigued.

[pacing in games fills] a very important role: it helps the player stay in “the flow”. … The clear [rhythm] it gives to the game helps [players] learn to anticipate challenges and get ready right on time. Providing relief in regular intervals prevents players from getting tired too quickly. Sudden surges of intensity supply them with adrenaline rushes, and the increasing wave structure makes sure they have time to recover afterwards.

Beyond Pacing: Games Aren’t Hollywood

Towns in RPGs are an effective way to serve as lulls in the action, so the player can mentally take a break, reflect, and prepare for the next surge in action.

Composite Game Design

RPGs can be seen as an example of a composite game, a combination of story-telling and turn-based combat. It is therefore important to have different sections that showcase one or the other.

Indeed, the grandfather of RPGs, Dungeons & Dragons had roots in wargames, and was created by adding role-playing elements like character creation and storytelling to wargames.

wargames

D&D’s combat was based off a medieval wargame. Wargames have a rich and long history, going back centuries as a tool to train officers. Some have kept this tradition by focusing on realism. Others streamlined the mechanics to make it more fun and interesting, for example by adding fantasy elements.

Just as in composite games where lessons learned from one genre can be used to solve problems in the other, RPGs often use story-telling elements to influence combat, and vice versa, to create a genre that is greater than the sum of its parts. Great RPGs often have superb examples of this inter-dependence of genres. New items, mechanics or characters are introduced via the story. Players in turn can often influence the story or game world by taking on different quests, representing different combat encounters, or sometimes even by performing combat in different ways. This way, players engage with the game on multiple levels.

FF4 Cecil

In Final Fantasy 4, the main character undergoes a permanent class change as part of a key story arc, tying his character’s moral redemption to a big change in gameplay.

The separation of town and dungeon segments becomes clear. It is hard to tell an engaging story while the player is focused on combat. RPGs therefore need a safe, slow-paced town segment to develop and engage with the story, such as taking on quests and tweaking their characters, and a dangerous, fast-paced dungeon segment to fully explore the combat impacts of their choices.

Jun 30, 2021 - How to Finish Your Jam Games

Comments

…on time, every time.

I’ve been game jamming for many years, from physical jams like Global Game Jam and online ones like Ludum Dare, as a solo jammer and in teams, using lots of different engines and tools. Some games did really well, others not so much, but most were fun, and every one was a useful learning experience.

And I’d like to share some wisdom with you!

One of the toughest challenges in game jams is how to finish on time. Everyone tells you the same advice - keep your scope small, have a plan or schedule, be flexible, use the tools you know best, take breaks and sleep - and after a few jams this advice quickly becomes experience… but somehow we keep having trouble finishing on time! Making something in such a short timeframe is really tough.

But here’s the one trick that has worked really well for me: make something you’ve already made before.

I know; that sounds wrong! Aren’t you supposed to make something new and innovative! What about the jam theme, are you just going to ignore that? Hear me out.

Have you ever lost hours of work before - maybe you were writing an essay but your computer died, or writing some code and accidentally reverted the work? Oh no! you think; this is going to take me forever to redo!!!

lost work

But instead of hours, it takes only 10 minutes to restore.

Sure, it was tedious and painful, but it was finished before you knew it. How was it so easy?

Because the reason it took you hours the first time, is because you didn’t know what you were doing. It was completely new to you. The hard part, in any creative endeavour like writing code, creating art, composing music, was figuring out what to do in the first place. The execution part is quite simple. Once you’ve done it before, it’s fresh in your mind.

So here’s my advice for game jams: make something you’ve made before, finish it quickly, and then gradually change and polish it into your ideal jam game. The first part is easy, because you’ve done it before - that’s the point. You’ll have a finished game very early in the jam, and this is a big advantage - no rushing to get integration and builds working last-minute, no stressing out over menus or stitching game screens together. Then you iteratively improve the game - make a change, test it out, fix it, come up with new ideas - all the while having a working, finished game. It’s low stress, and very effective.

Iterative game dev

Example

Suppose your idea is a platformer with a fun gimmick. But you’ve never made platformers before; you’re not even sure how to implement your gimmick! But you have made top-down shooters before. So just start with that! Build a top-down game, with a player running around the screen. Add walls and collision, rudimentary animation. Add some basic objectives, like collecting things, progressing to the next level, maybe a hazard so the player can die and go to a game over screen. That’s all there is for a basic, finished game, and it probably only took you half a day, because you’ve done it all before.

Top down game

At this point things could go one of three ways:

  • You gradually implement your original idea into the game, piece by piece. No problem; you always have a working game, and you have a steady stream of progress showing your vision taking shape

    platformer

  • You notice hey, maybe the top-down game wasn’t so bad, or maybe you have an even better idea at this point, and completely pivot into another game. That’s cool too! It’s all about the process of finding the fun

    topdown

  • Or most likely, you do a combination of the two. As you build out your idea, you find things that work, things that don’t, and adjust accordingly

    new idea

How to Execute

To pull this off, you will need your basics covered. This will depend on your approach:

  • If you’re quite new to making games, or don’t have a good game to work off, find a good project template or tutorial, one that is easy to follow, easy to extend, and has all the features of a complete game. Despite what I’ve implied, I also think it’s great to try new things in a game jam! But just be aware of the added danger of getting stuck and not knowing how to proceed in a new engine or tool. It’s therefore very important to pick the right tool and project template to work off. Stick to mature products and popular templates/tutorials, do your research to find that it fits your needs.

    platformer template

    There’s no shame in taking a game template, then changing it until it’s an unrecognisable frankenstein-game, and it works well! Personally my best games haven’t been made this way, because it’s much more productive to work with tools you know well, but when I do use this approach, it’s usually been fun and an excellent way to learn something new.

  • If you’re making a game from scratch, but based off a previous game you’ve made, know your tools like the back of your hand. Make sure you’re practiced in the game engine, programming language, or whatever tools you used to make that game, so you can re-make it without friction. Do some refresher exercises to see if you still remember all the tricks. It might even make sense to avoid using the latest version of the tools, just in case something broke or doesn’t work the same way as before, but if you do, try it out first.

    unity upgrade errors

    I’ve been bitten by this on quite a few occasions. After not using a game engine for a year, I come back to it thinking everything is the same, but there’s always one or two things that aren’t. Debugging this, Googling for answers, cost valuable minutes and hours that I could ill afford in a game jam, which threw my entire schedule into chaos. I’ve since learned that updating versions is a luxury you cannot afford for a jam. Leave it for before, or after the jam.

  • Also, keep making games! Make different games, different genres, using different techniques! Not only will you get better at making them, but you build up your repository of knowledge, so you have more games to re-make quickly.

    game genres

    The game jams where I learned the most were ones where I tried to make a game in a different genre. I was at my most creative because I had less experience to draw from, so even though I tried to make things that I thought would be fun, I was unconsciously doing things differently enough to create surprising results. And sometimes this works out really well! Either way, you build your repertoire of game making tricks, and knowledge of what works and what doesn’t.

And that’s my two cents. I wish you good luck in your next game jamming adventure!

Feb 24, 2021 - BSP Lock and Key

Comments

I’ve been working on C-Dogs SDL lately, and one thing that often bothered me about that game is that its default random map generator provides an uneven experience. It’s exciting at the start when everything’s unexplored and there are many corridors and rooms to visit, but in the late stage when you are hunting for keys and objectives, backtracking all over the map, it can be quite tedious.

C-Dogs’s map generator is quite configurable and produces a wide variety of maps, but at its core it’s pretty simple:

  • Start with an open area
  • Randomly place rooms around the place
  • Randomly lock some rooms, and place keys in the rooms

C-Dogs map

The lock-and-key system is in series: the yellow key is in an unlocked room, the green key is in a room locked with the yellow key, the blue key is in a room locked with the green key and so on. Here’s a tree to illustrate this simple structure:

C-Dogs map graph

Because the keys (and objectives) could be in any one of several randomly placed rooms, you may need to criss-cross the map many times to collect them all. That’s a lot of backtracking! Another issue is the structure - rooms are isolated from each other, all leading outside. This gives all maps a similar feel. What if there were a map generator that could:

  • Provide a more interesting structure
  • Feel more like an indoors experience, like a building interior or dungeon?

I was first inspired by sauer2, maker of many C-Dogs SDL custom campaigns, which often take place indoors. These have cool features like:

  • Corridors linking many rooms
  • Rooms connected directly to each other
  • Locks separating entire sections of the map at a time
  • Branching pathways
  • Minimal required backtracking

Space Pirates map

Searching online, I came across a neat technique that uses binary space partitioning to generate a building interior. The algorithm recursively splits the area in half, placing a corridor at the split, and continues splitting (while alternating horizontal/vertical splits). Areas left unsplit are then filled with rooms. It’s a simple yet flexible technique.

BSP algo

As the structure of the map is a deeper tree, by finding a critical path that starts and ends at leaf nodes but passes through the root, we can get a fairly long main path, with shorter branches along the way. Here’s what that looks like, in my initial adaptation:

BSP interior demo

Here’s where lock-and-key systems come in. Many games, including turn-based RPGs and action games, employ a lock and key puzzle system to get the player to explore and provide a sense of progress. Games like The Legend of Zelda do this particularly well - an analysis of the dungeons shows that most dungeons are quite linear, with few and shallow side branches, but the clever placement of locks and keys makes the dungeons feel more complex. The key to this is the placement of locks before the key that opens them, which provides foreshadowing.

Zelda dungeon

It was quite easy to adapt this to the BSP map. As the critical path starts at a leaf node, goes up through parent nodes to the root, then down through child nodes to another leaf node, we can place locks in the intermediate parent nodes, and place keys somewhere in the sibling hierarchy.

C-Dogs BSP path

Not only do players encounter the locks before keys, because of needing to sidetrack to find the key and then return to the lock, but the map is also made to feel bigger and more complex than otherwise.

C-Dogs BSP graph

Finishing touches like removed rooms, locked rooms where hidden objectives or powerups are placed, are then added.

C-Dogs BSP demo

It’s a simple and effective technique!

For more reading about this kind of technique, also visit Mechanic #004 - Environment Tree