Author Topic: Qaf - A roguelike implemented in Python  (Read 8158 times)


  • Newcomer
  • Posts: 27
  • Karma: +0/-0
    • View Profile
Qaf - A roguelike implemented in Python
« on: November 19, 2016, 01:59:36 PM »
Hello, you might have noticed I stopped working on practicerl. Actually, you probably didn't, I imagine all of you have more important things to do than camp my github profile. At any rate, development didn't stop, it got shifted around and forked sufficiently that attempting to merge it back into the old repo would have been more trouble than I was interested in.

It has come a long way, and if anybody wanted to take a look at it and give me feedback, I'd love to have it. This is honestly the most complicated code base I've ever actively worked in, so I'm certain I've done several horrible things. In fact, I can think of a few horrible things I hope to be fixing once I finish the push to an Alpha release.

What works:
1) Level generation w/ the placement of monsters (Orcs and trolls at the moment).
2) Movement in all 8 directions using the traditional keys.
3) Monsters know how far away they are from you.

What doesn't work yet:
1) Combat. That will be my focus next week. I expect to have a playable alpha by Friday. Specifically, that means a single level filled with monsters you can try to kill who will also try to kill you. No healing, so it's more a question of how many you can kill before you succumb to your wounds, but then again that's most roguelikes so... excellent!
2) Logging. I attempted to create a log file, but it's failing to log for me and I'm not sure why.
3) Messages. They show up, but they all just overwrite each other, none of them go down to the next line. If anybody could help me figure out what I've done wrong there, I'd appreciate it.
4) FOV. I haven't even bothered yet because I'll be writing it by hand. I've read the implementations on roguebasin. I don't understand them well enough to rewrite them. And since this is a learning exercise, not a AAA game, I don't want to copy/paste code. I've worked up a mental representation of how raycasting works, but I had one of those for A* for years before I finally worked out how to do it. Fortunately, the A* stuff (particularly the recursiveness of it) should help in implementing this so I doubt it will take that long.
5) Error catching. If your terminal doesn't have enough colors, hard crash. If your screen is too big, it sometimes hard crashes. If you do something it doesn't expect, hard crash.
5) Saves

It currently has no dependencies outside of the Python Standard Library (several of the files import a library called attr, but none of those files get imported at the moment). Run python3 and make sure you have all the colors (I haven't put any error checking or fallback for color-poor terminals) and then run python3 to play. Press q to quit the game. This is known to work in Linux with an xterm-256colors terminal. Not tested in any other platform (well, that's not quite true. I know it doesn't handle color-poor terminals because I tried it in a plain xterm terminal). Once more, feedback would be greatly appreciated.


  • Newcomer
  • Posts: 27
  • Karma: +0/-0
    • View Profile
Re: Qaf - A roguelike implemented in Python
« Reply #1 on: November 28, 2016, 07:33:19 AM »
I've hit the 0.1.0-Alpha release for Qaf! Still very basic, but it's developing. I'd like to get some feedback, so please take a look at it.


  • Newcomer
  • Posts: 27
  • Karma: +0/-0
    • View Profile
Re: Qaf - A roguelike implemented in Python
« Reply #2 on: November 30, 2016, 06:38:21 AM »
Newest update to Qaf:

Version 0.1.1-Alpha

Release notes:

This minor point release addresses bugs found in the initial 0.1.0-Alpha release. Explanations below:

  • #2: Resolved logging import issues so that Qaf.log displays all module names.
  • #9: Fixed corpse display bug by removing corpses from the game until I have implemented equipment. At that point, corpses will be added back in as equipment.
  • #10 Fixed a typo in monster.Monster
  • #11 Fixed a typo in readme.MD
  • #12 Fixed crash on start by expanding compatibility to include all terminals with curses support, regardless of colors.
  • #13 Fixed infinite loop caused unbound keystrokes.

  • Code refactoring. It may not directly impact gameplay, but it sure makes my life easier!
  • Game over message. Now the game no longer directly crashes out when you die!

[Due in the next release]
  • Improved pathfinding: Monsters will path directly to the player rather than pathing randomly to 1 of 3 tiles nearer to the player.
  • Improved AI: Monsters will have the ability to 'cower' based on their health. Also, monster pathing distance will be based on monster AI.
  • Basic equipment: permanently equipment equipment. Mostly for vetting how modifiers will get passed to attributes, skills, etc.
  • Passive defense: Add a defense skill which makes you harder to hit.
  • Implement basic hit location logic: Precursor to the intended combat model of modeling wounds to locations rather than depleting hit point pools.
  • Expanded beastiary: Add several more monsters and monster types.