Return to “General”

Post

Self-Stablizing Economies

#1
Self-Stablizing Economies.

hi guys. Im new here, but have been watching the forum (and discussions) for quite a while now.
Im really impressed at the deep discussions on some topics, and wanted to contribute some ideas.

I have been interested into game-create for quite some time, especially into emergent systems.
Since Limit Theory (at whatever release-date) will include an AI-driven, open world economy, I wanted to
discuss some problems that game economies have.

It actually quite tricky to keep an economy in a self-managing stable state, without relying on artificial
(out of the economic rules) stabilizers, such as injecting money, new goods, spawning AI traders from nowhere etc.

In the case of Limit Theory, I have seen a great idea of an AI-Driven Market. Although I have not quite understood the
reasoning of the AI-Agents for setting their Supply/Demand price preferences in this setting.

Any way, before going into pricing (utility) theory, I wanted to show some simple observations in a long term
fully self-enclosed economy simulation.
EG: how do we make it stabilze itself without going out of whack, or reverting to hacks.

So I thought, lets make a little simulation, a simplified model of a "space economy".

http://crongame.com/prototypes/econ1/economy1o.html


(use space to pause, and left/right cursor keys for sim speed)


The goal of the sim is for the little people to collect "booze", wich is produced
from the other input goods.

Now this model does not include an important component of a self-regulating market:
it does not rely on dynamic pricing of goods. (that would be the next objective to implement)

It has an economic cycle (periods of depression, periods of boom). And sometimes crashes.

The agents in the sim are very primitive and act on simple rules:

-stations produce goods when raw material and money is avaialble
-ships purchase input goods, and sell output goods when they see them at the station
-ships do not plan anything, but fly to a random station and look at whats availalble.
-the distillery converts in intervals all goods into booze (no labor costs)
-the workers (little blue man at the stations) get 1 coin for each production, and purchase (consume) booze

the money (coins) flow in the opposite direction of the production cycle

the amount of money does not increase or decrease, the prices are set static
no profit-margin is introduced here in this model (eg, the ships do not sell higher or buy lower)
the price of the products is only the labor cost invested

goal of the economy: get as much "booze" to the workers (consumption)
without crashing the economic cycle
the booze simply adds up in the display, its not moving away from there
(simply done to show the booze-bar grow over time, assume its empty booze bottles)

there are 2 seperate production paths running:

1x input-Good A (ice) -> 1x processed Good A (fuel) -> 1x Booze
1x input-Good B (ore) -> 1x processed Good B (plates)-> 1x Booze

if one production path crashes (one of the participants run out of money or goods), the other can still function

For convenience I have shown each item (product or money) as seperate entities.
you can see EVERY good or coin as seperate image, they are actual objects, not just a numeric balance
the objects only disappear when converted into another object they only appear when produced by a station


Damocles
Post

Re: Self-Stablizing Economies

#3
Nice thread! You've obviously put plenty of thought (and effort) into it.

We had a similar conversation a while in The Macro Economy thread. And we recently had an in-depth look at whether a closed economy is worth the effort to try to make it work in a game.

On that note, what do you think of the notion that you need multiple independent economic entities -- and allow them to both grow and fail -- so that the entire system as a whole can maintain a steady-state of wealth?
Post

Re: Self-Stablizing Economies

#4
but I wonder - is there a way to see what everything is producing/carrying? I'm not really sure what's going on, to an extent.
Yes, maybe some additional can be helpful ..I should put a legend in to show what colorful blob is what.

The economy start with the "mines", which produce the initial raw materials (ice or ore). They are on the top of the map.

Each factory has their own coins (their budget), and a workforce (who also own coins, they earn for working there).
If the factory has coins left, it will regularily produce a resource (ice or ore), and pay a wage of 1 coin to the workforce.

You can see the little coin moving to the blue-mans "pocket" on top of the factory.

Now there are trading-ship, (who have no AI), that simply fly to a RANDOM station.

There they will purchase the Resource for a FIXED price. In the initial setting its 1 coin for resources.
-> the price only includes how much work-wages went into production in this model.

then the factory transfers one ice to the ship, and receives 1 coin.

Next is the merchant-ships selling the ice or ore to the production factories, who in the same logic convert it to "Fuel (from ice)" or "plates (from ore)"

They purchase the fuel or plates (2 coins price) and bring it to the "Distillery" or "Trade-Hub".

This station can convert those good into "booze" . You can se that as an international trade-station that barters fuel/plates for booze, at regular intervals.

The booze is a 1 to 1 conversion from the converted product. Thus I have set the price to 2 coins still.

The ships will now sell the booze to the workers ( so they can spend their wages).
They will happily just keep the booze in their inventory (lets say its empty bottles).

----------------

What interesting in this simulation is, that you can see how an economy can crash.
When one of the parties (factories, trade-ships, workforce), drains the economy of all coins, (money in circulation reduces), the system can crash:
eg: no trade/production or consumption can be done.
This happens for example if you create a profit margin for the traders (by adjusting buy/sell proces).

The ships will receive over time all coins, leaving the factories or workforce out of money.

Since there is no dynamic price, ("government fixed prices") and the trade-ships do not consume anything, they will just hold onto all the coins.


---------------

How to avoid such crashes:

we need actual dynamic decisions, and a pricing model.

Dynamic pricing:

Lets say there is too little ice beeing produced (ice mines are about to run out of money), The Ice mines should charge more coins per item.
This would let the ice-mines gain a profit over the labor costs. They would get into financially better waters over time again.
If the ice floods the market, the price would fall, and they would stop production for a time, until the over-production is removed.

More consumption:

the money the traders and factories earn for themself, is not spend for consumer goods.
So lets say we introduce more goods, such as "repair kits", that the ships need to spend money on -> to get the money back into circulation


Banks:

If an entity horde much more money than they can use, they actually hurt the economy.
We could introduce a bank that take this money into a savings account, and give out a credit to an under-funded entity.
With them having liquidity again he economy would be back working fluidly again.
(unless the investors request to get their savings back all at the same time)

Bankrupcy and new Investments-

If there are too many entities in one field (too much production, that noone consumes), those factories run out of money,
-> they close down, and reduce the over-prodcution until the produces quantities fit the demand again.

Same goes for missing production:
If a good is undersupplies, more factories would be set up to produce it.....
Post

Re: Self-Stablizing Economies

#6
Thanks for the kind words.

I will implement a new system: Banks.
And see how this affects the economy.

The banks will take up savings from agents that have "unused" coins, eg funds that are not used in transactions for some time,
and grand loans to agents that run out of funding.

The loans will act to revitalize the critical part in the economy that ran out of money (be it a producer, trader or consumer)

If an entity can not pay interest after a certain period, it will be removed from the market after a while.
(loanshark blowing up the facility or ship)
->economic Darwinism ;)

-----------------

I have an idea to introduce a demand based pricing system, but that will require a central (local) market for
the participants to offer and purchase goods. The prices will be determined by the available stock and projected local demand.
Here it will be interesting to see trade occur between different systems, that have different production/consumption capabilities.


------------

For the demo: sorry it is not optimized for touchscreen devices. (phones, tablets), I might put that in.
The idea to show every item/gold-coin in the economy is good for debugging the simulation but quite terrible for the performance.
Post

Re: Self-Stablizing Economies

#8
Damocles wrote:The idea to show every item/gold-coin in the economy is good for debugging the simulation but quite terrible for the performance.
This is exactly why Josh started down the path of replacing the LTSL scripting language with a Python/JIT-based engine - and the last report we had from him was that he was working on translating all the old systems into this new structure.

As you'll have seen from this demo, JavaScript is great at getting something out there, but it has limits of performance.
Maybe convert it to Java and see how much that helps?
--
Mind The Gap
Post

Re: Self-Stablizing Economies

#9
As you'll have seen from this demo, JavaScript is great at getting something out there, but it has limits of performance.
Maybe convert it to Java and see how much that helps?
Yes, I know Java has a lot higher performance than JavaScript in that regard.
I also do lots of programming in Java.
Unfortunately Java is not really supported by browsers anymore (too much hassle for a user to get the VM running, since there are several security checks now), so its not any more an option to showcase things to a wider audience.

Anyhow, this is just a simulation to learn where a self-sufficeint virtual economy most likely breaks. In a (JS based) space game, I would certainly not show the items in this way. Here the rendering would be used mostly for creating an interesting scene for the player. The economic machinery itself would run without direct visualization, and the logic itself runs quite ok in performance terms i guess. (I always use my old iPad2 as performance checker in JS applications...)
Post

Re: Self-Stablizing Economies

#10
Damocles wrote:Unfortunately Java is not really supported by browsers anymore (too much hassle for a user to get the VM running, since there are several security checks now), so its not any more an option to showcase things to a wider audience.
Absolutely. I was thinking it might be a quick way to make a stand-alone binary that performs well enough to implement the granularity of 'each gold coin' as you mentioned. Fortunately, the JS was generic enough that it should be easily implemented in Core Java, which also means you could run it on pretty much anything anyway.
Anyhow, this is just a simulation to learn where a self-sufficeint virtual economy most likely breaks.
And it is excellent for the purpose - and indeed, I don't have any trouble running this on any of my machines, it's only if you felt you wanted to switch to something more performant that I suggested Java.
If only there were a truly native JS compiler!
--
Mind The Gap
Post

Re: Self-Stablizing Economies

#11
Damocles wrote:I also do lots of programming in Java. Unfortunately Java is not really supported by browsers anymore (too much hassle for a user to get the VM running, since there are several security checks now), so its not any more an option to showcase things to a wider audience.
This is why I reluctantly switched from Java to JavaScript for my game development.

I'd rather use Java for performance, but I can write the display code for multiple browsers, including mobile, much more easily with JavaScript+HTML5+CSS. Plus, as a solo part-time developer, mediocre coder, and terrible artist, I can't polish my stuff sufficiently for retail quality, anyway.
Damocles wrote:I always use my old iPad2 as performance checker in JS applications...
Same here. :)

I also do cross-platform testing, and code for the slowest platform. In fact, I still need to write a short article about the benchmarks I documented for the relative speeds of various canvas graphics operations in the 5/6 major browsers. (IE 11 is not always the slowest.) And the sort() function is only stable on 2.5 of the major browsers. (I still need to update StackOverflow with that info.)

Fortunately, some of today's browsers have pretty nice profilers built into them. There's still magic involved in figuring out exactly which piece of code is the worst offender, but at least it's theoretically possible.

#thingsyoulearn

Good luck with the simulations!
Post

Re: Self-Stablizing Economies

#12
Yes, performance testing is vital to avoid (performance wasting) mistakes, that could be avoided.
I also use an old EEEPc Netbook to check Desktop applications.
It shows much more early when a procedure is too wasteful than on my big Dev PC.

I often see Indy developers using their big gamer-machines, not noticing when performance gets to be an issue.

When you cant create the assets, complexity and fidelity of an AAA game, at least make your small app as fast, fluid and portable as possible.

Thats why I like Javascript. Probably the most portable thing there is, as any decent mobile and desktop device will support it without
any installation procedure.

I started making games for JavaME Phones, thats why I also like to keep my apps as small as possible. (and even 4 Kilobytes are already sufficient to make a fun game ;) )
Post

Re: Self-Stablizing Economies

#13
I like your style of working, Damocles.
I started writing code on machines that only had 128 bytes of memory, and I've spent most of my career as a low-level programmer running with embedded or small devices. Writing efficient code is so important in these situations, and it's largely a forgotten skill these days.

Games in 4KB are entirely possible if you do them right: the last J2ME game I wrote was in 2004, and was one of the first MMO-style games on the platform. I even had talks with Rage and Take Two about selling it, before funding fell through.

I do love JS for the reasons you've mentioned.

Also, if you're near London and want a new job, LMK :-D
--
Mind The Gap
Post

Re: Self-Stablizing Economies

#14
That's some pretty cool stuff, however I was wondering what would happen if you applied it to an expanding environment. The example is pretty static as far as buy/sell locations, so what would happen if it was in a game where the player and/or the AI explores and brings new assets into play? I wonder what effect that would have. I also kinda wonder what kind of effect say an embargo would have on some of those buy/sell locations, or if a major player suddenly went kaput due to player actions like war etc. Just thinking out loud.

Also, this:
Damocles wrote:
I have an idea to introduce a demand based pricing system, but that will require a central (local) market for
the participants to offer and purchase goods. The prices will be determined by the available stock and projected local demand.
Here it will be interesting to see trade occur between different systems, that have different production/consumption capabilities.


Seems like the way to do that would be for two kinds of markets, one local and one system/faction/empire type. In other words, whoever or whatever is controlling the local economy, makes a decision on how much of their output gets used locally, either system wide or empire wide or whatever, and how much gets put out there for outside buyers/sellers. This could either be the player controlling their own empire or the AI doing the same, but either way, they make a choice as to how much of the local assets are distributed locally and how much is used for "outside" sale.
Ask, and it will be given to you; seek, and you will find; knock, and it will be opened to you.
Post

Re: Self-Stablizing Economies

#15
I've made some games in the Java4k competitions.
It was a really nice time back then.

like this one:
Image using a voxel-3d rotating procedural town, that minions build and you had to blow it up with explosives.

http://www.java4k.com/
Unfortunately the competition kind of died off, due to browsers restricting Java Applets to run seamlessly.

There where lots of other great talents too in that comp.

JavaME was also nice, due to the restrictions. I somehow like limited hardware.
But the porting to so many devices was a nightmare.

------------------
That's some pretty cool stuff, however I was wondering what would happen if you applied it to an expanding environment. The example is pretty static as far as buy/sell locations, so what would happen if it was in a game where the player and/or the AI explores and brings new assets into play? I wonder what effect that would have. I also kinda wonder what kind of effect say an embargo would have on some of those buy/sell locations, or if a major player suddenly went kaput due to player actions like war etc. Just thinking out loud.

The model in this simulation is very restricted indeed.
Lets propose a more dynamic model in the economy:

commodities:

lets say we want a system with dynamic commodities, wich are not of a predefined and static setup in the game,
but can be added/researched dynamically.
In order to use such a model, each commodity needs some fundamental properties:

-it has a utility for someone (else there would be no demand)
-a scarcity - either by limited supply, or high costs to be allowed to use it (licenses, blue-prints)
-a way to aquire it, that the simulated agents can also pursue (mining it, finding it, producing it, robbing it)
else it would be just a player-gamy-gimmick, not part of the economic model
-have an elasticity of demand (kind of too specific here, but it affects how the price reacts to supply)
-have a cost to aquire it (time and effort spend, and the value of input-products in processing.)
-and more stuff I probably forgot

lets say this new product is known to be marketable, then the economy can behave in certain ways:

-it replaces demand for another product or competes with it. Anyhow, the price or traded amount of the competing product will drop,
as more funds are redirected to aquiering the new asset.
-it can be priced, if the utility (complex) and supply-costs (easy) can be determined.
-new production facilities are build / or reconfigured. eg: it changes the "landscape" of the industry
-or not much happens, and its just a unique item, that receives a high market-price in an auction.
-it "outlawed" by some regions. but that rather outside the pure economic view of the model.

...actually, i would need more time to ponder how to set up an economy with dynamically "invented" assets,
outside a simple determination of production-paths and cost calculations.


Embargos:

the model presented here is very fragile, and would falter if both supply chains are "cut off".
Especially since it has no market / dynamic-pricing logic.
A robust economic model would have several separate local economies, that also have the ability to invest (more production) and contract (less production)
depending on the demand/price of their product.
In the case of an embargo, another local economy would flourish that offers the same products,
and other economies will suffer, due to cutting off their supply-line to or demand from the embargoed marked being cut off.
A (better) economy would react by increasing investment in the competing economy, (protectionism) and
the downfall of dependent economies.
-> then the "economy of security" would come into place.
eg: how much are the local markets willing to pay for protection by armed forces, or willing to pay a randsome.

Online Now

Users browsing this forum: No registered users and 16 guests

cron