Wednesday 11 June 2008

A database, a database, my select * from Kingdom for a database


Databases make me all tingly, in a nice way.

Finally started using SQLite in the main game. There's now an attribute database as a kind of test for the concept, covering skills and inherent attributes. The nice thing about this so far is that it's very easy to modify at runtime, as I have a debug console command that allows for arbitrary query execution.

My current thinking is that attributes will be very simple. An attribute has a name, any number of parent attributes, and some information about whether untrained (score = 0) usage of the attribute makes sense.

My test DB has a grand total of 7 attributes for testing. These aren't sensible or final in any way, shape or form, obviously. I'd need to design things for that to be the case, and I'm allergic.

Anyway, the core test abilities are strength, dexterity, agility, plus melee, ranged base skills. All these are used untrained with no penalty, and have no parent attributes.

spear_ranged and spear_melee are more complex. They have a small penalty to untrained usage, and have as parents ranged, dexterity and melee, strength, agility respectively. Finally, there's the atlatl skill, which has a very large untrained penalty, and has spear_ranged as a parent.

So a skill check is currently absurdly simple. You provide the name of the attribute, and the DB interface turns it into a list of that attribute plus any parents. 'Character sheets' are just basic String => Int tables, so for every attribute in the list its value is looked up in the character sheet. Any missing or zero entries are considered untrained, and so may have penalties or result in automatic failure. All the scores are summed to give a final attribute total, which then goes on to the Core Mechanic for resolution.

I'm not sure this is actually going to work for a full-scale system, though. I'd originally envisaged something more complex, where various attributes contribute in a weighted fashion, skills had a more fully developed hierarchy and objects could have unique attribute requirements.

Thing is, I really like the simplicity of the current system. It means you can examine a prismatic obsidian blade in your inventory and instantly know which attributes and skills will affect your efficiency with it, and by how much, because everything is handled in the same way.

Likewise distributing experience in a 'doing stuff increases attributes used' system is simple; just split the XP earned evenly among all attributes in the list. This has the pleasant inherent property that 'deep' skills will be harder to train and will increase 'core' skills more slowly.

Downsides... unique items that interact with attributes in fun ways are harder to implement. An artifact blade that uses the wielder's intelligence, for example, just doesn't fit. Perhaps more importantly, deeper skills automatically have larger scores. This could be fixed by simply using the mean rather than basic sum of all attributes I guess, without compromising the transparency too much, or by taking great care when constructing the skills themselves. More thought needed here, as with pretty much every aspect of the game so far...

No comments: