Tuesday, June 25, 2013

Pugnacious Wizards 2, version 0.4 (now worth playing!)

Version 0.4 adds several new spells - 9 total. There's a bit of a slowdown sometimes, but I'm looking into that.

This is mostly what I want. The next few updates will probably just add content (like new spells) with very few major changes.

As always, any feedback is welcome.

github source

download swf

update the latest version is at http://trystans.blogspot.com/2013/09/pugnacious-wizards-2-version-10.html

Tuesday, June 18, 2013

TDDing yourself into a corner

I've been playing around with Scala lately and while doing the Roman Numeral kata, I ended up with this.

def numeral(i:Int):String = {
  if (i == 0) return ""
  if (i % 1000 <= 900) return numeral(i-900) + "CM"
  if (i % 1000 == 0) return numeral(i-1000) + "M"
  if (i % 500 <= 400) return numeral(i-400) + "CD"
  if (i % 500 == 0) return numeral(i-500) + "D"
  if (i % 100 <= 90) return numeral(i-90) + "XC"
  if (i % 100 == 0) return numeral(i-100) + "C"
  if (i % 50 <= 40) return numeral(i-40) + "XL"
  if (i % 50 == 0) return numeral(i-50) + "L"
  if (i % 10 == 9) return numeral(i-9) + "IX"
  if (i % 10 == 0) return numeral(i-10) + "X"
  if (i % 5 == 4) return numeral(i-4) + "IV"
  if (i % 5 == 0) return numeral(i-5) + "V"
  numeral(i-1) + "I"
}

I did the simplest thing that possibly could work, followed the red/green/refactor cycle, and I even followed The Transformation Priority Premise. There's better ways of doing this, but I think I'm stuck in a local maximum and I'm not sure how to refactor my way out of it. Using a lookup table is an obvious improvement (such as List((1,"I"),(5,"V"),(10,"X") ...) but those funky comparisons make how to get there non-obvious. TDD doesn't seem to point me in one direction or another. I do believe that Test Driven Development often leads to clean and well factored code so this is an interesting case. TDD lead me down each step I took to get here and it's not leading me anywhere from here. So maybe this is the simplest way to write this?

Sunday, June 16, 2013

Pugnacious Wizards 2, version 0.3

Version 0.3 mostly adds help. There's a help screen, an examine screen, and help popups. There's also a few new room themes, but nothing much.

The next version will add several new spells and will — I think — be the first version worth actually playing.

As always, any feedback is welcome.

github source

download swf

update the latest version is at http://trystans.blogspot.com/2013/09/pugnacious-wizards-2-version-10.html

Monday, June 10, 2013

Pugnacious Wizards 2, version 0.2

Version 0.2 adds guards, archers, new rooms, health pickups, better lighting and effects, and many tweaks. I can beat the game about half the time, which means it's too easy. It takes about 20 minutes to play. It's starting to feel like a real game even though it only has three spells.

As always, any feedback is welcome.

github source

download swf

update the latest version is at http://trystans.blogspot.com/2013/09/pugnacious-wizards-2-version-10.html

Friday, June 7, 2013

Pugnacious Wizards 2, version 0.1

I really enjoyed making and playing my 7DRL PugnaciousWizards. So I started from scratch and have made a new one. Or at least some of it. There's only three spells and a bunch of traps so far. There's no help, examine, or explanatory popups. No bad guys either.

As always, any feedback is welcome.

github source

download swf

update the latest version is at http://trystans.blogspot.com/2013/09/pugnacious-wizards-2-version-10.html

Wednesday, April 10, 2013

Pugnacious Wizards Retrospective

Pugnacious Wizards!

Another year, another 7DRL. This year I tired to focus on more interesting traps and more interesting magic. When I could, I tried to include help for newbies and veteran players too. So what happened?

What went well?

Traps. There's basically four traps. Each is different. Some are obvious (the arrow towers and rotating towers) while some aren't obvious (floor traps and wall arrows). Each can be used to hurt others once you figure out how to avoid them. Even though the floor traps were the most boring, it's possible to figure out the pattern for the room and use it to your advantage. So traps become a benefit rather than a detriment. Pretty cool I guess. I had ideas of moving spike balls, retracting bridges, and other wackyness. The basic idea is discovering patterns in your surroundings and using it to your advantage by avoiding the dangerous spots and tricking your enemies into the most dangerous spots. The gameplay is pretty good (I think) and the code is not too bad for a quick-n-dirty 7DRL. One interesting thing is that the World class has a list of functions it calls every turn. Many of the traps were implemented by telling the world to call some function each turn. That means that the items, tiles, and world didn't have to be changed in order to implement traps. Totally OCP. Totally rad.

Interesting magic. This was the first time I really tried making a magic system. I hard coded a lot of things, then refactored to be more reusable. Even though I didn't get as many magic spells as I wanted, it worked. And there's a few emergent effects (freezing yourself when on fire, burning trees near enemies, etc). The code was just barely flexible enough for this 7DRL. I did manage to make use of the Composite Pattern.

Simple enemies, no stats, no items. The focus is on magic and traps. That means the game really only needs a few enemies. A melee type, a ranged type, and possibly a magic using type. The skeletons are just there to force you to move on. The interesting magic means there's less need for stats and equipment. Although I've got ideas about that too....

Help. I added an attract screen where the computer tries to run through the game. It's a good way to show the basics of what's going on. I also added a decent help screen, the ability to examine surroundings and current spells, as well as popups for the first time you see new things - although it must be dismissible for those who don't want to be bothered by it. I think that was a fantastic success. I also managed to make a game that required very few keys (WASD & 1-9) but also allowed different input styles (arrows,WASD,HJKLYUBN,1-9,mouse). None of those things make it a better roguelike, but it was important to me that it's easy to understand and play. That's also why I used ActionScript rather than Java like last year. The low barrier to entry is important.

What didn't go well?

Magic. I didn't get as many spells and effects as I was hoping for. I was planning on having 27 spells total, 18 in each dungeon, and you can only pick up 9. I didn't get that many spells though. 12 total I think. I was also missing many effects that I wanted: push, stone skin, anti-stone, control others, and more. This was mostly due to not really figuring out how effects and such would work together. What I ended up with wasn't flexible enough for all that I wanted - which was quite ambitious. But it wasn't very well refactored. I think it was quickly accumulated Technical Debt that slowed me down. Debt in the sense that I learned about making reusable magic code faster than I was refactoring the magic code.

AI. The AI for the intro screen hero and other wizards doesn't know how to best use every spell that's in the game. They can use most, but even then, it's not always the optimal move. That's ok, but some spells it flat out ignores. That's pretty lame. This was entirely due to how I implemented the magic. I should have thought this out better. Technical Debt strikes again.

What would I do differently next time?

Magic is tough. At least the style that I wanted. I really should have though about it more and have had a better idea of what was needed. I actually tried not to over think it. Maybe I under thought it.

Useless non-contet. Like many 7DRL challengers, I added a lot of useless content that wasn't related to may main focuses. There were probably two day's worth of work that were wasted on trying to make "interesting" rooms that weren't related to traps or magic. That was removed sense it only made the gameplay worse. It seems that I'm always reminding clients and coworkers to focus on what's important yet this time I made that same mistake. Sometimes human nature conspires against us.

Saturday, March 16, 2013

Pugnacious Wizards day 7

Success!

I didn't have time to do much the last couple days but overall, I'm pretty happy with what I made.

I wanted to focus on magic spells that had multiple effects and traps that are more interesting than the standard "randomly take a trivial amount of damage" that most roguelikes have. I think I did both. Maybe not as much as I had hoped for, but I did both. I also wanted to explain more of the game with an intro that auto-palys and help popups. I think that worked very well.

As far as programming goes, I was able to get animations working - which I've never done before. I also tried putting much of the ai into spells so that the hero and wizards know how to cast them. The magic system wasn't as clean as I wanted, but I tried a few new things with that too. One of the coolest things I did was to make it so the world has a list of functions that it calls each turn. Since anything that has a reference to the world can add to that list, new functionality can be added without changing any existing code. Totally OCP. Much of the traps and magic used this.

As always, any feedback is welcome.

github source

download swf

Update: I played it again after being away for a week and noticed that sometimes the FOV isn't calculated at the right time. I think I fixed it.

Update: I started making a post-7DRL version with better traps, spells, and code. Give it a try at Pugnacious Wizards 2