NaNoGenMo / 2021

National Novel Generation Month, 2021 edition.
44 stars 8 forks source link

RPG Campaign Setting Generation using Graph Rewriting #17

Open rhysmakesthings opened 2 years ago

rhysmakesthings commented 2 years ago

I will attempt to generate something akin to a tabletop rpg adventure book, generating a world and then using graph rewriting to create quests within that world that match the world model.

E.G. World Model: King Alexander = Character The Baronies = Faction Irvin Gold Mine = Resource The United Banners = Army King Alexander belongs to Faldland. King Alexander hates The Baronies. King Alexander controls The United Banners The Baronies control Irvin Gold Mine

Graph Rewriting Rule: (A hates B + A controls Army) -> (A at war with B, Army attacking B) (A hates B + B controls Resource) -> (A wants to sabotage B)

Result: King Alexander is at war with The Baronies. Under his command, The United Banners attack The Baronies. He will pay adventurers to sabotage the Irvin Gold Mine which is under The Baronies control.

Will be interesting to see how effective this attempt is, and how slow the performance will get since graph rewriting is not fast.

rhysmakesthings commented 2 years ago

I have completed my special case graph rewriting code, so now i need to hook some world generation code I already had into it. I might need to expand the world generation code before starting on the rewrite rules themselves because at the moment it just has places and creatures, no characters yet.

rhysmakesthings commented 2 years ago

image Faction generation working. Now with a larger world model than my initial test it looks like I've got some bugs to quash in the graph finding code.

rhysmakesthings commented 2 years ago

Bugs quashed and Characters generating. The characters are given graph edges to other characters in their hex with emotions. "hate", "friendly", "love", "dislike", "ambivalent etc.

rhysmakesthings commented 2 years ago

Resources added and first proper graph search of the generated world model happening. Uncovered some pretty bad inefficiences that will need to be squashed.

rhysmakesthings commented 2 years ago

Inefficiencies largely dealt with. I think there's still a bug floating around, but it's functional enough that I can use it to start doing some graph rewriting. Next step: write rules and get some output!

rhysmakesthings commented 2 years ago

Done! Find the full example output as a webpage here: https://github.com/rhysmakesthings/rpgcampaign_setting_nanogenmo/tree/main

Live version and code at: rhysmakesthings.com/gm_friend. Press "Random" in the sidebar to generate a map (change the height and width to a reasonable size, depending on your settings it will hang for a bit), and then right click on individual hexes to view the hex information (scroll down to the notes section). Right click on the map again to return to the main level. "Show factions" checkbox in the sidebar is also useful. The "graph finding" code is in js/graph.js at the website and the model building is in "js/data.js" and "js/world_generator.js"

And a preview of the first hex below.

I hit the target, but it really needs some formatting improvements. It also ended up quite violent, so theres lots of room for more interesting rules that aren't just about killing.

faction_map

(0,4)Seat of Kalli

This hex is controlled by the Zerind Sultanate

Jaren Hariga the knight
Faction:Zerind Sultanate
HP:1.5HD
AC:13
Hit Bonus:1
Attacks:1

Jaren Hariga hates the Damire, and will reward you for killing them.

Jaren Hariga wants help preventing Nanalm Vonenda from harming the Mellor. They do not believe the monsters should be slain for no reason.

Heriurle Mathara the witch
Faction:Zerind Sultanate
HP:3HD
AC:13
Hit Bonus:6
Attacks:3
Level 1 Spells
Detect Magic
Light
Level 2 Spells
Web

Heriurle Mathara wants help preventing Jaren Hariga from harming the Damire. They do not believe the monsters should be slain for no reason.

Verageli Relrlill the thief
Faction:Zerind Sultanate
HP:1
AC:12
Hit Bonus:0
Attacks:1

Nanalm Vonenda the artist
Faction:Zerind Sultanate
HP:9HD
AC:18
Hit Bonus:9
Attacks:1
Level 1 Spells
Sleep
Shield
Level 2 Spells
Phantasmal Force

Nanalm Vonenda hates the Carso, and will reward you for killing them.

Nanalm Vonenda hates the Mellor, and will reward you for killing them.

Tirilli Idrasil the sailor
Faction:Zerind Sultanate
HP:1
AC:12
Hit Bonus:0
Attacks:1

Tirilli Idrasil wants help taking down Jaren Hariga in order to stop them from harming Damire.

Tirilli Idrasil wants help taking down Nanalm Vonenda in order to stop them from harming Mellor.

Tirilli Idrasil wants help preventing Nanalm Vonenda from harming the Carso. They do not believe the monsters should be slain for no reason.

Donrra Calia the blacksmith
Faction:Zerind Sultanate
HP:1.5HD
AC:13
Hit Bonus:1
Attacks:1

Damire (monster)
Monster (Theme:growth)
Appearance:Butterfly-ent
HP:3HD
AC:12
Hit Bonus:3
Attacks:2
Number Appearing:1-3
Level 1 Spells
Purify Food and Water
Protection from Evil
Intelligence:Intelligent

Carso (monster)
Monster (Theme:growth)
Appearance:golem
HP:1
AC:12
Hit Bonus:0
Attacks:1
Number Appearing:1-1
Intelligence:Intelligent

Ozienor (monster)
Monster (Theme:growth)
Appearance:elemental
HP:3HD
AC:11
Hit Bonus:3
Attacks:2
Number Appearing:1-3
Special:heal each turn HD/2
Intelligence:Animal

Larat (monster)
Monster (Theme:growth)
Appearance:Boar
HP:6HD
AC:15
Hit Bonus:6
Attacks:1
Number Appearing:1-2
Intelligence:None

Mellor (monster)
Monster (Theme:antlers)
Appearance:Mink
HP:1.5HD
AC:13
Hit Bonus:1
Attacks:1
Number Appearing:3-5
Intelligence:Intelligent

Saveld (monster)
Monster (Theme:growth)
Appearance:Lemur-Termite
HP:3HD
AC:11
Hit Bonus:3
Attacks:2
Number Appearing:1-1
Level 1 Spells
Protection from Evil
Detect Magic
Intelligence:Intelligent

rhysmakesthings commented 2 years ago

Found an amusing hex where everyone wants to get their hands on item called "The Sword of Old Men"

(15,8)East Andalo This hex is controlled by the Black Grkol Society

Netrrirvala Samond the warlock Faction:Jellyfish Union HP:2HD AC:12 Hit Bonus:2 Attacks:2 Netrrirvala Samond guards sword of old men

Netrrirvala Samond wants help preventing Theraya Ulueyn from harming the Desakalo. They do not believe the monsters should be slain for no reason.

Mazona Chosseh the man Faction:Black Grkol Society HP:1HD AC:13 Hit Bonus:1 Attacks:1 Mazona Chosseh says that Netrrirvala Samond is guarding the sword of old men, and they will pay you for its return.

Mazona Chosseh wants you to find the sword of old men fast before it is taken by Ahrniel Thand. If you can prevent Ahrniel Thand from retrieving the item they will reward you.

Ahrniel Thand the diplomat Faction:Black Grkol Society HP:1HD AC:13 Hit Bonus:1 Attacks:1 Ahrniel Thand says that the Netrrirvala Samond are also guarding the sword of old men, and they will pay you for its return.

Chush Talven the cook Faction:Sanayn Union HP:4HD AC:14 Hit Bonus:4 Attacks:1 Chush Talven would like the PCs to retrieve the sword of old men from where it is guarded by Netrrirvala Samond.

Chush Talven wants you to find the sword of old men fast before it is taken by Theraya Ulueyn. If you can prevent Theraya Ulueyn from retrieving the item they will reward you.

Theraya Ulueyn the fletcher Faction:Black Grkol Society HP:2HD - 2 AC:13 Hit Bonus:1 Attacks:1 Theraya Ulueyn hates the Desakalo, and will reward you for killing them.

Theraya Ulueyn would like the PCs to retrieve the sword of old men from where it is guarded by the Netrrirvala Samond.

savetz commented 2 years ago

Your maps are beautiful.

joeld42 commented 2 years ago

This is great! I love the monster themes and special abilities. This already seems like a really useful tool for worldbuilding!

rhysmakesthings commented 2 years ago

Your maps are beautiful.

Thanks! Adding the faction colours really makes them pop.

This is great! I love the monster themes and special abilities. This already seems like a really useful tool for worldbuilding!

Thank you! Yeah the idea is to provide evocative details so you can use it as a starting point or something you can improvise from.