Saturday, March 1, 2014

How babby is formed

Food, Health and Reproduction

In the world of Cultura, the healthier your family then the faster you get more children. Healthiness is based on the food/goods consumed by a person. So far food consumption has been coded and health is properly added to a unit. At the end of each day (for debug purposes it was shortened to a matter of seconds), excess health is added to a family's birth progress meter. Once it fills up, a person is born and the meter resets!

Children are born with the characteristics of their parents, randomly chosen. The sex is also randomly chosen. For now it is using C++'s rand. Not exactly random but close enough for now. So this means if parents are an ogre and an elf, you might get an ogre or you might get an elf. If one is purple and the other is green, you might get purple or you might get green. I don't do anything complicated such as recessive/dominant genes and mixed alleles and whatnot. The purpose of this game isn't biology, it's culture! However, if the parents are from mixed cultures I am currently unsure what to do but for now the child will randomly pick one culture. That's for the purpose of ethnically discriminatory policies that societies might engage in... when I code that in.

The next step in the game is figure out how children break off from families and form new families (and whether to track the parent family). This might become important if I wanted to code in family dynasties. For example, a Roman Equites would care a lot about his/her children and parental relationship is through the son/husband. Or Chinese families would create estates in a similar manner with related families allowed to be in the same estate and utilize the industrial facilities there to earn money. But for now, we'll just worry about family creation with children.

Starvation is tracked and while there is no ill side effects coded, eventually it'll be decreasing health until death for each day without food. It's important to have both good feedback to the user about how much starvation, who is starving and how close someone is to death.

Bigger Buildings

Buildings in the world of Cultura are component based, meaning you build rooms and attach them to each other and that creates a singular building. I haven't put in rotating buildings and what not but the idea is that if you rotate a building so that it lines up with another building that determines whether it connects to it or not. In addition, all buildings are now 2x2 in size. I don't think there'll be anything in the early stone age portion of the game with different sizes but certainly when building more fantastic stuff (literally or figuratively) the sizes might be different.

For now we can behold a "den", which is a building component that is equivalent to a bedroom:

Infrastructure

I had to switch off the Greedy pathfinding in the game because people kept getting stuck like dumbasses and then filled themselves in with their own filthy poop. Well actually I haven't coded poop yet so the latter part isn't possible. Yet. In any case, it is now entirely A* pathfinding but obviously with just a naive implementation the performance demands much. So I may have to turn my efforts to some performance tweaking at some point in the near future. There are two general ideas: first is to make the A* faster (as I've done before but the code gets quite ugly) and the second is to use memory to decrease the number of times I recalculate paths via A*.

Units now have graphic variant ids. These ids match across the "races". So right now there are Humans, Elves and Ogres. A graphic variant ID of 1 is the same "type" of human, elf or ogre. This means that if "1" maps to a purple-skinned male in Human, it also maps to a purple-skinned male in Elf. This was to make the reproduction algorithm simpler; I could just take the graphic variant of one of the parents and voila I got matching skin colour.

Placing structures now respect previously placed structures, construction sites, rocks, resource nodes and everything else in the way. No more magical slamming crap on top of other crap and then you can only click one of them.

Whew

With the ability to put 2x2 buildings, I've laid the ground work for developing an industry chain. You can already hunt, gather and craft. I'd like to be able to allow the user now to automate an industry chain and then subsequently consume those goods for happiness and health. That'll make the first true building block of Cultura.

No comments:

Post a Comment