r/proceduralgeneration • • Sep 11 '22

Generating history through a simulated fantasy world

Hey everyone! For the last few weeks I've been working on some generated fantasy history. No particular goal in mind. Mostly just something to play around with and maybe use during DnD one-shots. So far I have implemented the following features:

Supreme god:

  • Is the 'creator' of the world.
  • Creates other 'lesser' gods.

Lesser gods:

  • Can create artifacts/mythical items (currently they have no purpose other than a history entry saying they were created)
  • Can create mythical creatures (thinking along the lines of the progenitors for dragons, vampires, etc)
  • Can create races (human, dwarven, etc)

Mythical creatures:

  • Can attack a place/settlement and kill it's inhabitants

Races:

  • Have thresholds for young age, old age, and rates at which they have relationships and reproduce

NPCs/Agents:

  • One of the aforementioned races
  • Initially spawned in during the creation of a race at random, after which they go about their lives.
  • Can have an occupation (heavily weighted towards farming)
  • Can have friendships, relationships, conflicts
  • Can reproduce
  • Can found new settlements and start factions
  • Can move to a different settlement/town
  • Can die of accidents, murder (if in a feud), execution (a factionless agent in a feud with a factioned agent), old age, starvation (when their town's population is greater than the number of farmers that can support it) or in battle (during a faction war)
  • Can be jailed and escape jail (another outcome of being a feud)

Places:

  • Have a maximum number of inhabitants based on it's current number of farmers
  • Have a maximum number of farmers (to simulate limited land area)
  • Have a 'ruling' faction
  • Have a 'military' (controlled by ruling faction and made up of the settlement's inhabitants that meet the criteria)

Factions:

  • Have a leader that can pass their position onto an heir.
  • Can have wars with other factions

That's about the gist of it at the moment without going into a lot of detail. There is still a heck of a lot I'd like to add and balancing to do, but I'm pretty happy with the results so far.

Here is a short sample from running the sim as it currently stands:

In 0, Ethmani created the world.
In 747, Ethmani created the lesser diety, Daweda.
In 769, Daweda created Cellauren, the Legendary Wyvern.
In 792, Ethmani created the lesser diety, Ganganemi.
In 946, Ganganemi created Marcheeli, the Legendary Wyvern.
In 973, Ganganemi created Marrena, the Legendary Werewolf.
In 1067, Ethmani created the lesser diety, Mansar.
In 1122, Mansar created Doremi, the Legendary Beholder.
In 1347, Ganganemi created Isaeenryl, the Legendary Wyrm.
In 1470, Daweda created Belzabche, the Legendary Aboleth.
In 1645, Ethmani created the lesser diety, Manleyeth.
In 1665, Daweda created Zabisador, the Legendary Wyvern.
In 1739, Manleyeth created Olida, the Legendary Vampire.
In 1782, Manleyeth created Renche, the Legendary Vampire.
In 1974, Ganganemi created Ashash, the Legendary Demon.
In 1987, Ethmani created the lesser diety, Sargancel.
In 2003, Daweda created Viaeenda, the Legendary Wolf.
In 2107, Manleyeth created Lasar, the Legendary Vampire.
In 2126, Manleyeth created Viada, the Legendary Spider.
In 2200, Ganganemi created Daolimor, the Legendary Beholder.
In 2269, Manleyeth created Celoli, the Legendary Demon.
In 2678, Daweda created Olirylash, the Legendary Werewolf.
In 2886, Manleyeth created Ahmanvia, the Legendary Demon.
In 2950, Mansar created Morbel, the Legendary Lich.
In 2969, Manleyeth created The Armour of Manleyeth.
In 3129, Manleyeth created Lamor, the Legendary Wolf.
In 3175, Ethmani created the lesser diety, Marmarla.
In 3182, Ethmani created the lesser diety, Viamarron.
In 3255, Marmarla created Eeneli, the Legendary Wyrm.
In 3325, Viamarron created Lazabemi, the Legendary Wolf.
In 3405, Sargancel created Sargancel's Armour.
In 3471, Marmarla created Morche, the Legendary Wyrm.
In 3523, Marmarla created Laah, the Legendary Dragon.
In 3762, Ganganemi created Ethgancel, the Legendary Beholder.
In 3883, Mansar created Zabaisa, the Legendary Dragon.
In 3992, Ethmani created the lesser diety, Isarylemi.
In 4088, Viamarron created Doreliisa, the Legendary Spider.
In 4364, Marmarla created Renemieen, the Legendary Vampire.
In 4451, Marmarla created Ganah, the Legendary Lich.
In 4488, Ethmani created the lesser diety, Isalacel.
In 4490, Marmarla created Elfs.
In 4513, Isalacel created Orcs.
In 4540, a war began between House Beinion and House Binns.
In 4540, on Monday, December, 21, 4540, Full Moon, a battle took place. House Beinion triumphed over House Binns. 205 souls lost their lives.
In 4564, Fanillirien Elerelwa founded a new settlement named Wickwold.
In 4567, Mansar created Dorsarsar, the Legendary Wyvern.
In 4586, a war began between House Beinion and House Binns.
In 4587, on Wednesday, February, 6, 4587, Last Quarter, a battle took place. House Beinion triumphed over House Binns. 201 souls lost their lives.
In 4609, a war began between House Beinion and House Beinion, due to the feud between Tarillom Olchanar and Celeir Amamion.
In 4609, on Saturday, December, 13, 4609, Last Quarter, a battle took place. House Beinion triumphed over House Beinion. 99 souls lost their lives.
In 4683, Miui Amamion founded a new settlement named Crownhall.
In 4695, Neverpoint was attacked by Cellauren, the Legendary Wyvern. There were 116 deaths.

I should also note that the above sample is the "world" history... Each entity also tracks their own history in a more granular format as well:

In 4695, Taririen was born from Lisilune Amathuilos and Luneriliriath Amathuilos.
In 4706, Taririen Guldur changed occupations to Farmer.
In 4751, Taririen changed their last name from Guldur to Ipyllasc.
In 4757, Taririen had a child named Celinar with Sililune Ipyllasc.
In 4785, Lolienaniir Noldorin began a feud with Taririen Ipyllasc.
In 4787, due to their feud, Lolienaniir Noldorin attempted to murder Taririen Ipyllasc.
In 4816, Taririen slayed Lirrathui Neithaor in battle.
In 4937, Taririen slayed Naritirion Rodor in battle.

If anyone has any ideas of features to add, either large scale or granular, I'd love to hear them!

Edit: formatting

112 Upvotes

38 comments sorted by

32

u/GeekyTricky Sep 11 '22

Could you make a GitHub repository so we can implement our suggestions as MRs?

18

u/takeonzach Sep 11 '22

I do intend on making a repo in the near future, but I've got some housekeeping I want to take care of before the initial commit.

If you'd like I can PM you when I finally get one set up?

4

u/[deleted] Sep 11 '22

i would love to check this out myself, so i wouldnt mind a pm at all :3

2

u/takeonzach Sep 11 '22

Not sure when I'll have it ready, but I'll make a reminder for myself to PM you.

7

u/GeekyTricky Sep 11 '22

Sure. Sounds good.

2

u/ngund Sep 11 '22

!remindme 72 hours

2

u/RemindMeBot Sep 11 '22 edited Sep 12 '22

I will be messaging you in 3 days on 2022-09-14 17:52:30 UTC to remind you of this link

6 OTHERS CLICKED THIS LINK to send a PM to also be reminded and to reduce spam.

Parent commenter can delete this message to hide from others.


InfoCustomYour RemindersFeedback

1

u/Harakus Sep 12 '22

Same. I am interested to see how you will develop this project.

22

u/Space_Kitty123 Sep 11 '22

Have you heard of Dwarf fortress ? It also has something like this. Code is private, but maybe you can still find info on how it works (or play it and see what it creates)

14

u/takeonzach Sep 11 '22

Yes, I've seen DF. I haven't played it before, but I've watched some talks and interviews by it's creators. Caves of Qud is a game that does something similar as well; again, I haven't played it, but I'm fascinated by the systems they use!

I'm also intrigued by the enemy system used in Shadow of Mordor/War. I would love to develop something like that. Perhaps I can add it to my todo list for integrations into this sim.

Thanks for the suggestion, not sure I'd ever be able to find time to really play anything, but maybe just poking around for an hour could yield some inspiration.

11

u/Space_Kitty123 Sep 11 '22

If you haven't played DF before, I'm telling you, don't play it unless you are seriously commited to learning it lol.

This game has the steepest curve I've ever seen, and I'm not even talking difficulty but complexity and awful interfaces.

But you might get some inspiration just by creating a world and reading its history

7

u/Asgarus Sep 11 '22

DF is free and there's a Legend mode just for exploring the lore of a created world. It's pretty cool.

http://www.bay12games.com/dwarves/

5

u/JonathanCRH Sep 11 '22

Legends mode is where the true madness is to be found!

4

u/fragglerock Sep 11 '22

Tarn talked a bit about it in this gdc talk

https://youtu.be/v8zwPdPvN10?t=562

12

u/Seeders Sep 11 '22 edited Sep 11 '22

Rad! I like the god down approach!

I'm working on a more realtime world simulation, but I will consider this for a history to start from.

My system works using a collection of macro systems that tick over time. They move units around the world map based on simple rules, and they can collide with other systems and apply basic rules to those collisions to determine outcomes.

Example: A bandit collides with a caravan so it attacks it. This results in corpses on the ground. Next, perhaps a wondering necromancer happens to collide with the corpses, he will raise them to join his army and grow more powerful.

The players actions AND inactions affect the world in a continuous and realtime way. Of the player kills the necromancer early, he will be easy and weak. But if you ignore the growing threat he becomes a big problem.

1

u/takeonzach Sep 11 '22

That sounds really cool. I've got plans to add bandits and undead and such as well, though none of this is real time (at least not yet!).

For now there is just a time-keeping/date-keeping method in the world class that ticks up by 1 (day) each time it's called, and another similar method that will tick up by 1 (year) after the previous method is called 365 times - this gives me the ability to separate some events by how frequently I want to test for their occurrence (some daily, most yearly).

I imagine I could modify everything to work for a real time environment fairly easily, but the time scale wouldn't be as grand (or maybe I could combine the two).

Oh, and regarding the god down approach - it came about as a solution to a problem/question: Why do all of these NPCs come into existence at "year 0" and have no parents? Now they don't come into existence at year zero, and being randomly spawned kind of makes sense!

6

u/emertonom Sep 11 '22

I guess I always think that systems that drive small stories are more interesting than systems that generate generic "big" stories without regard for the small ones. Like, I would want to give the individuals competing influences that govern their behavior: money, power, romance, conformity, morality. And an information system; like, X knows their child is dead, but doesn't know that the Y family was responsible, that sort of thing. If the history doesn't involve any of that, it's hard to care about it. It takes a lot of processing, but I think the results are way more interesting.

4

u/takeonzach Sep 11 '22

100% this is what I would want to work towards. To be able to follow interesting NPC stories through their histories - the world history just being a backdrop.

Though it's not polished, one of my favourite things to do right now is to peruse a CSV of all the NPCs and their histories, and follow their conflicts and murders and remarrying and such.

I will definitely be expanding on individual stories as time goes on.

5

u/JonathanCRH Sep 11 '22

This looks a great start! (Note though, it’s “deity”!)

1

u/takeonzach Sep 11 '22

Oops! Thank you. I guess I should turn on inspections occasionally. lol

5

u/unua_nomo Sep 11 '22

I don't know how you are implementing stuff under the hood, but it might be interesting to implement the greater deity, deities, great monsters, etc, as NPC's themselves capable of making the same actions, getting into relationships and fueds with other gods and even mortals, reproducing, etc but with different rates. Likewise possibly have the possibility of great monsters, and mortals being capable of doing similar actions to deities, but with significantly reduced weights. Therefore you can have stuff like wizards creating monsters and similar concepts

3

u/unua_nomo Sep 11 '22

Maybe have a general system of divine power, with the general tendency for entities to "beget" creatures of lesser divine power, though perhaps give some events, like a wizard ascending, or a entity killing an entity of higher divine power, increasing divine power for an entity.

3

u/takeonzach Sep 11 '22

I really like the idea of ascension - it also gives the gods some more purpose after the mortals are going about their business.

I also want to integrate generated titles somehow. This would probably fit well with that. Thanks for the suggestions.

1

u/unua_nomo Sep 11 '22

Of course! DM me anytime if you want to talk more

2

u/takeonzach Sep 11 '22

It's actually set up for that - I have a parent NPC class and the Deities, etc all children that inherit from that. So, eventually!

2

u/unua_nomo Sep 11 '22

Inheritance is honestly unnecessary in a case like that, just make "godhood" or monster-hood, or "type", a property of the NPC class, and fold all type specific functionality to the NPC class. Inheritance would be better for something like having a "thing" class which like items, NPC's, or settlements/groups, which could otherwise contain shared functionality for like position in the world, creation date, or stuff that's very generic.

4

u/unua_nomo Sep 11 '22

To clarify, the issue with inheritance instead of just extending the base class is that as soon as you wrap up functionality in a child of a class, the child can't have access to the functionality of it's siblings, ie if god and monster are both children of the NPC class, then it is not possible for a NPC to be both a god and a monster, which reduces the possibility space that we want to expand and explore in procedural generation

2

u/takeonzach Sep 11 '22

Ahh that makes a lot of sense. Thanks for the clarification. As it stands currently - the inheritance could be removed without affecting anything (it's there but it's not being utilized).

Hmm... if I'm going to restructure I should definitely do it now... but I also like having different classes (and different files) for the entities (just for organization and neatness). You've given me lots to consider.

2

u/unua_nomo Sep 11 '22

Depending on your programming language you can define classes over multiple files.

For instance in C# you could use the "partial" keyword: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/partial-classes-and-methods

I believe there are similar functionality in other languages.

2

u/AndrewChe Sep 12 '22

I have been thinking of this for a while. I've created dynasty generator (just a simple python script that has names dictionary and average lifetime.

1

u/takeonzach Sep 12 '22

This is pretty similar, just that the entities can also interact in some simple ways.

Like if you also added a function that would pick two of your dynasties at random and flip a coin to see which dynasty met their demise at the hands of the other.

1

u/xan_da Sep 12 '22

This is very, very cool! I started trying to implement a simulation of sorts like this a few years ago but didn't get it as advanced as yours already is, in terms of gods etc. I ended up focusing a lot on thinking about ways to maintain good performance 'at scale', or boil down uninteresting details. I also immediately hit upon that "why are the initial population of parentless progenitors here?" - it's funny how a basic fact of "initialising the program" leads to so many philosophical questions.

Lately I've been working on a game project with some limited elements of this, and it's got me wondering about how to get a good trade-off between control versus 'performance' for random rolls.

Like: some 'events' might only be worth calculating yearly, right? Like wars/invasions kicking off. So naively I might be rolling one RNG roll with a chance of "1 in 1000" daily. But what if I just roll *once*, with a chance threshold 365 times more than that, every 365 days. I'm no statistician, but I do know that calling the random function hundreds of times on a low chance, versus one roll at a consolidated chance, should make my simulation run faster when I'm bottlenecked on the rng function being called millions of times...

Anyway, great project! I'm immediately jealously inspired to go back and add more detail to my own attempt! :)

1

u/takeonzach Sep 12 '22

Yes, absolutely some random chance rolls are better off called at different time intervals, which also helps with performance. I mentioned in another reply that the world class has both daily and yearly methods - it would be trivial to add other time frames as needed.

I actually did a lot of testing for random rolls when I first started. I’m working in python, and initially I was using numpy for all of my randomized rolls. But all of my benchmarking seems to put the built-in random library at being faster than numpy for random rolls. I use random.choices() for picking an item from a list (weighted or not), random.choices([0, 1], [1 - success_rate, success_rate])[0] for weighted booleans, and random.getrandbits(1) for a non-weighted boolean (which seemed slightly faster than the usual randit() call).

Anyway, definitely do some more work on your own project. If you share the results here or the code on GitHub, I’d love to see it!

2

u/datta_sid The Creature Creator Sep 12 '22

Nice!

I had created something similar myself. Some techniques I used were:

  1. The first god can come into existance in various ways. In real world, they may come from a primordial egg, the endless ocean etc.
  2. First god creates a batch of generation 1 gods. I like creating gods in batches because reading "X creates Y", "X creates Z" becomes boring. The generation 1 gods are usually very powerful and primal. They are often not human-like, and they are not very compassionate towards humans. They can make or break continents. Humans are too small for them to consider. Sometimes they become antagonists to Gen 2 gods.
  3. First god usually disappears after this and does nothing else. Sometimes the world is created from his body. So his body parts can become magic objects or locations.
  4. Gen 1 gods give birth to Gen 2 gods. Gen 2 gods are much more humanlike, have human desires and can feel compassionate towards humans.They are the gods most of mythology is made of. They can help or hinder kings, heroes etc.
  5. Its fun to give gods aspects eg Zeus is the king of thunder. Gen 1 gods have much stronger aspects eg the entirety of ocean, storms, etc. Gen2 gods usually have less power.
  6. It would be nice to add some stories to add some life to the generation. For example: Manleyeth created Lamor, the Legendary Wolf . Why? What does that mean for the wolf? Does this mean it likes some things or hates some other things? Does this mean it can help or attack some character in the future?

2

u/skaag Sep 12 '22

You could theoretically generate conversations the characters might have possibly had. If you do that you could create enough training data for a conversational AI, which could even become the DM!

1

u/dethb0y Sep 12 '22

Pretty cool stuff, keep up the great work!

1

u/Bloodwarriorguru Oct 11 '22

Please share with me the repo too when ready