🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Reminder of Optional Elements

Started by
-1 comments, last by JWalsh 16 years, 10 months ago
Hail All, I just wanted to remind people that a large part of project 2 is OPTIONAL. I know I've said that before but I wanted to re-iterate it. And to make it easier. Here are suggested types for the fields that are required, and those that are optional. REQUIRED
Name   : String
Class  : Enum { Barbarian, Bard, Cleric, Druid, Fighter, Monk, Paladin, Ranger, Rogue, Sorcerer, Wizard }
Level  : ubyte [1-20]
Race   : Enum { Human, Dwarf, Elf, Gnome, Half-Elf, Half-Orc, Halfling }
Gender : Enum { Male, Female }

Size   : Enum { Small, Medium }
Age    : ushort

Height : Struct { Feet : ubyte, Inches : ubyte }
Weight : float 
Eyes   : Enum { Brown, Hazel, Amber, Green, Blue, Gray }
Hair   : Enum { Brown, Mahogany, Chocolate, Cinnamon, 
Chestnut, Black, Raven, Ebony, Charcoal, Blonde, 
Honey, Golden, Strawberry, Platinum, Red, Auburn, 
Russet, Scarlet, White, Gray, Silver }

Ability Scores + Modifiers
---------------
Strength     : ubyte [1-255]
Dexterity    : ubyte [1-255]
Constituion  : ubyte [1-255]
Intelligence : ubyte [1-255]
Wisdom       : ubyte [1-255]
Charisma     : ubyte [1-255]

Max_Hitpoints     : short [-10+)
Current_Hitpoints : short [-10+)

Money : Struct { Copper : uint, Silver : uint, Gold : uint, Platinum : uint}

Saving Throws
----------------
Fortitude : ubyte
Reflex    : ubyte
Will      : ubyte
OPTIONAL BUT ENCOURAGED
ArmorClass        : ubyte

Base Attack Bonus : ubyte
Attacks : ubyte

Equipment : Item[]
Skills    : Skill[]
HIGHLY OPTIONAL
Feats     : String[]
Spells    : String[]
Abilities : String[]
EXTREMELY OPTIONAL
Feats     : Feat[]
Spells    : Spell[]
Abilities : Ability[]
As with all things in programming, this isn't necessarily THE way to implement the fields, but is A way. Regarding class and race, I've listed them as Enum above, to indicate what type of class and race the player is, however if you follow this approach, you will likely want static classes to act as helpers as well. These static classes would be used primarily to contain the valid ranges for random fields, and to keep the modifiers, etc... So when you assign the class, you use the static class to fill in the fields, and leave the enum to identify what type of class it is. The best way to implement all of the modifiers, etc...is just as it is shown in the SRD, or perhaps as an ArrayList for more flexibility. For as easy example, ArmorClass is your AC rating, it is always at least 10 for humans, but then increases based on your dexterity modifier, and your armor. So you could perhaps put something like this: ubyte ArmorClass { get { return 10 + DexterityMod + ArmorBonus; } } You'll notice that the value for Armor is computed each time it is requested, and not stored as a field. This means that as soon as your dexterity modifier or armor rating changing, your total ArmorClass changes. You could fill it out even more for other things, such as ShieldBonus, SizeModifier, or any increase due to spells. This might look like:

ubyte ArmorClass
{
    get
    {
        ubyte armorClass = 10 + ArmorBonus + ShieldBonus + SizeBonus + MiscBonus;               
    }
}

And if you wanted to, you could take into account being "flatfooted" (no dexterity modifier), or even being "touched" by a spell (no armor bonus, but still size and dexterity). Good Luck!
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints

This topic is closed to new replies.

Advertisement