Genealogy and Family history

For discussions about game development that does not fit in any of the other topics.
Post Reply
SerbanSpire
Posts: 19
Joined: Fri Dec 14, 2012 11:23 am

Genealogy and Family history

Post by SerbanSpire »

Hello there. I am creating a game with a strong emphasis on Family Tree similar to Crusader Kings. How would such a database look like written in mysql? Where should I start? What columns should I focus on? Thanks in advance.
User avatar
Xaos
Posts: 940
Joined: Wed Jan 11, 2012 4:01 am

Re: Genealogy and Family history

Post by Xaos »

Make a son, daughter, mother, father, sister, brother category in the database. that covers all basis and attach those to each person.
User avatar
Callan S.
Posts: 2042
Joined: Sun Jan 24, 2010 5:43 am

Re: Genealogy and Family history

Post by Callan S. »

I thought you'd just have an entry for each, with two 'son/daughter of' entry (two entries, one for each parent). Simple as that.

Everything else is just a search criteria.
User avatar
MikuzA
Posts: 394
Joined: Thu Aug 08, 2013 8:57 am

Re: Genealogy and Family history

Post by MikuzA »

How about...

UID INT NOT NULL
PUID INT

UID = UserID
PUID = ParentUserID

UID would identify the user, that has its own table for username, etc data.
PUID is just a reference towards the same table but handled as 'parents for this user'.

So as row examples,

UID PUID
1 0
2 0
3 1
3 2
4 3
5 3
6 3
7 5

UserID 1 = Has no parents or unknown.
UserID 2 = Has no parents or unknown.
UserID 3 = Child of UID 1 and UID 2.
UserID 4 = Other parent is UID 3
UserID 5 = Other parent is UID 3, and brother of 4.
UserID 6 = Other parent is UID 3, and sister of 4 and 5.
UserID 7 = Other parent is UID 5, making UID 3 as grandpa!

Just an idea on how to simply proceed with this.
Why so serious?

Business Intelligence, Data Engineering, Data Mining
PHP, HTML, JavaScript, Bash/KornShell, Python, C#, PL/SQL
MySQL, DB2, Oracle, Snowflake
Pentaho, DataStage, Matillion, Unity3D, Blender
Winawer
Posts: 180
Joined: Wed Aug 17, 2011 5:53 am

Re: Genealogy and Family history

Post by Winawer »

Running queries on that type of structure is a pain, though, so you'll probably need to use some sort of trick (breadcrumbs, for example). Depending on the actual requirements, of course (can't remember what the tree was like in Crusader Kings).
User avatar
Xaos
Posts: 940
Joined: Wed Jan 11, 2012 4:01 am

Re: Genealogy and Family history

Post by Xaos »

Callan S. wrote:I thought you'd just have an entry for each, with two 'son/daughter of' entry (two entries, one for each parent). Simple as that.

Everything else is just a search criteria.
Yup. Do this. The rest is unnecessary (disregard my post) as a check for anyone (brother, sister, aunt, uncle, cousin) can be run by the parents id
Post Reply

Return to “General Development”