Sunday, May 15, 2011

Triumph of the heart

So Blogger was down for a day or two this week, which sucks because I really wanted to talk about the progress I've made with Manticore. Thanks to a ton of friendly advice from more experienced coders (UnixMonkey, jqr and a ton of guys on Stack Overflow) I finally fixed the problems I was having with the has_one relationship.

For people who are just tuning in, Manticore is the Dungeons and Dragons character database application I'm working on. I had created a Character and a Statistic model, where Character has_one Statistic and Statistic belongs_to Character. However, I had some issues with displaying the Statistic model on the Character page, and also ensuring there was only one instance of Statistic in use at any given time. But no more!

I was able to take the code David (UnixMonkey) showed me on github and extrapolate that to create new models that belong_to the Character model with a has_one relationship.

So far, I've got a working Character model, with models for character statistics, saving throws, armor class, hit points and speed. I'm beginning to see how I want all this information displayed. Eventually I want it to be a page with 5 tabs: Character, Equipment, Skills and Feats, Spells and Background. I see the Character tab as being a quick sheet with all the relevant information for playing a game, and the other tabs having more detailed information.

I'm also thinking about other things I can do with this app. For example, Armor Class is composed of several different numbers: values for armor worn, a shield, a character's dexterity modifier and more. So it would be pretty easy to ensure the total AC value is equal to all of the separate values and display an error message if this is not true.

I mentioned that I see the Character tab as being a quick page with combat information at the ready. Eventually, I'd like this page to contain some tools to make playing a game easy from that view: stand alone dice rollers and specialized dice rollers that a player can create and save. For example, your character has a short sword and you want to save an attack roll with the short sword. So this would create a button that generates a random number from 1 to 20 (the attack roll) then adds in any relevant modifiers (attack bonuses, weapon enhancements, etc) and spits out a total number.

I've also been thinking about tools specifically for Dungeon Masters. Things like a database of plot hooks to generate ideas for campaigns or short adventures, an NPC personality and description generator and so on.

A lot of Rubyists go on and on about how Ruby on Rails makes programming fun. While I'm beginning to see why that's true (since you spend most of your time building things and not trying to get the tools you need to build things to work) I really think it really opens you up to what's possible. Now that I've got some ideas of HOW to build things, I'm getting lots of inspiration for things TO build.

No comments:

Post a Comment