Happy post-holidays everyone. Well, except for New Year’s, which is this week.
Working on specs for the combat engine… a large part of this is reworking some of my original designs. I’m trying to keep math as simple as possible; single adds or subtracts rather than complex abstract multiplication.
For example, a basic attack is player level plus the hit modifier of a weapon, plus any hit bonuses granted by other items or temporary buffs granted by spells. A random value of 0-31 is added to this, and this is the “hit” value that must equal or exceed a defensive value of the target.
A more significant change was the removal of “item count” from the item structures. My original plan was to have two bytes for each item; one was an item number (0-255) and the other was the item count.
This caused issues, though, because it would mean that a player could carry a huge number of items, like healing potions, that only consume one item slot. It also meant that it would be difficult to have unknown items like “untried potion”. I also was unhappy with the 256 item limit, because it would make expanding item count impossible later, if I was to do an expansion or something.
So I decided to change the count byte to a type byte instead. This lets me have up to 256 of any one item type (swords, potions, etc), and I can have untested items as either a separate type category or use a bit in the item # to indicate it’s untried. To index the items in a larger file, I’ll just have an offset value for each item type; such a table would be very small and easily stored in CPU memory.
This only had one drawback… what to do with ammunition, the one thing in the game I needed to have an item count for.
My original plan was to have ranged weapon damage determined by the ammunition used, and have different types and levels of ammo. Each was a separate item.
I’ve had to change this so that instead, ranged weapons determine damage, and ammo is static; bows use arrows, guns use shot, etc. Instead of storing ammo counts in item form, each player just has four counters for each ammo type, and I’ll hack in buying ammunition so that it just increases the ammo counts.
Why have ammo at all? Well, there’s the issue of limitations. If you’ve played Tunnels of Doom or the old Ultima games, ranged weapons were by far the superior choice in 2D tactical combat. They let you hit the monsters without being in melee range yourself. In Tunnels of Doom, a great tactic was to take an ordinary sling and use a weapon honing ability to increase it’s damage. With “unlimited” ammunition, it quickly would become the weapon of choice. So having limited ammo is important for balance reasons.
Once I’m done with the spec revisions, I’ll be getting a combat engine propped up so that I have a skeleton to add some meat to…