PyWeek Day 5

19th April 2018

Day 5 of the PyWeek TwoWorlds challenge, and we have a game. It's not perfect, but it is complete. I still have lots to do, and I'll keep working on it before the challenge ends, but it is in a state where it could be submitted. We have monsters, traps, scrolls, potions, wands, weapons, armour, normal levels, magic levels, and the Amulet of Yendor!

Rogue: Through The Veil day 5 game play extract
Rogue: Through The Veil day 5 game play extract

TODAY’S GIT log reads: Traps, Wands, Food, Permadeath, AmuletOfYendor, MonsterAbilities. I got quite a bit done! But I’ve got a nice groove going on, some patterns to follow, and some great code re-use. But not the best code re-use, I certainly breaking the DRY rule in places and I’m really looking forward to improving the abstraction, after the competition.


TRAPS ARE based on items, but you don’t pick them up! They’re hidden, unless you are unfortunate enough to trip one, then whatever function the trap has been assigned will be triggered. I don’t think there’s a good trap, the teleport ones can be useful, and there’s one that’ll throw you into the magic world, but mostly they’re just annoying. They are a classic of the Roguelike though, and they do make the game more exciting.


I WAS right, I could basically base these off my projectiles code. There were enough subtle differences to make me re-write a bunch of code though, one of the reasons I want to do some more abstraction. But being in a rush, it was quicker to re-write working parts of an existing function with tweaks than to think about how to abstract it, then debug it!

I’ve added a couple of features to wands that make them different from the classic Rogue. These will only zap when they acquire a target, so you can’t test them without a monster. You can identify them with the Scroll of Identity, but not by using them. I took advantage of this, feeling in a cruel mood, to add a Wand of Summoning, which will produce another monster next to you. Evil, I know. I also make a vampiric wand, to suck HP from your foes; handy in a pinch.


HUNGER AND food are another difficulty to contend with, as if monsters weren’t enough! You will need to keep an eye out for food, and I really mean keep an eye out, it’s not that easy to spot. If you don’t get enough, you will die.

Permadeath and The Amulet Of Yendor

WHEN YOU die, which will be often, you are dead. There’s no saves, no extra lives, nothing. Except a beautiful screen to commiserate you on your expiration, before the game closes. Classic roguelike! Now this feature works, testing has become more difficult.

On the flip side, it is now also possible to win the game. After level 25, “The Amulet Of Yendor” is placed on the map, and I made it obvious in red. Just pick that up and make your way back through the 26 dungeons you took to get it, with monsters and all. At the end you will win and be greeted with a nice congratulatory message. To test this, I made the amulet appear on level 2, a whole 3 level long game.


NOW I’M going to start adding in things like cursed items, weapon mods for attack and dexterity, and identifying weapon stats. On the map side I’ve got time to play with skipping a room, swapping a room to a maze, and hiding sections of the passageways. This makes it look like either a dead-end or a missing door, which the player has to search for.

I’m glad the game coding has progressed so quickly, now I’ll get time to play with some of these less important but fun features.

Post Tags

All Tags

LIFE IS better when we share.