Pages

Monday, November 19, 2012

The Robe and the Wizard Hat


It's been a while since the last update, and quite a lot of things happened, so this will be another rather long update. I really should do these more often so they don't end up so huge.

First up is feats. The vast majority of them are done. Out of the 170ish (give or take a few) feats I entered in the game's database when I started working on the feat-selection board earlier in June, all but 9 of them are completely implemented.


I've also added something which slipped my mind before - characters all had races, but I had forgotten to address the issue of racial types and subtypes. Ogres, Tolls and Hill Giants are different races, but they all belong to the Giant type, for example. So I went ahead and implemented that, which also allowed me to complete all of the racial feats, such as the Dwarven Defensive Training feat, and the background feats I've mentioned in earlier updates, which allow you to assign a unique bonus to each character on character creation.

Additionally, all core combat actions (e.g. Bull Rush, Fight Defensively, etc.) are now available, including ones based on class-specific feats:


This means that all melee-centric classes, like Fighter, Barbarian and Monk are essentially finished. The feat menu in particular took some effort to implement correctly. Unlike the other combat menus, it fills itself dynamically on a per-character basis, depending on what feats the given character has available. It also takes into account feats which have a fixed number of uses per day, such as Rage and Stunning Fist.


A few feats have also been renamed to more accurately reflect what they actually do: Called Shot is now Power Shot, One Shot is now True Shot and Manyshot/Greater Manyshot are now Double Shot/Improved Double Shot. I've also tweaked the behaviors of some feats to work a bit differently from their PnP counterparts: Expect Tactician works closer to the Neverwinter Nights 2 version, rather than the D&D3.5e version, while Manyshot is closer to the Pathfinder implementation.

I've also rewritten some of the targeting code to be more flexible: I noticed some inconsistencies with the earlier version due to how distances were being determined.


Now, whenever an ability has a circle-shaped (technically spherical, but we're only concerned with 2D here) effect radius, it's possible to specify to the intersection function whether tiles should have a) their center inside the circle, b) any corner inside the circle or c) all 4 corners inside the circle. This is important because even though the tile system itself purely integer-based, all of the ranges and distance calculations are still performed  in real coordinates internally, to preserve accuracy.

Another area that's had some progress was Status Effects. I improved some of the existing functionality to allow status effects to display their remaining duration along with their icons:


Effects with unlimited duration (e.g. toggled modes, like Power Attack or effects that don't wear off on their own, like Ability Damage) have their duration displayed as "∞". This now happens wherever they're displayed, be it in the status menu or above character panels in combat.


While I was in the right frame of mind to work on graphical improvements to the game, I've also added more feedback to various actions in combat by providing more information in the Combat Log:


Finally, I refactored the way classes were being stored. When I created it, I only had a very small amount of data to store and rarely had to look it up, so it was just kept in 2D arrays. With all the new class-specific behavior that I've been introducing, it became a massive pain to write a 5~10 line block of code every time I wanted to check whether a unit had levels in a given class, or what its class level was. So I rebuilt the whole thing; it's much easier to use now and most checks that used to be O(n^2) and required a several lines of code to make, now are O(n) or constant time and require only one or two lines to be written (and it's much more readable).

Finally, with the vast majority of work on Feats out of the way, I tackled the final major combat-related feature that was missing from the game: Spells!

Originally, I thought this was going to take something on the order of a month to implement because there's just so much to do. Properly implementing spells is something that touches practically every part of the game I've worked on so far: leveling, character creation, the internal actor(and enemy) structures, several menus, several parts of the database, and most of the combat system.

This is where flexible code pays off. Whenever I build a big system - the leveling system, for example - I try to make it flexible enough so I can not only maintain it easily in the future, but also make additions to it without having to rework the whole thing, or copy-paste large sections of code.

Thankfully, it seems I've done a pretty decent job at that; when I went back to some of my older code (some of it going back to about 4 or 5 months ago), it was actually fairly easy and quick to add all the spell behavior into everything - despite the fact that I figured out how exactly I wanted to implement them only recently.


So with that, I've added in all of the remaining core classes in the game, as well as most of their particular intricacies, such as differences between spontaneous and prepared casters.


There's still quite a lot of work to do, of course - even with things moving dramatically faster than I expected, it'll still probably take me another two weeks or so to have all of this properly working. But at the moment, the leveling process is working for all the available classes: you can learn spells, earn spell slots, get caster levels, increase the number of spells per day available, etc.

I've also done most of the work that was necessary in the Spells section of the main menu:


Spells can be viewed, assigned slots and removed (when applicable), as well as having correct behavior for multi-classed characters, which will have several spellbooks; it's perfectly possible to have multiple classes with different progression (e.g. a multiclassed Wizard/Cleric), classes that add progression to the same spellbook (e.g. a Bard/Virtuoso character) and classes which have different spellbooks which are drawn from the same spell list (e.g. Wizards and Sorcerers).

I still have to go back and add proper behavior for spellcasting classes during character creation (which thankfully won't be terribly hard, it's just a special case of the normal leveling process, which I've already completed), spend some time in the database adding all of the spells I plan on having for an Alpha or Demo version of the game (probably only core spells up to 10th caster level - which is still a huge number of spells), and finally add the ability to actually use spells in combat.

I'm glad Thanksgiving is coming up soon - I could use the free time to get more work done! I'm aiming to have most of the scaffolding required for the core aspects of the game done by the end of the year, so I can start working on getting an Alpha version out for people to play. I really want to start working on playable content as soon as possible. With any luck, I'll have something that actually feels like a proper game - rather than a collection of features - out by January next year.

No comments:

Post a Comment