Hello fellow roguelikers!
One of my hobbies is toying around with making a couple of RL games, and in one of them I need to (or, would like to) procedurally generate one or more large families, but I'm having trouble figuring out a nice way to do it.
What I want to do is basically start with one or more ancestors, and build a (realistic) family tree from there.
For example, I start with Bob and Jane Smith who get married in 1850. Then I give them 1 or more children, and each of those children will get one of the following fates:
a) meet a spouse, but have no children
b) meet a spouse, have one or more children
c) forever alone
(there could of course be other possibilities, but I'm trying to keep it fairly simple for now)
if b) then repeat the same procedure with each child, until we get to present day (i.e. start of the game).
Oh, and to further complicate things: each person's spouse could be from one of the other procedurally generated families in town! Or it could be someone unrelated, e.g. an immigrant.
Or, in other words, what I'm trying to accomplish is to generate/simulate the population in a small town/village over a couple of hundred years. Dwarf Fortress & Toady One seems to be able to do this on a large scale, so I'm hopeful that it's possible for a hobby amateur programmer like me to do it on a very small scale....?!
I've tried a couple of simple approaches with recursive functions, but quickly got stuck in infinite loops... Also, keeping track of fathers, mothers, children, siblings and other relations quickly becomes a mess. (Btw, I'm programming in C, and using a ton of pointers for this.)
So I would really appreciate some input, thoughts and fresh ideas on this issue, if anyone has any! I feel like I've painted myself into a corner and can't find a way out. Maybe someone else is able to see a way out? I'm sure there are many different approaches to solving this problem, but right now I can't see them...
Thanks in advance for any input, ideas and thoughts!