Yeah, yeah, I didn’t update Monday. Sue me. (Actually, please don’t.)
So I’ve been running through Dead Space as well as a couple of other games, and I keep seeing this recurring theme come up with how the games are constructed: algorithms. When I open a locker in DS and find the ammo for the gun I don’t have any ammo for, it’s like unwrapping that Christmas present from that aunt you never see, and it’s EXACTLY what you wanted. “How did you know?!?”
Algorithms. That’s how they knew. Well, your auntie probably called your mom and was like, “Listen, I need to buy this kid’s affection. PlayStation 4? Got it.”
What’s an algorithm? You probably cringe every time you read it, because it reminds you of math and being trashcanned in high school. Don’t be afraid of math! I hear this all the time in my programming classes and online in tutorials. Don’t be afraid of it. You know what? That’s ridiculous. Of course you shouldn’t be afraid of math. Math is so useful, you should dress math up nice, take math out to a nice restaurant, bring math back to your place for an expensive bottle of wine and a rom-com. If you were a proverbial gold-digger, math would be the extremely rich, nice old guy who’s still very handsome in a rugged way. That’s math. It’s awesome. Love it.
Algorithms are nifty things that basically collect data and do stuff with it within a certain set of guidelines. Game AIs are extremely algorithm-based, because the data they collect is YOUR actions, and what they do with it involves figuring out a way to either help you (a la Left 4 Dead) or how to kill you (also a la Left 4 Dead). More examples, you ask? Minecraft worlds are generated to a very specific and complicated set of algorithms, making sure there are different biomes, caves, ores, enemies and special dungeons all over the place. In the case of the “data collection” part of MC, you have to put in a “world seed” when you create your world, which is essentially a word or number that sets parameters for the world’s look and composition. Whoa. Think about it. A word generates a world. That’s the power of algorithms.
What else do they do? They allow for a mutable gameplay experience. Whoa, big words, I know. Imagine you’re playing a level of some puzzle game you like. You finish a level but you really wish that you could do more levels of the same variety. If your game is designed with specific levels, then you’re outta luck (like Candy Crush, for example). However, if your game uses an algorithm to spit out levels and then calculates the difficulty of them (by using a solver or figuring out minimum number of moves to solve, etc.), then you have an infinite number of levels at your disposal, each with its own unique and algorithmically pooped solution. Nifty, right?
**DISCLAIMER. IF YOU ARE NOT A PROGRAMMER OR INTERESTED IN GAME DESIGN, YOU MAY SKIP THE NEXT COUPLE OF PARAGRAPHS**
In terms of programming, it saves you as the game designer a lot of work! I’m going to use the example of my RPG, “Blue” to illustrate what I’m talking about. I algorithmically generated my treasure. I placed treasure chests in the world and filled them “randomly” with treasure of several varieties. The bonus is that I save both lines of code and data. I don’t have to have a file specifying which treasure chest locations contain which treasures, and I don’t have to implement the code to deal with said file. It also gives me a lot more freedom with how I want to give the player treasure. I personally had two lists of treasure: a basic list that would always be a possibility for a chest’s contents, and a “unique” list that had better treasure, but could only be gotten once. Instead of placing them in the chests at the beginning of the game, I calculated what was in the chest when the player gets it. Bingo, more data and code saved! You can play with the algorithm as much as you want to make it fit you: change the favoring of the basic list to the unique list (which gets found more often?), make unique lists floor specific, or don’t and let the player get the previous floor’s treasure on the next floor. Make it possible to get unique treasures from battles (just in case luck doesn’t provide them with their dandy new equipment). Huge amount of possibilities, all of which don’t require a lot of work.
Another game design thing that algorithms do very well is “hiding the strings.” The “strings” are the hard and fast rules that govern your game. With Mario, it’s “jump on heads, try pipes, you can only jump so high and run so fast, get powerups to change what you can and can’t do, don’t fall in pits, on spikes or in lava.” Pretty simple and straightforward, and understanding the rules (“strings”) is how the player plays the game. In MineCraft, there are hard and fast rules that the player is made aware of, but the majority of the brilliance of the game is in the algorithms. The player need not understand the math behind the world-gen to play with it. They explore to find new biomes, they explore to find caves and dungeons, and they don’t have to be aware of the math that put them there to know that their exploration will yield results. They just won’t be able to predict WHEN, which means they’re playing the game without seeing the strings that make it work. The gamedev (that’s you) is saying, “Don’t worry about how it’s made, but trust that you’ll enjoy playing this level/world/fight.”
**END NERDINESS** (well, not really)
So what do algorithms mean for you as a gamer? Tons of stuff! They change the way we play games. Think of the AI Manager in Left 4 Dead. If you haven’t heard about it, that’s okay. It was a big deal back when L4D came out, because it governed the spawning of hordes of zombies and special zombies in partial response to how the players were playing. It allowed the 4 levels that L4D had to be played over and over, changing when the stress points and bad stuff occurred over the course of the level. Your objective is: get to the safe room while killing as many zombies as you can. Now, if you dally too long in a weapons closet, the AI Manager will send zombies after you again and again until you get moving. It will place obstacles in your path like special zombies to make sure the excitement level doesn’t get too low. It will place witches (bad, bad, bad zombies) in the most inopportune places to ensure that you don’t sleep at night. It allows players to react to challenges in an extremely ORGANIC way, because they have to be able to deal with problems as the occur without being able to predict WHEN they occur, even if they’re an expert at the game.
Also worth noting that it means the player is never “safe.” If you totally clear out a building of zombies in MOST games, you know you can hunker down there without pausing and go get a Mountain Dew. Not so in L4D. You come back, wiping Dorito dust off on your heavy metal band shirt to find that your entrails have become your extrails.
Algorithms also govern how the game “plays you.” In Dead Space, like I mentioned, there isn’t an algorithm that spawns enemies like in L4D, because the experience is supposed to not be a question of “survival” so much as a question of going insane from terror. Those kinds of experiences need to be carefully crafted. However, there IS an algorithm that takes stock of your inventory (and probably which guns you like), and spawns ammo more often for that gun. The game accommodates your playstyle. Let’s say you’re not a gun person (flower power, y’all! Kill the zombies with love <3), but you do enjoy beating them to death with your bare hands. I actually love this approach in a lot of games. I don’t know why. The “B” button just looks so nice on those Xbox controllers, and it never gets enough love. Well, a game like Dead Space would have a caveat in its algorithm saying, “Mr. Treasure Manager, sir? The player is taking a lot more hits than normal.” And the Treasure Manager decides that instead of putting ammo in crates, he’ll put medpacks instead, ensuring that you can run up to spiky zombies with blades for arms to your hearts content, as long as you manage to hit the “heal” button with sufficient excess as to live through it.
Lots to think about. I want you folks to give me something to work with, here! Comment or otherwise get to me an algorithm YOU’VE found in a game you’ve played, whether it’s a particularly pesky enemy AI, or the thing on your phone that gives you new Sudoku puzzles whenever you need them. I want to hear from you! Seriously.
See you Friday!
Zombies are everywhere! No, I don’t mean that the apocalypse that we all dread (or secretly look forward to) has arrived. I mean that no matter where you look in video games, there are zombies. Of course, zombie games have their own delightfully gory and gratuitously violent genre, for which I’m very thankful. From the classic games like “Zombies Ate My Neighbors,” to the campy arcade “House of the Dead,” to the incredibly creepy “Resident Evil” games, there have been quite a few gems in the zombie game universe. But you can also find zombies in the strangest places, from Minecraft to Ninja Gaiden to Zelda to even Mass Effect! There is something alluring about the undead that game creators latch on to, and in any game where you have a means of killing the enemy (aka NOT games like Cooking Mama or Animal Crossing), you will find that a stereotypical zombie-like thing will be cleverly (or not-so-cleverly) inserted, for the simple, gleeful pleasure of massacring them. Hooray for zombies! Read the rest of this entry