DUNGEONS & DRAGONS As a Drupal project Hacking and slashing our way through real-world content management problems
Exploring New Technology With Familiar Problems • C/C++ • JavaScript and jQuery • Perl • Drupal 6, 7, 8, Field API, etc. • PHP LEARNING
BEFORE WE BEGIN
Determine What To Build • Determine the scope • Character sheet as a wireframe • Scores and Data Values •Content and computational models •Content entry •Access control for data modification • Player Characters belong to players (users) • Content entry order
D&D CHARACTER Character stats display - Pull up your character on desktop or tablet for quick IN A NUTSHELL reference Character record sheet - Print out your character record sheet for use at the table Output (put the computers away!)
D&D CHARACTER Character sheet entry - Direct entering of fields IN A NUTSHELL Character generator/wizard - Follow a series of conditional steps Input Some data needs to be entered before other
1. Character background and motivation 2. Select race ORDER OF 3. Class and levels 4. Enter (roll or purchase) ability scores DATA ENTRY 5. Pick a background 6. Update racial characteristics 7. Update class details Option 1: Node Edit Form 8. Purchase equipment 9. Choose skills 10. Select alignment and finalize details
Step 1 ORDER OF • Roll the dice: Best 3 of 4d6 or point buy • Assign rolls to abilities DATA ENTRY • Choose a race • Pick gender, background, and other role- playing traits that would influence who Option 2: Webform this character is • What is the total level? • Alignment, limited by class
Step 2 ORDER OF • Pick class or classes by level • Class restrictions or limitations based on DATA ENTRY ability scores and race Step 3 Option 2: Webform • Update high-level attributes • Additional ability scores • Add new skills and feats
Step 4 Add class-specific abilities ORDER OF • Spells, familiars, meta-magic, and patrons • Weapon proficiencies and fighting styles DATA ENTRY • Turning undead and healing • Wild shape, favored enemies, and animal companions Option 2: Webform Step 5 Assign skills and knowledge areas Languages
Step 6 Roll hit points based on hit die, Constitution ORDER OF bonus, and level(s) DATA ENTRY Step 7 Option 2: Webform Determine money and purchase equipment Some equipment will be unavailable Appearance, description and all the other details Name your new character!
CONTENT AND COMPUTATIONAL MODELS
Character Stats The basics of a character’s statistics • Race are, at the heart, just a collection of • Class and Level raw data and field values. • Ability Scores Users select what they want from a • Alignment finite list, but the combination of these values creates a fundamentally • Equipment, Weapons, and Armor unique character that should be • Description and Backstory memorable and fun to play.
Character Stats • Racial Modifiers and Traits Content is more than just fields, and a Character is more than just data • Class Skills and Hit Die points. • Ability Modifiers, Skills, and Saving Determine your relational model and Throws you will see how values affect each • Limits Class other . Race affects abilities. Class determines skills and other attributes. • AC, THAC0, Damage, and other effects Even background and character description ultimately affect choices • Affects how the DM creates story surrounding equipment, which hooks, adventure ideas, and how impacts AC, etc… NPCs react to your character
AT FIRST GLANCE •A D&D Character is a standard node Analyzing The •A custom content type, “D&D Character” D&D Character •Ability Scores are an array of small integers •Range limited to 3-18 Content Model •Hit Points, Hit Die, and Armor Class are just integers •Class, Race, and Alignment are text values from a select list
A DEEPER DIVE INTO THE UNDERDARK •Abilities provide bonuses and are computed. Analyzing The •Class and Level changes Hit Die, Potions and curses alter D&D Character Hit Points, and spells and armor enhance Armor Class. Content Model •Each Race or Class can affect other PC attributes in a variety of ways, such as Ability score bonus/penalty and additional skills or spells. •A node seems fine, but we need a way to handle overrides; Node plugin?
Atomic Design and Data Models 1. Atoms 4. Templates 2. Molecules 5. Pages 3. Organism DATA DESIGN
FIELDS, ENTITIES, AND RELATIONSHIPS
Polymorphing Fields Compound Fields • Many fields on a PC node would have compound values Like a recipe has ingredients, and each ingredient has sub-values: name, • Race is a string from a list quantity, description, metric or • Ability is 6 values, each with imperial measurements. modifiers and bonuses Addresses have a number, street, • Feats and Skills have names, secondary street, city, state or descriptions, game details… province, ZIP or postal code, and • For your project, Drupal core fields country; which determines if other won’t cut it, and there’s no contrib sub-values may be present or project… changed .
Ability Scores Ability bonuses are easy to calculate, Ability Scores no need to have a lookup table: • Strength Bonus = floor( (BaseScore / 2) - 5) ) • Dexterity • Constitution • 3 (-4) • Intelligence • 4-5 (-3) • Wisdom • 6-7 (-2) • Charisma • 8-9 (-1) • 10-11 (no bonus) Base score modified by race, higher • 12-13 (+1) level, and temporary effects. • 14-15 (+2) Include an ability bonus for • 16-17 (+3) exceptionally high or low scores. • 18 (+4)
More Compound Fields Class Skills • Level (of each class) • Name • Leveling up is based on effective • Ranks level • Class skill • Ability modifier • Description
More Compound Fields Feat Feat Effects include: • Name • Ability score bonus • Description • Initiative • Effects • Advantages to a variety of rolls • Proficiencies with equipment (think: permissions) • Other in-game modifiers that don’t affect the content here
DIFFERENT SOLUTIONS TO THE SAME PROBLEM Paragraphs Compound A contrib module that lets us combine mixed field types into a single field. We can place a paragraph as a single Fields field on a content type. Webform Create a complex form in a UI. The form can be single-page or a multi-step form. We can create custom submit methods to handle the user form submission. Exports to YAML. Field API Create custom fields and field widgets.
INPUT OPTIONS
Compound Ability Scores • Choose a race • Feats and other skills • Base score • Level bonus • Race bonus/penalty • Total score and modifier PARAGRAPHS
Conditional Multi-Step Forms • Create a page for each step • Conditionally show/hide fields based on previous • Nest elements within each selections page WEBFORM
Creating Custom Field Types • Create a field type • Create a custom field widget • Create a field formatter FIELD API
EXAMPLES OF COMPUTATIONAL MODEL
Skills, Spells, And Equipment Money and Background Class features • Roll wealth based on class • Different types of spells • Choosing backgrounds may change • Skill ranks and class and cross-class starting wealth and initial skills skills Calculating Armor Class Racial bonuses • Armor and magic items • Change ability scores • Ability modifiers • Additional skills, language, or traits • Spell effects
Conditions May Apply Conditional content entry for each How much to program, how much to class or race rely on editorial input? • Node edit form validation/ submission tricks • Webform wizards and Conditional Required fields for some classes but Logic not others
PULLING IT ALL TOGETHER
VIEWING A NODE PAGE Node template for Character Node Output • node—dnd-character.html.twig CSS added as a library • D&D_character.dnd_character_fields • dnd_character.dnd_character_node
PRINTING A D&D CHARACTER RECORD SHEET Modules (many in early development) Printable • Entity Print • Uses WKHTMLtoPDF Character • FillPDF Sheets • Can use an existing fillable PDF • Printable and PDF generator API Other options • WK HTML to PDF library and custom code
D&D Character content type FINAL Collection of Paragraph fields PROJECT Some custom UI work Printable character sheets (PDF)
QUESTIONS? IDEAS?
Recommend
More recommend