Combat

You are thrown back as a sharp, piercing pain blossoms from your chest. The sight of the wooden bolt shaft is the last thing you see as you succumb to darkness.

You hastily retreat to the darkness of the enclosed corridors, sure that the monstrosity cannot chase you into this area of the dungeon. Suddenly, there is a sound of fire, followed by a rush of wind as a massive wall of searing fire consumes the corridor burning all unfortunate souls within. That was you. RIP.

The short, quick jabs of the kobolds bounced harmlessly off your plate armour as you dispatched of these annoyances. However, one of those rascals had somehow slipped a nasty dagger through a crack in your armour. Your scars bear memory to that time, teaching you to not be so careless. There is no such thing as a safe combat.

And that is the kind of atmosphere I want to create in this remake of the game. With many games that I have played, once you get past the initial difficulty of equipping oneself or gaining a few levels to up your HP, the rest of the game became easier or at least facing opponents at the start of the game when you’re much higher level became a chore, a grind, a boring hold the direction key down and mow through those enemies.

Well, not this game! Combat is about life and death. And I want the player to feel that danger on every encounter. This shouldn’t be like Grim Dawn or Torchlight or even Adom where by mid-game, you’re killing 10 enemies per second.

Another aspect of alot of RPGs I’ve played is how absolutely useless beginning level weapons get as you gain ‘better’ equipment. The worst offenders are JRPGs where the moment enter a new area, you have to go to the shop and upgrade your weapon and armour to the next tier otherwise you can’t survive. Lighter weapons are faster, more flexible, able to afford more control. Heavier ones makes a bigger impact, but can be unbalanced. My goal here is that the puny dagger or even a shortsword is still viable in end game if your combat strategy is geared towards skill rather than brute force. In the original game, the different weapon types did not stand for much.

Some of my current ideas include things like, two handed swords should swing through several adjacent squares, war hammers can potentially knockback or even knock a shield from the enemy’s block. Daggers have a penetrating ability through plate but not mail and other abilities.

At the start of this, I felt a bit disinterested in this area of the game. I was in a mindset of churning out features and combat was something I didn’t have a set of rules telling me what to do so I felt burdened by the fact I had to invent it. But the irony is… this is actually the first creative part of the game that I have control over! And over the weekend as I was talking to a friend, I became more excited about the combat system, finally having the ability to model combat as I had seen and wanted to make for all those years.

The Arena

This will be an interesting and very useful place for balancing all my combat ideas. I’m making monsters have stats, equipment and attributes just like the hero. In fact, all that will separate the two are very minor things like the hero has a gender and the monsters are tracked by ids. What this means is that I can play with attributes and equipment damages and it will affect all the monsters and hero in the game. I feel this is much better than hardcoding each monster to some hp or some damage range that’s unrelated to the loot they’ll eventually drop. I mean if you defeat a ogre that’s just slammed you into the wall with a giant club, how realistic would it be for that ogre to drop a dagger as loot.

So the idea here is to have a large list of monster vs monster and monster vs hero with different weapons at diff levels and test out the combat results from each taking a hit at the other. Then everytime I do a tweak, I can run it through the arena and see how the change has affected combat outcomes. I probably won’t do a full AI and place monsters in rooms for this. I think just having two monsters take turns is good enough to get a general feel for combat balance.

Other news

Soul destroying refactoring

So over the last weekend, I had gotten excited about doing some refactoring to my Items type in the game. Since I had gotten quite confortable with the language Elm, refactoring was no longer the big, scary thing I had encountered at the start of this journey. It would be normal to start a refactor and then keep making API, model, type changes to different parts of the system and then just letting the compiler tell you the errors. This is something that I love about the language. That no matter how messed up your code may seem, it all just seems to work out at the end.

However on this occasion, the change that I was making was quite large and as I continued through it, I had realised that the benefits I sought was replaced by other complexities that I didn’t consider. And eventually seeking type safety got me really really ugly code. It took ~6 grueling hours, 1000+ lines of code in 20 files done over a weekend where I became quite moody and was snapping at the kids (I know, bad dad…) but eventually I reached the other end and the game compiled again. Phew!

This was not the end of it though. That refactor to create a polymorphic type made the rest of the code shit and the benefits was quite minimal. So later that week, I spent another 2-3 hours to REVERSE that change, but not only reverse it… I embraced openness. See up to this point, all of my types was hidden outside of their individual model so when anything wanted to talk to anything else, there would be some great ceremony (APIs). I blew away at most of that, meaning that it was much easier for code to call each other which funnily enough, does not affect the app’s robustness at all but gave me more flexibility.

This eventually lead to me discovering some new features of Elm and I’m happy to report that the code is now much cleaner for it.

Elm 0.18

This is something that I had been eagerly awaiting for the last few months for the promise of a time travelling debugger. I’m really happy to say that it will be released tomorrow!!! However it’ll probably take a few days for the libraries that I use to be updated too. My first attempt at a upgrade was met with alot of failed package upgrades so I opted to continue working on the game for the next week and upgrade at the end of the week. Good times are ahead!

Onwards, upwards, forwards and always twirling, twirling, twirling…

Atm, full steam ahead on combat, once done with the basics of that, I’ll setup an arena and start gluing the bits together to get a alpha going. I guess even if I can’t finish the game this year, I can at least get an alpha out that’s playable. So that shall be the goal, let’s see what happens next.