Complete Roguelike Flash game in less than 2KB

If you are a regular reader, you should know sometimes I try to create Flash game in less than 2KB.

After Sokoban, Bejeweled and a math game with an original concept, it’s time to show you my Roguelike game in less than 2KB, here it is:

The roguelike is a sub-genre of role-playing video games, characterized by random level generation, tile-based graphics and permanent death. Roguelikes descend from the 1980 game Rogue, particularly mirroring Rogue’s character- or sprite-based graphics, turn-based gameplay that gives the player the time to plan each move, and high fantasy setting (source).

Let’s see what I was able to do in only 2KB:

* Random level generation
* Level progression
* Rogue style graphics
* Player energy
* Player score
* Basic enemy AI
* Game over screen

Have a look at it:

You control the green “9” (which also represent your energy) with arrow keys and must kill all red “M” (the monsters).

You kill a monster when you are in a cell adjacent to the monster and move towards it.

A monster hurts you when you end your turn in a cell adjacent to the monster.

But the most interesting thing of the script, unlike my previous 2KB experiments, it I managed to have a quite legible code.

When looking at the source code, please consider it’s optimized for small compiled swf size.

Download the source code.

  • Amazing tutorial! I always love seeing your work and what else you cook up. I never had a good grasp on AS3 until I saw your tutorials, and I liked them so much that I even use them alongside my lesson plans for teaching kids ActionScript. This summer we’re using your Roguelike as a one-day workshop, but in the past they had a blast making Angry Birds and Plants vs. Zombies. Thank you again!

  • hello

    Hey what I like the most about this is that there are 3 errors that show up though this game runs properly regardless, fixing them is so easy, flashdevelop just says what line to go to and says that the variables don’t have their type declared and its very obvious what type to declare them as, and walah, it runs faster and now you feel really proud of yourself. Well, I do. :)
    I’ve to admit though I struggle a lot in understanding so many lines and what’s going on but I love it.