Basic Villager Plan
Posted by Jeff Disher
Reply to: Work on OP creatures progressing slowly (Posted by Posted by Jeff Disher)
Basic Villager Plan
I have been moving forward on a plan for the villagers which I think is interesting and useful without being too ambitious (but still leaving the door open for bigger possibilities in the future).

The plan is that villagers will have occupations. They will choose these occupations based on the nearby villagers, if they don't already have one assigned (like when first spawned in or when they grow from a child). They will choose whatever occupation seems least common in their surroundings.

The occupations will define a list of what the villager will buy or sell, but will also define crafting recipes associated with that profession. When the villager has a deficit of its sold goods and sufficient purchased goods, it will execute the craft in order to produce more output.

If the villager is missing some inputs it would normally buy from a player, it will see if any villagers have that for sale and buy it from them.

If they notice that there are too few villagers near them, they will attempt to buy food from other villagers (or craft it themselves) in order to enter a breeding mode, once they have enough stock-piled. From here, they will proceed to breed and produce offspring the same way other animals do.

The trading mechanic will be mediated by a "coin" item. These coins are small (1 encumbrance), are not produced by or consumed in any crafting recipes, and have no purpose other than trading. Villagers will create/destroy coins as needed (they never store them, just produce them when needed).

Villagers will keep an internal inventory to manage these trades and crafts and will have a minimum and maximum of each relevant item they try to store. If below the minimum, they will try to craft. If below the maximum, they will still buy. The maximum will potentially block crafting (if a recipe produces multiple outputs, they won't continue crafting if they overflow with a single resources) and will stop purchasing if exceeded.

Additionally, all buy-craft-sell sequences must be profitable to the villagers.

This means that the trading mechanic is more about a way to sell plentiful resources in order to get useful products, as opposed to a way to exploit the system for infinite resources.

The details of this are still being determined, including the trigger and limit points for breeding, but also whether there should be some kind of "inventory decay" mechanic where villagers who are partially saturated can still lose inventory items, over time, as to not lock up the currency supply (if they always turn a profit, and they are the only source of coins, eventually the user won't be able to get any). Otherwise, the only natural way for them to "use up" these terminal goods is by breeding, and that will have limits.

So, the key point here is that the villagers will not be directly interacting with the world, but will at least interact with the player and each other. This seemed like a reasonable way to build out the mechanic while world interactions are determined later on (after all, even Minecraft limited this to existing farm plots only - and they took several years to reach even that point).

This at least seems like a reasonably interesting plan for the next release,
Jeff.