I was thinking about implementing a realistic economy and happened on this old thread: https://www.gamedev.net/topic/554811-what-makes-a-good-4x-space-game-economy-model/
I like it, and I think it is doable. I would like to write a proof of concept but I am having trouble getting started. Here is my idea:
The economy is a white box with resources and people as inputs. Money is a proxy for value and the mapping between money and value will change with inflation/deflation.
- Value is in the form of labor from people and resources mined from the environment.
- The economy start with some amount of money.
- As resources are brought in, there is more value in the economy than money, so deflation occurs.
- The player can inject money into the system, inflating the currency. The player can destroy the injected money to cause deflation. (buying/selling treasury bonds)
The player, in this case, controls the government. So if the player wants to spend more money to buy a product or service (raise an army or a space fleet), it must print money and use that money to pay corporations to build it. The corporation takes the money and buys resources and convert that to the product and give that to the government. By printing money, inflation occurs so the price of that product will increase. The more money the player prints, the more expensive everything becomes.
The player also gets money in the form of taxes, so the larger the economy, the more money the nation gets. The player can use tax money to buy products without driving the prices up.
Now what prevents the player from injecting a ton of cash into his economy and then building a massive fleet to conquer the world? Well it would be very expensive, especially early on when the economy is small and the tech is low. But there could be a mid game inflection point when the tech is high enough that the player can hyper inflate her economy and make a one time push for mass militarization. Of course this will take a while, perhaps several years. In that time the rest of the world can see it and will either
- Raise their own armies and band together
- Embargo trade with the player to strangle her economy
The second point would require trade between nations and resource distributions where the player cannot have everything it needs to build a massive army. But I feel I'm getting too far ahead now.
So here is my implementation idea in python for readability
class nation:
var money
var injectedMoney
var population
var productivity #1 is normal,
var value #all worth in nation
var govMoney
def CollectTax():
govMoney += taxRate * gdp
def GetInflation():
return (money + injectedMoney) / value
def PrintMoney(moarmoney):
injectedMoney+=moarmoney
def BuyBackBond(money):
injectedMoney -= money
def BuyThing(money):
gdp += money
valueBought = (1 - profitMargin) * money / GetInflation()
#collect resources
value += valueBought
timeToCompletion = UnitManTime / (population * productivity)
I'm missing a few things, like trade, embargo, and how to actually collect resources and bring that into the economy and what that means. I guess that is where I am stuck. Any suggestions? Anything else I am missing?