Dynamic Economy

I've recently added this to my current project and I thought that I would share how I did it, in case someone else wanted to do something similar or improve upon it.

I didn't want the items in my game to have set prices throughout the player's playthrough so I implemented a dynamic economy.

How it works is each location (room object) the player can visit has two dictionary attributes, inventory and inventory_value. The inventory dictionary keeps track of how many of each item the location has. While inventory_value keeps track of the percentage increase/decrease that should be applied to the item's base value.

location.inventory = {Iron_Ore= 0, Coal= 0} location.inventory_value = {Iron_Ore=0, Coal=0}

So when the player is buying/selling items in that location the item's final price will be (base_value * percent) + base_value = final_value.

In order for the base value to be different from the final value the percentage has to change. The percentage increases when the item is needed and decreases when the item isn't needed.

I added another dictionary attribute to each location called roles. They're the same thing as classes (Warrior, Mage, Rogue), I just call them roles in my game. The roles dictionary keeps track of how many citizens with that role live in that location. I added an object list attribute called products to each role and put in which items that role can produce. Then I made it where once a day, each citizen in each location will try to produce one of the items that's in their role's products list. I say try because some items require other items to be made.

location.roles = {Miner=10, Smelter=7} Miner.products = {Iron_Ore, Coal} Smelter.products = {Iron Bar}

For example, each Miner in a location has a chance to mine a few things like stone, iron ore, and coal. Miners don't require additional items to obtain these things. Smelters, on the other hand, need iron ore and coal to produce iron bars. So, if for some reason the Miners aren't able to get the iron ore and coal (because there are no Miners in that location, or the location isn't in a mineral rich area) then the Smelters won't be able to smelt iron bars. Each time this happens, I increase either the iron ore, the coal, or both of their value's by one for that location. When there is enough or more than enough iron ore and coal, I do the opposite and decrease the items' values' by one for that location.

I think this really forces the player strategize about where they need to be buying/selling their items to get the highest profit.


Clever... you have created a "living" "world"...
Now, expand that to wild life... If there is few hunters, then the wild life will increase... more food available could increase the population.
If there is too many hunters, then the wild life will decrease... (could cause a food shortage.)
Do the same for monsters and things will really get wild...
If nothing else, you would, or could, a life simulation.
Run this for awhile, watching the variables, and you could determine what a starting world could be like...
Something realistic and not just randomly set-up for a game.
I know this may be a different path that you planed, but it could be interesting...
Instead of an adventure game, but more like a kingdom game... control the population and build a empire.


For my game I am randomly generating the world at the start and letting the different systems I implement sort of develop the world throughout the playthrough.

I do think that a colony sim implementing the system and the suggestions you gave would make for an excellent game. That might be my next project after I'm done with my current one... or hopefully someone else will be inspired to make it.


This topic is now closed. Topics are closed after 14 days of inactivity.

Support

Forums