DnDGen.CreatureGen 2.0.0

dotnet add package DnDGen.CreatureGen --version 2.0.0
                    
NuGet\Install-Package DnDGen.CreatureGen -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DnDGen.CreatureGen" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DnDGen.CreatureGen" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="DnDGen.CreatureGen" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DnDGen.CreatureGen --version 2.0.0
                    
#r "nuget: DnDGen.CreatureGen, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DnDGen.CreatureGen@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DnDGen.CreatureGen&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=DnDGen.CreatureGen&version=2.0.0
                    
Install as a Cake Tool

CreatureGen

Generates a random, fleshed-out creature for Dungeons and Dragons 3.5

Build Status

Installing CreatureGen

The project is on NuGet. It targets .NET 10.

dotnet add package DnDGen.CreatureGen

Getting the Generators

You can obtain generators from the IoC namespace within the domain project. Because the generators are very complex and are decorated in various ways, there is not a (recommended) way to build these generators manually. Please use the Module Loader in the IoC namespace. Note: This will also load dependencies of CreatureGen, including RollGen, Infrastructure, and TreasureGen.

var kernel = new StandardKernel();
var creatureGenModuleLoader = new CreatureGenModuleLoader();

creatureGenModuleLoader.LoadModules(kernel);

var creatureGenerator = kernel.Get<ICreatureGenerator>();
var creatureVerifier = kernel.Get<ICreatureVerifier>();

Your particular syntax for how the Ninject injection should work will depend on your project (class library, web site, etc.)

Use

Generating a specific creature

var ogre = creatureGenerator.Generate(false, CreatureConstants.Ogre);
var zombieOgre = creatureGenerator.Generate(false, CreatureConstants.Ogre, null, CreatureConstants.Templates.Zombie);
var humanCharacter = await creatureGenerator.GenerateAsync(true, CreatureConstants.Human);

The first argument, asCharacter, says whether the creature is generated as a character (a playable race that will take class levels) or as a monster. Only creatures that can be characters may be generated as characters. For example, a 1-Hit-Die humanoid such as a Human has its racial Hit Die replaced by class levels when generated as a character.

Chaining templates

Templates are passed as the last arguments, and are applied in the order given. Each template must be compatible with the creature as it is after the templates before it have been applied.

var halfDragonHalfFiend = creatureGenerator.Generate(
    false,
    CreatureConstants.Human,
    null,
    CreatureConstants.Templates.HalfDragon_Black,
    CreatureConstants.Templates.HalfFiend);

Ability scores

When no AbilityRandomizer is passed in, abilities are rolled with the default roll (1d2+9, or 10-11) with no other modifications.

var abilityRandomizer = new AbilityRandomizer(AbilityConstants.RandomizerRolls.BestOfFour);
abilityRandomizer.PriorityAbility = AbilityConstants.Intelligence;

var elfLich = creatureGenerator.Generate(true, CreatureConstants.Elf_High, abilityRandomizer, CreatureConstants.Templates.Lich);

//INFO: Set rolls are used as-is instead of rolling
var setRandomizer = new AbilityRandomizer();
setRandomizer.SetRolls[AbilityConstants.Strength] = 18;
setRandomizer.SetRolls[AbilityConstants.Charisma] = 8;

var strongDwarf = creatureGenerator.Generate(true, CreatureConstants.Dwarf_Hill, setRandomizer);

The available rolls are in AbilityConstants.RandomizerRolls:

Roll Dice Range
Poor 3d3 3-9
Default 1d2+9 10-11
Average 3d2+7 10-13
Good 3d2+10 13-16
Heroic 3d2+12 15-18
BestOfFour 4d6, keep the highest 3 3-18
OnesAsSixes 3d6, with 1s counted as 6s 6-18
Raw 3d6 3-18
Wild 2d10 2-20

Some templates require a minimum ability score: a Ghost needs Charisma 6, and a Half-Celestial or Half-Fiend needs Intelligence 4. When you generate one of these, any rolled score that would fall short is raised to meet the minimum. If the randomizer can never reach the minimum (for example, a set roll that is too low), the creature is not compatible and an InvalidCreatureException is thrown.

Random creatures

var (creatureName, templates) = creatureGenerator.GenerateRandomName(false);
var randomCreature = creatureGenerator.GenerateRandom(false);
var randomCharacter = await creatureGenerator.GenerateRandomAsync(true);

//INFO: A random creature with the given template(s)
var randomGhost = creatureGenerator.GenerateRandom(false, null, null, CreatureConstants.Templates.Ghost);

//INFO: Pass the None template to only get creatures without a template
var randomNonTemplated = creatureGenerator.GenerateRandom(false, null, null, CreatureConstants.Templates.None);

When no templates are passed in, the random creature may or may not have a template, weighted heavily in favor of creatures without a template.

Filters

Filters narrow down which random creatures are valid. They are checked against the creature after all of its templates are applied.

  • A creature satisfies a filter if it matches any of the values in that filter's list.
  • A creature must satisfy every filter that has values.
  • Null and empty filters are ignored, so new Filters() allows anything.
var filters = new Filters
{
    Types = [CreatureConstants.Types.Humanoid],
    ChallengeRatings = [ChallengeRatingConstants.CR3, ChallengeRatingConstants.CR4],
    Alignments = [AlignmentConstants.NeutralEvil, AlignmentConstants.ChaoticEvil],
};

var randomNameWithFilters = creatureGenerator.GenerateRandomName(false, filters);
var randomWithFilters = creatureGenerator.GenerateRandom(false, null, filters);
var randomHalfFiend = await creatureGenerator.GenerateRandomAsync(false, abilityRandomizer, filters, CreatureConstants.Templates.HalfFiend);

Types matches both creature types and subtypes, such as CreatureConstants.Types.Subtypes.Reptilian. Creatures generated with a challenge rating filter are never advanced, so their challenge rating stays predictable.

Checking compatibility

If the creature, templates, ability randomizer, and filters can't produce a valid creature, the generator throws an InvalidCreatureException. To check ahead of time, use the ICreatureVerifier:

var canBeGhost = creatureVerifier.VerifyCompatibility(false, CreatureConstants.Ogre, null, null, CreatureConstants.Templates.Ghost);
var anyValidCreature = creatureVerifier.VerifyCompatibility(false, null, abilityRandomizer, filters);

When no templates are given, VerifyCompatibility returns true if any template (or no template) gives a valid creature. Include CreatureConstants.Templates.None to only check creatures without a template.

Upgrading from 1.x

Version 2.0.0 has breaking changes to the public API:

  • Targets .NET 10. Version 1.x targeted .NET 8, which reaches end of support on November 10, 2026.
  • Templates moved out of Filters. Pass templates as the trailing params string[] templates argument of GenerateRandomName, GenerateRandom, and GenerateRandomAsync instead of Filters.Templates.
  • Filters are now lists. Filters.Type, Filters.ChallengeRating, and Filters.Alignment are replaced by Filters.Types, Filters.ChallengeRatings, and Filters.Alignments. A creature matches if it matches any value in a list.
  • Filters.GetDescription(bool asCharacter) is now Filters.GetDescription().
  • AbilityRandomizer.Roll is set through the constructor, for example new AbilityRandomizer(AbilityConstants.RandomizerRolls.Good). The parameterless constructor still uses the default roll.
  • ICreatureVerifier.VerifyCompatibility now takes the ability randomizer and the templates: VerifyCompatibility(asCharacter, creature, abilityRandomizer, filters, templates).
  • InvalidCreatureException constructors now take Filters, an AbilityRandomizer, and templates, and the message includes all of them.
  • CreaturePrototype is now internal.
  • New challenge ratings ChallengeRatingConstants.CR28, CR29, and CR30.
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 50 10/20/2026
1.0.9 220 5/11/2026
1.0.8 157 2/26/2026
1.0.6 147 2/23/2026
1.0.5 163 1/21/2026
1.0.4 270 10/2/2025
1.0.3 290 8/13/2025
1.0.2 219 7/12/2025
1.0.1 255 2/26/2025
1.0.0 238 1/22/2025
0.3.0 400 12/15/2023
0.2.0 644 2/15/2021
0.1.0 615 2/9/2021

2.0.0 contains breaking changes. See "Upgrading from 1.x" in the README.
- Targets .NET 10 (previously .NET 8)
- Templates are passed as trailing params arguments instead of through Filters.Templates
- Filters.Type, ChallengeRating, and Alignment are now the lists Types, ChallengeRatings, and Alignments, matching any value in each list
- AbilityRandomizer.Roll is set through the constructor
- ICreatureVerifier.VerifyCompatibility takes the ability randomizer and templates
- Fixed alignment generation when chaining multiple templates or filtering by alignment
- Template minimum ability scores (Ghost, Half-Celestial, Half-Fiend) are honored for the given ability randomizer, and rolled abilities are raised to meet them
- Template compatibility checks use precomputed creature groups, making verification and random generation much faster
- Added challenge ratings 28 through 30