Your SlideShare is downloading. ×
Drupal & Dungeons & Dragons
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Drupal & Dungeons & Dragons

3,293
views

Published on

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, …

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.


0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,293
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
7
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • Good afternoon, and welcome to Drupal & Dungeons & Dragons I’ll be your dungeon master…
  • So why are we going to be talking about Dungeons & Dragons at a Drupal Camp? Write this down for your bosses: “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.”
  • What do they have in common? Where do they intersect? Playing and managing a D&D game, like many other real-world business needs, can be a complex and time-consuming experience. Whether it’s PC sheets, or contract records, or product or sales information…All of these things have unique challenges to managing workflows and how their data is stored.
  • Managing lots of PCs with paper can get daunting. A character sheet is complex and takes a long time to fill out by hand Each piece of data (like a weapon or a spell) has complex sub-units of data – compound data Finally, there wasn’t anything on drupal.org for D7 to manage D&D Characters… So I scratched my own itch
  • When I first created the D&D Character module, Drupal 7 had just been released (January 5). I had been using the Features module on new projects already I *REALLY* wanted to know how the Fields API worked
  • When learning a new language, a few typical milestones… Hello World Start messing with user submitted data (CLI, use STDIN; for PHP, mess with the $_GET superglobal variable) Connect to a database, run queries, etc Eventually comes to creating a D&D character generator
  • …and so the D&D Character module was born. A suite that includes: D&D Character D&D Fields D&D Character Sheet
  • So let’s talk about data management in D&D…
  • So let’s look at the problem we need to solve.
  • The node is the go-to data bundle* in Drupal. But does it do enough of what we need for PCs? What can we do with standard fields? Race changes certain attributes. Can be multi-class Attributes – do you manage those as individual fields or a single field with 6 multiple values? Weapons alone have many characteristics to field
  • We can accept multiple values for a single fields, which is useful. This is one-dimensional
  • Does everyone know what I mean by vertical vs horizontal data depth? Longsword, short sword, gauntlet, mace Longsword +1, short sword +2 vs goblins, regular gauntlet with no powers, MACE OF TERROR! Mace of Terror == Cone of Fear for 60 feet
  • Remember when I was talking about learning a new language or API with D&D as a common reference point? Learned Fields API to build a series of compound fields in a single night
  • To store complex, horizontal data, you need compound fields. Sure, the modifier can be derived – ability score divided by 2 (rounded down) minus 5 is the modifier Modifier is an input value and not a derived value in case you want to play Heroic campaign rules.
  • Fields API has field info, schemas, widgets, and formatters Widgets are the form input – HTML fields Formatters are the output – the templated output of the data
  • 3 steps: Define your Info, Widget, and Formatter This LOOKS like a lot of hooks to learn, but most of them are actually really simple to use.
  • Hook_field_info tells Drupal about the field. It’s nothing more than a simple array with some meta data. Real simple.
  • What am I talking about when I say “Field Widget” This is simply a standard Forms API definition of a form to capture data for your user’s data Arrow-Up 4 times to go back to the Ability page
  • What am I talking about when I say “Field Formatter” This is a rendered form of the field data In this case, theme_table is what we use to display the data. Every field is a new table row.
  • Even then, field formatters might not be enough. What if you need to generate printer-friendly output?
  • Output of your complex data is key to good data management In the case of D&D, table-top role-playing uses pencil and paper record keeping There are good iPad apps for characters, but nothing beats paper. NOTHING. 3 rd module in the D&D Character module suite.
  • It’s one thing (and an important thing) to capture PC data in a filedable way It’s just as important to be able to print a PC record in a way that makes sense on paper
  • In Drupal, there’s really not much that will generate character sheets Print module and maybe some others will produce PDFs, but these don’t print to exact data record specifications Whether it’s a PC sheet, a product spec sheet, or a tax record, we need something very specific.
  • In this code sample, we set up page information: The paper size and dimensions Which page in the PDF this is Accepts the node object as an argument
  • PDF programming for a specific sheet can get complicated as a theme Printing the node data is pretty easy though This code prints the boxes that displays the PC wealth boxes
  • Node data in a PDF – what does that look like? Each box in the sheet comes from fields in the node
  • One last thing Drupal is great for D&D… Manage your campaign in Drupal Campaign history, pantheon of gods, Pages for NPCs the players have met, Blog posts of past runs for recapping the story thus far…
  • Drupal is a CMS. A Campaign Management System.
  • With the D&D Character module, and blog posts of previous runs, players can update their data, see what they’ve done, even look for clues.
  • Visit the Agile Approach blog for a good intro to building custom fields using Field API D&D Character module with these submodules API.drupal.org has helpful information – search for field_example module hooks
  • Transcript

    • 1. Solving Real-World Data Management Problems
    • 2.
      • Tobby Hagler
      • Senior Developer
    • 3. What does Dungeons & Dragons have to do with Drupal?
    • 4. Drupal & D&D
      • Real-world data complexity issues
      • Difficult workflows to manage and codify
      • Contrib modules – scratch your own itch
    • 5. 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…
    • 6. D&D Character and Learning Drupal 7
      • Learning something new with a familiar subject
      • Solving a “real” need
      • Features module and Fields API
    • 7. Learn a new language
      • “ Hello World”
      • Manipulate user input
      • Display and manipulate input
      • D&D character generator
    • 8.  
    • 9. D&D Data Management
      • 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
    • 10. Data Management Problems to Solve
      • Lots of fields
      • Managing fields
      • Compound Fields
      • Data Output
      • Printable Output
    • 11. Nodes and Standard 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
    • 12. Standard Fields Aren't Enough
      • Regardless of the data type
      • Fields are always name:value pairs
      • Fields can contain multiple values
      • But not multiple keys
    • 13. Multiple Values
    • 14. Multiple Values
      • Vertical
      • but not
      • Horizontal
      • data depth
    • 15. D&D Fields
      • Companion module to D&D Character
      • Drupal 7 Fields API
    • 16. Abilities
      • Multiple values
      • not enough
      • Names of each
      • ability score
      • Multi-dimensional or compound values
    • 17. Compound Fields
      • Each field can have different widgets
      • Custom fields for different data types
    • 18. Fields API in 3 Easy Steps
      • Tell Drupal about the field and schema
      • hook_field_info
      • hook_field_schema
      • hook_field_validate
      • hook_field_is_empty
      • User Input
      • hook_field_widget_info
      • hook_field_widget_form
      • Output
      • hook_field_formatter_info
      • hook_field_formatter_view
    • 19.  
    • 20. Field Widgets Armor widget is both horizontal and vertical
    • 21. Field Formatters
    • 22. Field Formaters May Not Be Enough
      • Node templates can work
      • Fine for on-screen display
      • Printing forms for records
      • HTML and CSS don’t make great printouts
    • 23. D&D Character Sheet
      • What web output works for print?
      • PDF is the universal
      • online print document
    • 24. PC Record Sheets Storing data is one thing Printable character record sheets is key
    • 25. Drupal and PDF Output
      • Node templates generate HTML
      • Can be styled with CSS and HTML
      • Print module is closest
      • Doesn’t come nearly close enough
    • 26.  
    • 27.  
    • 28. Node Data In PDF
    • 29. Drupal as a Campaign Manager
    • 30. 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
    • 31.  
    • 32. Summary
      • Fields API for building compound fields
      • PDF for specific records
      • Drupal as a CMS manages extra data
    • 33. Resources
      • agileapproach.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
    • 34. Questions?
    • 35. Contact
      • thagler@phase2technology 
      • @phase2tech
      • d.o: tobby
      • Slides: AgileApproach.com

    ×