drupal & dungeons & dragons
DESCRIPTION
This session was an exploration of complex real-world data management issues, and ways to solve them, using D&D as a point of reference for discussion. The presentation was given by Tobby Hagler, Senior Developer at Phase2 Technology at DrupalCamp Atlanta.TRANSCRIPT
Solving Real-World Data Management
Problems
Tobby HaglerSenior Developer
What doesDungeons &
Dragons have to do with Drupal?
Drupal & D&DReal-world data complexity issues
Difficult workflows to manage and codify
Contrib modules – scratch your own itch
D&D Character Module
Complicated forms and character management
Levels, classes, races, feats, skills, weapons, and equipiment – All have unique
properties
No D7 D&D Character sheet module…
D&D Characterand Learning Drupal 7Learning something new with a familiar subject
Solving a “real” need
Features module and Fields API
Learn a new language
“Hello World”
Manipulate user inputDisplay and manipulate input
D&D character generator
D&D DataManagement
PC Information•Race: Special abilities, bonuses and penalties, feats•Class: Extra skills and feats, spells, or limitations•Skills: Cross-class, ranks•Feats: Prerequisites, bonus feats•Attributes: Saves, Initiative, base attack, misc. bonuses
Other Details•Spells: Components, spellcraft feats•Equipment: special attributes, magical abilities, masterwork•Animal Companions: HD, spell-like abilities, morale•NPCs: Abilities, backstory•Campaign Notes: History, geography
Data ManagementProblems to
SolveLots of fieldsManaging fields
Compound Fields
Data OutputPrintable Output
Nodes andStandard Fields
Standard Fields•Name: string•Race: string•Class: string•Attributes: integer, bonuses?•Skills: integer, strings•Feats: string, checkboxes•Weapons: ??
Bonuses and Attributes•Name: fine•Race: fine, but affects things like attribute values•Class: different levels for multiclass•Skills: class vs cross-class (half)•Feats: manage prerequisites•Weapons: damage, speed, crit range – compound fields
Standard FieldsAren't EnoughRegardless of the data type
Fields are always name:value pairs
Fields can contain multiple valuesBut not multiple keys
Multiple Values
Multiple
ValuesVerticalbut not
Horizontaldata depth
D&D FieldsCompanion module to D&D Character
Drupal 7 Fields API
Abilities
Multiple valuesnot enough
Names of eachability score
Multi-dimensional or compound values
Compound
FieldsEach field can have different
widgets
Custom fields for different data types
Fields API in3 Easy Steps
Tell Drupal about the field and schemahook_field_infohook_field_schemahook_field_validatehook_field_is_empty
User Inputhook_field_widget_infohook_field_widget_form
Outputhook_field_formatter_infohook_field_formatter_view
Field Widgets
Armor widget is bothhorizontal and vertical
Field Formatters
Field FormatersMay Not Be Enough
Node templates can workFine for on-screen display
Printing forms for recordsHTML and CSS don’t make great
printouts
D&D Character Sheet
What web output works for print?
PDF is the universalonline print document
PC Record Sheets
Storing data is one thingPrintable character record
sheets is key
Drupal andPDF Output
Node templates generate HTML
Can be styled with CSS and HTML
Print module is closestDoesn’t come nearly close enough
Node Data In PDF
Drupal as a Campaign Manager
CMS: Campaign Management System
Blog Pages for previous runs
Standard Pages for NPCs or historical background
Custom content types for artifacts, animal companions, and kingdoms
SummaryFields API for building compound fields
PDF for specific records
Drupal as a CMS manages extra data
Resourcesagileapproach.com/blog-entry/compound-fields-
drupal-7
drupal.org/project/dnd_character
api.drupal.org/api/examples/field_example--field_example.module/function/
field_example_field_info/7
Questions?
Contactthagler@phase2technology
@phase2tech
d.o: tobby
Slides: AgileApproach.com