Skip to content

User-friendly functions to simulate Dungeons & Dragons using R

License

Notifications You must be signed in to change notification settings

wj-mitchell/DnDRuf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DnDRuf v1.1

DnDRuf is a compilation of user-friendly R functions created to simulate the creation of characters, parties, and combat among those parties while playing Dungeons & Dragons 5e, or any tabletop RPG that follows a 5e system (providing you aren't too picky about the names). While still very much in its infancy, it does boast some highlights that I have yet to see in other tabletop RPG simulation projects, including:

* CombatSim

CombatSim() is my favorite function of this bunch. By entering a dataframe created by FighterSim(), or following its formatting, this function will simulate simple, melee combat between as many opposing groups of any size as you would like. The argument Side= allows users to submit a list() which denotes whether disparate groups are allies or foes. Additional options grant the user control over whether the battle is a deathmatch [Ending = "Death"], or whether the battle should last for a specified number of rounds [Ending = "Timed", nRounds = ]. Running the function will cause it to first determine initiative using InitiatSim(), and then progress into a turn-by-turn battle, much like you would at a table with your friends. Output can include either the table of all combatants stats or a text summary of the events that occurred. Text summary output can be further filtered to output: 1) just an summary of the end of the battle [PlayByPlay = "Off"], 2) just events relevant to kills and deaths["Kills"], 3) only events relevant to kills, deaths, and attacks["Attacks"], 4) all events["Everything"]. Lastly, seeding allows users to reliably generate the same simulation time and time again. While limited in its current state, its ability to handle combat between multiple parties of massive sizes makes it very valuable if you would like to drop your acting party into the middle of an ongoing battle, or simulate the outcome of an "off-screen" altercation. I also have converted it to a convenient, albeit slightly more limited, web application, which you can access here.

* PartySim

A function to create groups of combatant NPCs which grants users as much control as they desire. Simply entering PartySim() will generate a dataframe containing 1 party of 6 fighters who have uniform stats, but unique names and identities, due to its integration with CivSim(). However, users have the option to exert granular control over: 1) the number of groups to generate, 2) the number of members of each group (which can be heterogeneous; e.g., generating a party of 3 people and a party of 8 people with the line of code), 3) damage dice, 4) attack bonuses, 5) armor class, 6) ability scores, 7) tactical inventory (i.e., health potions) and more. Ability scores are generated using the traditional roll 4d6 and drop the lowest method, made possible using the rollr package designed by Felixmil. This package is also used for the damage dice as well. Default probability distributions for each of the variables ensures that even if you do not want to manually specify their value, you can be sure that the simulation will likely yield realistic stats. Additionally, seeding allows users to reliably generate the same simulation time and time again. While limited relative to the overwhelming complexity of most playable characters that you might generate, PartySim() is a great tool to create small militias or massive armies that your acting party might encounter.

* CivSim

A basic function to create noncombatant NPCs. By simply entering the number of characters desired (nPeople = ), R will output a dataframe of rows equivalent to nPeople in length, with each row containing a unique combination of a name, gender, culture of origin, and familial occupational history, with first names influenced by gender and culture, and last names influenced by familial occupational history. All naming data had been conveniently sourced from this post by u/OrkishBlade on Reddit. Generated genders include 'male', 'female', and 'nonbinary', with default probabilities roughly reflecting those of the general public. Users may take advantage of optional arguments to control the probability of generating characters of any given gender, culture, or familial history to better suit specific campaigns or settings.

* InitiatSim

A function to effortlessly determine the order of initiative for parties of any size. In traditional D&D fashion, DEX modifiers are taken into account and will break ties, should two players have the same initiative rolls. Users should enter a dataframe containing at least two columns, one containing the names of characters engaging in combat, and the other containing each character's respective DEX modifier. However, InitiatiSim() will automatically calculate DEX modifiers, should a user feed it raw DEX scores instead. Additionally, if no DEX information is present, InitiatSim() will automatically generate DEX scores at random and calculate modifiers and initiatives.

About

User-friendly functions to simulate Dungeons & Dragons using R

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages