Skip to content

Twitter bot that creates ready-to-play D&D character sheets

Notifications You must be signed in to change notification settings

TyTyDavis/CharacterSheetBot

Repository files navigation

Character generation

Names:

Names are generated using this name generator, with some tweaks made to the name list, and more tweaks to come.

There is a random chance that a character might receive a silly name, in which case last names will be pulled from a list of silly last names, and first names will be pulled from a list of more common American names, sourced from the Social Security Administration. Silly characters also have class and race chosen without consideration of relevant ability scores. At this point, pronouns are chosen for the character, to be used by Tracery later.

Stats:

All data is stored in the Character class, which has functions to set all relevant stats (ability scores, race, class, skills, etc.) Data for races, classes, weapons and armors are astored as Python classes.

First, a character's six main ability scores are rolled randomly. Next, the character's class is decided. Based on the character's highest ability score, a different short list of classes is used. For example, a character with high strength could be a Barbarian, Fighter or Paladin. It is at this point that a die is rolled to determine if the character will be "silly," meaning it receives a funnier name, and it's race and class aren't chosen to optimize the character's playability.

Next, the character's race (elf, human, dwarf, etc.) is chosen from a weighted list of races that are a good fit for the character's class.

After all of that, the character's skills, equipment and spells (if applicable) are chosen.

Flavor text:

The personality trait, ideal, bond and flaw are generated using pytracery, a Python version of Kate Compton's Tracery language.

Each character class and background have their own unique Tracery elements to create flavor text that is suited to the character, although there are also more generic elements that can be applied to any character. Tracery works like a Madlib, allowing pronouns and other words to be inserted into sentences. In the following example, can extend the possibilities of the flavor text by pulling from lists of places and skills that might be important to our character, all of which can be tailored to fit the character's class, race or background.

    
    'One day, #they# will return to #their# home #place# to show everyone how great of a #trade# #they# #is#.'
    
   

Character sheet printing

Once the relevant stats are generated, Python Image Library (PIL) is used to print the stats onto a .png of a character sheet. Each area of the character sheet is handled by its own function.

Most of these functions take a Character Object as a parameter, so they could used in a program that would allow someone to create a character to their own specifications and print it to a character sheet image.

Implementation

The bot's main Python script generates one character, prints it onto a sheet, and then, using python-twitter to access the Twitter API, sends a tweet.

The bot is kept on a Raspbery Pi which runs this script once every hour using crontab.

To do

  • Create new name lists
  • Automate cleric domains and other class feature choices
  • Add unique Tracery lists to races, weapons, and armor
  • Allow for characters with shield
  • Allow for characters past level 1

About

Twitter bot that creates ready-to-play D&D character sheets

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages