Blog Archives

How Algorithms Make Games Awesome

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.”

This is the one you meant, right?

This is the one you meant, right?

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.

This is math. Don't you love math now?

This is math. Don’t you love math now?

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.

Somebody took too long in the toilet...

Somebody took too long in the toilet…

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!

~AG

Video Games and Learning: A Non-going Process

Hey, folks! Happy Monday!

I told you all that I’d be writing periodically to tell you about the fascinating things I’ve been finding out about video games in my “Video Games and Learning” Coursera course.
Turns out, not much.

Fact of the matter is, outside of an educational perspective, I could have written most of the material for the course. Talking about the elements of game design that teach a player, how increasing complexity and introducing game elements at different times affects the learning curve, etc. etc. I know this stuff because I’m a gamer (and an attentive one, at that), but the course was written for non-gamers who think it’s a fabulous idea to use games in the classroom.

I’m not on a pedestal, I’m not in an ivory tower. Educators, USE YOUR GAMES. Use MY games! Education departments of the world, hire programmers to work full-time on producing learning games for people of all grade levels and subject areas. Imagine how AWESOME it’d be if you got to kill monsters in “Wuthering Heights: The RPG,” or create epic physics-based puzzles in “Anatomy and Physiology: Zombie Edition.” I understand that courses like this give educators a leg up when figuring out how to teach difficult concepts in a way children will react to, and I appreciate that these resources are out there to improve our education and our teachers.

But I guess I’m approaching education from a game design perspective, as opposed to approaching game design from an education perspective, and I was sorely disappointed. I’ll do a post Friday about my final thoughts on the course, but other than that… sorry, folks! Didn’t turn out to be as beneficial as I had hoped!

Here’s a picture of 9 Charmanders driving a golf cart to make you feel better.

Charmanders-Golfcart

 

 

See you Friday!

~AG

Why it’s time for a video game music Renaissance

Hum a melody from a video game that came out in the past 10 years.

Go ahead, I’ll wait.

Chances are, you can’t, unless you cheat and use melodies from a Mario remake or the Halo anniversary edition. But why is that?

Well, let’s give a brief history of video game music (again [again {again}]). You had bleeps and blips with pacman, then someone came along and invented MIDI (woohoo!). Gameboy and Nintendo had 3 wavetable oscillators (pronounced “instruments”) and a noise machine for percussion. Then you get 16-bit stuff, samples, FM synths and some pretty rad stuff with Super Nintendo, Sega, etc. etc. Playstation comes around and supports digital audio! Woohoo again! Then from PS2/Xbox/Gamecube onward, you get mostly high-quality crystal-clear audio with amazing processing, either recorded by a live orchestra or painstakingly crafted from magnificent music libraries (like the main theme of Game of Thrones. You thought it was live, didn’t you? Nope, libraries). With the most modern consoles, adaptive music has come into play that defies the very idea of a soundtrack and offers a smooth blend of music from one place to another.

Whew, that was a crash course if I’ve ever seen one. Point being, the blinders have been removed, the constraints are nonexistent, and the audio processing capabilities of the newest consoles/PCs are so powerful that it’s the compositional equivalent of a kid in a candy store. It really is that good. And therein lies the problem.

Read the rest of this entry

The New Fairytale

I’m sorry for not writing before now! Two reasons: first, my computer is kaput. Not your problem, I know, but it did kind of put a damper on my blogging abilities. Second (related to first as well), I’m playing through the game FEZ, and I’m working on kind of a big post about it. However, I realized that I was not nearly deep enough into the game to do it justice, and my save file had just been erased. So, the past week has been comprised of relearning and redoing everything I already did, and finishing up that game. Look for the awesome post Monday! It’s going to be magnificent. Anyway!

With the recent release of GTA V I thought it’d be a good time to discuss the positive impact video games have on our children.

No, really.

Read the rest of this entry

The Terrible-and-Wonderful-ness of Candy Crush.

I don’t review mobile games. I don’t like talking about mobile games. I hate most mobile games with a passion that I would literally rather read soap bottles while sitting on the toilet than play any of the freemium garbage I can download from the Google Play Store (except for the GameBoy Color emulator. POKE’MON CRYSTAL, Y’ALL).

But dude. Candy Crush. Candy Crush is the most addictive piece of crap ever. I am not above saying this (however I am above saying “addicting” because that’s not a flippin’ adjective. Didn’t you learn parts of speech in 1st grade? You didn’t? Not my problem). Point being, I’ve sunk some time into this freemium piece of empty calories, and I’ve concluded through long hours of research (aka. travelling, waiting for doctor’s appointments, etc.) that this dumb game is made by very, very smart people.

And they look like this.

And they look like this.

Read the rest of this entry

Why Mario is the greatest video game character of all time.

I tire, frankly, of doing serious posts all the time. Yeah, J-RPGs are dead, mobile games are like digital dementors except that they’re better at sucking your soul out, and as I grumpily tell these young gamers to get off my lawn while I’m enjoying the nostalgia, I reflect on my younger days… I came home every day and enjoyed the hell out of some video games. I come home every day now and enjoy the hell out of completely different video games, and usually there’s beer involved now (another big plus!). So I’m going to stop bitching for a while, if it’s all the same to you!

Okay, maybe not about Zynga. Screw you, Zynga.

Okay, maybe not about Zynga. Screw you, Zynga.

Read the rest of this entry

We’re not kids anymore, folks.

We’re grownups, we have responsibilities! You know, when we were four, we dreamed of growing up to become a firetruck. Then, shortly after realizing that becoming a Transformer/Megazord is slightly out of our range of career options, we decided on something slightly less awesome. And we slowly but surely worked our way through being picked on, then puberty (oh god), then all that great stuff that happens after, like getting a job and going to college. And none of that has to do with video games. But you remember when you were __ (insert your appropriate age here) and Poke’mon Blue came out? You flipped your frickin’ lid. You saw a video game cartridge that was BLUE. It was blue, folks. And you had to have it. You pestered your _______ (insert appropriate family member or figure with money here) so much that he or she took you to Toys’R’Us and just bought you the damn thing. Score one for kid you!

And it has a Blastoise on it! Holy crap, this game couldn’t get cooler if it turned into a fire truck!

Read the rest of this entry