This Week In Veloren 99
This week we see new models coming into the game. We hear from @Christof about how economic simulation is being done for different items.
- AngelOnFira, TWiV Editor
Contributor Work
Thanks to this week's contributors, @Slipped, @XVar, @lboklin, @BenoitduGarreau, @imbris, @Frinsky, @Entropy, @xMAC94x, @jiminiycrick, @zesterer, @ccgauche, @Pfau, and @HiggsTardigradeTau!
This week, @Pfau posted another edition of his Veloren art blog, you can check it out here. @ccgauche has been putting in a lot of work into procedurally generated trees. They are also working on the new backend of the plugin API.
@AlbinoAxolotl made serpent carnyx and brass boumbek models. @Scott worked on some bigger updates to the wiki. @Sam got the axe skill tree finished up. @XVar has the inventory/loadout overhaul nearing completion. The UI changes can be seen in @Pfau art blog. @Sarra_Kitty worked on several new glider variants and learned how to use Git for the first time. @Slipped animated stuns and staggers for the poise system that @James implemented. Next, @Slipped will be moving on to making the system fun to use.
Economic Simulation by @Christof
Last week, we saw that prices are determined by supply and demand. But if you happen to be an adventurer coming back from a dungeon where you risked your life to loot better weapons and armor, you'll also end up with some less potent spare items in your inventory and want to exchange them for new food and potions.
Typically there are two solutions to this within a program:
- Handcrafted, neatly balanced hardcoded prices (with some spatial or temporal variation)
- Economy simulations
Depending on the situation, the first shows a tendency to either feel too random or too fixed. On the other hand, getting a simulation that works well enough is a considerable piece of work. A core question that emerges is; why would a person living a happy life in a town that farms crops ever want to exchange your spare armor and weapons for their food, as only food offers a direct value to feed the family?
This question has left me puzzled for some time as I wanted to find a way to determine an exchange rate between armor and food to create reasonable prices for trade. In June, @zesterer created the second generation of economic simulation (see TWiV-72) which calculated the need for different professions among a town’s population and the exchange rates between sites. But an exchange price for wheat and meat does not suit adventurers that well as they will hardly be able to provide these goods in exchange.
The idea I followed to get prices for martial equipment is to restrict access to natural resources by a concept of a controlled area. The more area a town controls the more natural resources it has access to. Subsequently, the more secondary and tertiary goods it can produce, the more mouths can be fed. With this in mind, we can get some exchange rate between armor and food, as one controls the available amount of the other. The current production chart of this model looks as follows:
Rectangles show professions, ellipses show goods. Natural resources (which are collected from surrounding areas) are colored in green, produced goods in orange. The numbers indicate the number of goods needed and produced by a single person. There are two special nodes at the bottom: “Everyone” literally means any inhabitant of a town and “controlled area” corresponds to patches on the map allocated in radial order by the amount of guards employed. So each town will have its own pattern of surrounding natural resources, depending on its location in the world.
An economic simulation step (see tick_site_economy
) looks like this:
demand
is the sum of the goods (including food) needed by all the workers (and non-working people)supply
is the sum of produced goods (taking last step’s availability of resources into account)marginal_surplus
is supply - demand (indicates whether stock is increasing of decreasing)surplus
is stock +marginal_surplus
(the amount of missing (negative) or unneeded (positive) goods)- relative good
value
is a smoothed exponential function of the relative amount of missing resources labor
is redistributed according to the smoothed sum of the value of the produced goodslabor_productivity
is the minimum of the relative availability of resources from (last step’s) stockmaterials_cost
is the sum of (last step’s)labor_value
of the resources consumed, per produced unitlabor_values
is the sum of materials cost and wage cost (fixed 1.0 per worker), per unit
As the last step, some of the stock decays and is then replenished by naturally grown resources. The population is easily simulated by a death rate of 0.5% and, only if there is enough food to feed the inhabitants, a natural birth rate of 5%.