randpg 0.8.2
randpg: ^0.8.2 copied to clipboard
A package for generating random rpg entities. This package allows generating many random entities for rpg fantasy games, from names and npcs to entire worlds!
example/example.md
Examples #
Table of Contents #
- Generating names
- Generating npcs
- Generating locations\buildings
- Generating settlements
- Generating landscapes
- Generating deities
- Generating guilds
- Generating kingdoms
- Generating worlds
Generating names #
Generating a male halfling name as an example:
final Gender gender = Gender.male;
final Race race = Halfling();
final nameGenerator = race.getNameGenerator(gender);
// if you want to seed the generator:
nameGenerator.seed(1234);
print(nameGenerator.generate()); // expected output: "Cormin Copperbrook"
output might be different since dart random seed is different on different machines
Generating npcs #
Generating an elf npc as an example:
final Race race = Elf();
final npcGenerator = NpcGenerator(race);
print(npcGenerator.generate());
Generating locations\buildings #
Generating a tavern whose owner is a dwarf as an example:
final LocationType locationType = Tavern();
final Race ownerRace = Dwarf();
final locationGenerator = LocationGenerator(locationType, ownerRace);
print(locationGenerator.generate());
Generating settlements #
Generating a town of mostly orcs as an example:
final SettlementType settlementType = Town();
final Race dominantRace = Orc();
final settlementGenerator = SettlementGenerator(settlementType, dominantRace);
print(settlementGenerator.generate());
Generating landscapes #
Generating a swamp as an example:
final LandscapeType landscapeType = Swamp();
final landscapeGenerator = LandscapeGenerator(landscapeType);
print(landscapeGenerator.generate());
Generating deities #
Generating a lawful good god/goddess as an example:
final Alignment alignment = Alignment(
ethical: EthicalAlignment.lawful,
moral: MoralAlignment.good,
);
final DeityType deityType = God();
final deityGenerator = DeityGenerator(deityType, alignment);
print(deityGenerator.generate());
Generating guilds #
Generating a thieves guild as an example:
final GuildType guildType = ThievesGuild();
final guildGenerator = GuildGenerator(guildType);
final Guild guild = guildGenerator.generate();
print(guild);
Generating kingdoms #
Generating a republic of dwarfs as an example:
final GovernmentType governmentType = Republic();
final Race race = Dwarf();
final KingdomType kingdomType = DefaultKingdomType();
final Kingdom kingdom = KingdomGenerator(kingdomType, race, governmentType).generate();
print(kingdom);
Generating worlds #
Generating a world with the default settings:
final WorldSettings settings = DefaultWorldSettings();
final worldGenerator = WorldGenerator(settings);
final World world = worldGenerator.generate();
print(world);