New Project: Roguelike in Python
Posted by postfuturist on 2009-03-29 23:45:58

Something I have been mulling over in my head for awhile is the idea of writing my very own roguelike game. A few years ago I was introduced to Nethack and I haven't been the same since. Many of these games are open source already. The ones that I have looked at are Nethack, SLASH'EM (a fork of Nethack), Angband (and Zangband), and Dungeon Crawl (Stone Soup ed.). Of these games Nethack/SLASH'EM is the most venerable of the group with perhaps the deepest game play, written in C. Angband has a very mature, stable source code, also C, that has invited countless variants. Crawl has a C++ code-base and has seen a lot of interest and development in recent years.
My motivation for writing a new roguelike is that the existing choices are not terribly fun to hack*. C and C++ are languages that I am perfectly comfortable using, especially if I am getting paid to do so. While being paid a salary, I wrote nearly all of the AI code for a Godzilla : Unleashed, a console video game title "unleashed" on the Playstation 2 and Wii consoles for the Christmas 2007 holiday shopping season. I wrote that code in C++. Now, when I do programming for fun, I use languages that I like to do. For the last couple years, this has mostly been Python. Even if I am not using Python, I would prefer a dynamically typed language.
Besides working in a dynamic programming language environment, I would like to build a more flexible core game engine for roguelikes. Here are my goals for this game:


  • Written in Python

  • Loosely coupled OO-style classes

  • Easy to configure as stand-alone game, client-server, or even multiplayer client-server

  • Turn-based with option for real-time play needed for multiplayer server

  • Utilize JSON for client-server communication.

  • Ability to write clients in any language

  • Game assets / data created in JSON files outside of code

  • Easily customized by non-programmers


Secondary goals:

  • Multiplayer server

  • Game customizable through simple GUI application

  • JavaScript client that runs in browser, connects to remote server

  • JavaScript client support single-player mode and multiplayer/realtime play

  • Server database backend with web interface for showing high scores, player stats, etc.

  • Multiplayer server instance supports multiple active worlds.

  • Scripting support (game customization through user created scripts)


About my decision to use JSON for game data and communication: Python is to C/C++ as JSON is to XML. There is absolutely nothing redeemable about XML other than the fact that it attempted to be a useful data interchange format that is human readable. Too many other people have spent too much energy explaining why XML is lame for me to get into the details. Whereas I don't mind coding in C or C++ for money. Having to work with XML gives me pause. I'd rather not, under any circumstances. JSON, on the other hand, is light-weight, is free of arcane requirements, and is actually pleasant to view and edit by hand. Enough about that.

At this time, I am targetting Python 2.5. It is really the gold standard right now for Python. I'm more likely to port to 2.6 in the future when the unladen-swallow project comes to fruition.

That's enough architectural day-dreaming for now. I've got some basic functionality to build. Stay tuned for more.

* I use the verb "hack" here in the same way that an auto mechanic might use the term "tinker with."


Comment from isaac lee:
hey, me and my bud r trying 2 make a rogue like on python and would like a source code fer ur game or some reliable instructions. we have looked every were and r having little to no luck... we would really appreciate ur help. i have had little training so thats y i ask...also have u seen the game on kongregate called "nameless roguelike"? its very fun and challenging. -please help us -Isaac Lee

    Leave a comment: