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?


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!


EA: The Road to Success?

So it’s been a busy couple of weeks. Happy belated Thanksgiving to all of my loyal readers! I love you, mom!

I haven’t had the chance to play many games over the “break.” Work, composition, coding… it’s all kind of taken precedent over my “leisure” activity, though I do try to keep current with what’s up.

New consoles! Yay!

See? I’m current. I’m hip.

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

Yeesh. Yeesh yeesh yeesh.

So, in a fit of nostalgia, I decided to go back and play the Megaman X series. That, and a friend of mine happened to have all of them and was willing to entrust their awesomeness to my unworthy console.  Eight games (plus an RPG I think?), eight bosses in each game, that’s 64 levels plus Sigma, Sigma-2, Sigma-3, etc. of platformy, deliciously blow-uppy goodness. Blow-uppy is a word as long as I say it is.

What’s the problem then, Another Gamer? Did you find that those awesome games of your childhood weren’t as awesome in adulthood?


OF COURSE NOT, YOU FOOL! X1-X6 are AWESOME. They kick so much ass, SPCA could almost charge them with animal abuse! X was innovative, X-2 built on its predecessor, X-3 was a flawed but amazing conclusion to the SNES days. X-4 was VOICE ACTED OMGSH ZERO’S VOICE IS SO SEXY <333 X-4 was also in my opinion the height of an epic battle between two forces, neither of which was truly good or evil. Very shades-of-grey (not BDSM) for a Megaman video game. X-5 was again awesome, but more for its gameplay innovations than its plot. Having said that, the plot was awesome and involved a giant space station crashing to earth. Rockin’! X-6, like X-3, was a flawed but still pretty awesome conclusion to the PlayStation era of Megaman! (Now, with real awesome Japanese voice acting-desu! Makes it feel more anime-like than any of the previous ones!) And btdubs… I did beat the tutorial level of Megaman X-6 using a Dance Dance Revolution dancepad. Just for the nerd cred. It was hard. I flailed like a fat kid playing Dynamite Rave on Heavy.


Hoo boy. Then I decided to start with X-7. What. The. Hell. What? What?? My flabbergasted speechlessness is understandable to anyone who has picked up that godawful game.

I look so natural and realistic!

I look so natural and realistic!

My graphics are polished and not confusing!

My graphics are polished and not confusing!





Let’s go on an in-depth search for why, in the remake of Star Wars: Episode IV, instead of putting normal trash in the garbage compactor scene, they simply filled it full of copies of Megaman X-7. It’s so bad, nobody would even save Luke, because they didn’t want to leave this game in existence.

  • The game sucks.
  • Bad.
  • The graphics are awful and klunky.
  • The voice acting sounds like it was done in a tin can that was placed in a prefab house driving on the freeway at 65 miles per hour.
  • The voice acting also sounds like it was done by a prepubescent teen with strep throat.
  • The tutorial was awful, and by awful I mean perhaps one of the most awful tutorials ever.
  • The tutorial was not only awful, but it didn’t prepare you for the game at all.
  • The plot was contrived and confusing, with a long introduction about things nobody cares about!
  • The game itself was… just… mind-numbingly awful. It tried to make a 3-D platformer but instead created something that was the awful, hell-spawned lovechild of the worst of the Contra games and Megaman Legends, and then got a hefty dose of radiation on the way out and was born as a mutated nightmare. I cannot hate this game enough.


I’m glad we had this talk. Don’t play this game. Please. Seriously. Don’t.


See you next week!


The Birth and Death of the J-RPG

Sorry for not posting on Friday! This idea has been rolling around my head for a while, and it took me a lot longer than expected to get it down!

Kind of a dramatic title, but Japan has dominated the video game market for about as long as it has existed. That’s started to change in recent times, but certainly every big title in the early days came from Japan, from Tekken to Mario to Zelda to Final Fantasy to Bomberman to Street Fighter to Pacman to Poke’mon to… well, you get it! One in particular piques my interest more than the others: Final Fantasy. It is the epitome of the J-RPG (that is, the Japanese Role-Playing Game), and in a large sense has defined the genre of RPGs as a whole. Not much more I can say to make that clearer. You’ve probably heard of them even if you don’t play any video games at all. If you’ve played video games for a long time, you’ve probably worked your way through three or four of these games at some point, and even if you hate RPGs you probably at least had a soft spot for one of them.

They’re a big deal. One of the biggest deals in the whole industry, actually. Moving on.

This crappy montage courtesy of yours truly...

This crappy montage courtesy of yours truly…

Read the rest of this entry

Adaptive Music and Video Games: A Love Story <3

Hey folks! I’m starting this on Friday (a little late, to be honest), but it may not be done till tomorrow. Sorry in advance!

So. Adaptive music. It sounds like something you’d hear at a Borg nightclub. But seriously, what IS adaptive music??
It’s music that adapts.


Well, that was a short blog post. See you next week!…

Read the rest of this entry