Realistic economy in 4x

Started by
12 comments, last by omikun 7 years ago
Do you want to make a game about corporations, colonies, planetary or regional governments, etc.and their economical incentives? If such entities are autonomous, they are natural "enemies" of the empire, to be manipulated and kept happy; if they are player-controlled, the player can only control one of them coherently, not the empire and not multiple ones. What do you have in mind?

I'm thinking of a game where an empire consists of multiple entities (populations, corporations, government) with the player controlling the gov and AI (or a set of equations) controlling the rest. Keeping an empire alive should be a balance between the different entities. This balance can be upset by trade imbalance or propaganda.

But if you are at war with them, how can your trade with them? Each empire builds ships within the limits of the resources of their own planets and stations, possibly buying finished starships or appropriate resources from the same third parties in exchange for non-starship goods and resources.

Wars are not started before the military is ready, at least on one side. As one side is building up, the rest of the world can take actions. An empire can keep secrets but only for so long and only until an operation reaches critical mass. If Russia ramps up military production, the rest of the world will know before too long. This ramp up may take a year or two, in the mean time trade sanctions can be made to slow them down.

Advertisement

I've been looking at some economy simulators:

https://github.com/chewxy/economy-sim - simulates the influence loans have on an economy; fair price calculated by finding the minimum surplus (supply - demand) for some set range of prices. Individuals in the economy have fixed consumption/production weights. Price fluctuates based on money supply and individuals going into debt/kicked out of system

https://github.com/larsiusprime/bazaarBot - agent based simulator with a bargaining system: buyers guess offer prices, sellers guess asking prices, market price determined by the average. This tracks dependencies between commodities (axe needs 1 wood and 1 steel) so a flux on one commodity impacts others, as well as the number of sellers. Sellers that go broke will switch jobs to where there is more demand.

I'm looking into a hybrid of these 2: using economy-sim to model the population with bounded-random fluctuations in preferences combined with a small number of agents visible to the player (corporations) that the player either creates or has finer control over (issuing buy orders, bailouts, subsidies, etc) to fulfill player goals: explore the moon, other planets, mine asteroids. Once the player has created the first corp that can mine asteroids, the population will slowly start consuming those commodities and new corps will be created to mine other asteroids if the demand exists (player must drive demand in the early stages until the population's demand can sustain those corps in times of idle gov spending).

I spent a long time replicating economy-sim in c++ before I realize it doesn't support (and cant' be made to support) the kind of dependencies I wanted in bazaarBot. Now I am working on another sim in unity based on the paper linked by the bazaarbot project. It's looking good!

This graph is quantity traded vs trading rounds. The quantity traded is based on commodity type with 20 agents. The commodities are from the paper: food, wood, ore, metal, tools. I simplified it so only the woodworker needs the tools, everyone eats, and only farmers need wood. Blue is food, everyone needs that. Maroon is wood, needed by the farmer, and that stabilizes. The other stuff, ore->metal->tools fluctuates much more.

giphy.gif

I only have a subset of the functionality implemented. Still need to switch agent jobs on bankruptcy, set max prices, more intelligent bids based on supply/demand and historical averages. I made the graph from scratch, but if anyone knows of a good graphing library for Unity I wouldn't mind switching over. It needs to be open sourced since that is the goal of this project.

It works! Well for the most part. I can't explain all its behaviors right now.

Check it out at:

https://github.com/omikun/EconSim

It's written in C# for Unity. Right now it only models price as a rough function of supply and demand based on agents' price believes, which is influenced by price and the success of their bids. Things to add: multi-markets with optional import taxes and export restrictions, and unique currency per market.

This topic is closed to new replies.

Advertisement