Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

[WIP] Real-life economics OXP

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: another_commander, winston

another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6557
Joined: Wed Feb 28, 2007 7:54 am

Re: Real-life economics

Post by another_commander »

cim wrote:
Phasted wrote:
Honestly, I had no idea... I've been going through hell every time I make changes to my OXP's.
Oolite will reload the OXPs rather than using its cache if any of the following are true:
1) The contents of the AddOns folder have changed
2) The timestamp of any of the OXP folders with the AddOns folder is later than the cache date. It does not, however, check the dates within the OXP folders.
3) The version of Oolite is different to the version used to generate the cache (rare!)
4) Shift is held when starting Oolite
...I may have forgotten some others, too.

I tend to use '2' when building OXPs. I develop the OXP outside of the AddOns folder, and then have a short script which deletes the copy of the OXP in AddOns, and copies my development version in, which I run whenever I want to test changes. That makes certain that the timestamp is fresh and so Oolite will reload the OXPs. Much easier than holding down Shift and hoping it works...
To add to the list:
5) When the key always-flush-cache is set to YES in the preferences file
6) When an executable with a different cache version is used (the cache version is also embedded in the exe and we've used this quite a few times in development when we wanted to ensure that Oolite would rebuild cache following a code commit)
7) When the cache endian tag is not what the executable expects (almost never happens)
User avatar
Phasted
Competent
Competent
Posts: 51
Joined: Wed Jun 09, 2010 3:56 pm

Re: [WIP] Real-life economics OXP

Post by Phasted »

Test version 0.03 available now...

A couple of screenshots...

Image

Uploaded with ImageShack.us

Image

Uploaded with ImageShack.us
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2412
Joined: Mon May 31, 2010 11:11 pm

Re: [WIP] Real-life economics OXP

Post by Switeck »

I'm getting these errors in my Latest.log:
04:39:56.031 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (RealLifeEconomics test 0.03): TypeError: system.sun is null
04:39:56.031 [script.javaScript.exception.unexpectedType]: ../AddOns/Real-Life_Economics_TEST_v0.03.oxp/Config/script.js, line 189.
04:39:56.171 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (RealLifeEconomics test 0.03): TypeError: system.sun is null
04:39:56.171 [script.javaScript.exception.unexpectedType]: ../AddOns/Real-Life_Economics_TEST_v0.03.oxp/Config/script.js, line 189.
04:39:56.343 [aquatics_populator]: System platform added in interstellar space by populator script.
04:39:56.562 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (RealLifeEconomics test 0.03): TypeError: system.sun is null
04:39:56.562 [script.javaScript.exception.unexpectedType]: ../AddOns/Real-Life_Economics_TEST_v0.03.oxp/Config/script.js, line 189.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: [WIP] Real-life economics OXP

Post by Commander McLane »

Obviously a missing check for interstellar space.
User avatar
ioannis
Dangerous
Dangerous
Posts: 72
Joined: Mon Apr 16, 2012 6:11 pm

Re: [WIP] Real-life economics OXP

Post by ioannis »

Great Oxp, really changes the game. However, I noticed that an average agricultural tech level 5 Feudal world had lower prices for computers than a Rich industrial tech level 15 Corporate state. Is this normal?
I also noticed that the Feudal state which was previously receiving the supply of computers had some 50 tonnes of computers in stock. I am guessing that the price is a question of supply and demand in the station, and that the game had kept the stock of computers I had brought. Does this mean that prices will go up again once that stock starts to dwindle?
In effect, how does the econBalance factor affect prices?

PS. that was a trade route I had found, it's great to see prices change, because before that it was just a matter of continuously making the runs and cashing in on that one route.
Scratchbuilding miniatures:
http://miniaturesandstuff.wordpress.com/
the picture in my avatar is a Dwarf Berserker.
User avatar
Phasted
Competent
Competent
Posts: 51
Joined: Wed Jun 09, 2010 3:56 pm

Re: [WIP] Real-life economics OXP

Post by Phasted »

ioannis wrote:
Great Oxp, really changes the game. However, I noticed that an average agricultural tech level 5 Feudal world had lower prices for computers than a Rich industrial tech level 15 Corporate state. Is this normal?
Yep, if the RI system is in a heavily Agricultural cluster [say, IND_under_AG_3 or IND_under_AG_4], prices for Computers, Luxuries, and Machinery could be nearly as high as those you'll see in Agricultural systems...

By the same token, if you're in an Agricultural system surrounded by Industrial economies [AG_under_IND_3 or AG_under_IND_4], prices for Food, Textiles, Liquor/Wines et. al. will be higher than you might expect.

The logic is simple: The total output (or very nearly the total output) of these systems will be exported to satisfy the needs of the surrounding systems. When quantity demanded goes up and quantity supplied can't keep pace, prices rise.
ioannis wrote:
I also noticed that the Feudal state which was previously receiving the supply of computers had some 50 tonnes of computers in stock. I am guessing that the price is a question of supply and demand in the station, and that the game had kept the stock of computers I had brought. Does this mean that prices will go up again once that stock starts to dwindle?
Prices and quantities are determined entirely by commodities.plist. JavaScript has no way to affect (or even read) prices and quantities. This is all done by Oolite. I've made a request that would change this sorry state of affairs, but I have no idea if anything will ever come of it...
ioannis wrote:
In effect, how does the econBalance factor affect prices?
When econBalance is negative, the local cluster favors Industrial economies, when it's positive, the balance is Agricultural. If it's exactly 0, the system's economy will be at "equilibrium" (equilibrium: "the price at which quantity demanded exactly equals quantity supplied and the market clears without shortage or surplus"). The OXP takes this econBalance value to determine which market [there are 21 in all] Oolite will use to calculate quantities and prices.

The equilibrium market (which you may never see) is at the center. Prices are almost perfectly average and quantities available for purchase are all 0.

From equilibrium, markets follow four lines: IND_over_AG (for Industrial economies in Industrial clusters), IND_under_AG (for Industrial economies in Agricultural clusters), AG_over_IND, and AG_under_IND. Within each line are 5 markets, each slightly farther from equilibrium than the one below it... (for example IND_over_AG_0 will be quite close to equilibrium, while IND_over_AG_4 will offer some real bargains on Computers!)
ioannis wrote:
PS. that was a trade route I had found, it's great to see prices change, because before that it was just a matter of continuously making the runs and cashing in on that one route.
Well, the whole point of the thing is to do away what I like to call the "Lazy Trader Shuffle", where all you have to do is find a RI/PA pair reasonably close to each other, hop back and forth carrying Computers one way and Liquor/Wines (or Furs when they're available) back.

If you find that this makes the game more challenging... I am gratified.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2412
Joined: Mon May 31, 2010 11:11 pm

Re: [WIP] Real-life economics OXP

Post by Switeck »

Phasted wrote:
ioannis wrote:
Great Oxp, really changes the game. However, I noticed that an average agricultural tech level 5 Feudal world had lower prices for computers than a Rich industrial tech level 15 Corporate state. Is this normal?
Yep, if the RI system is in a heavily Agricultural cluster [say, IND_under_AG_3 or IND_under_AG_4], prices for Computers, Luxuries, and Machinery could be nearly as high as those you'll see in Agricultural systems...

By the same token, if you're in an Agricultural system surrounded by Industrial economies [AG_under_IND_3 or AG_under_IND_4], prices for Food, Textiles, Liquor/Wines et. al. will be higher than you might expect.

The logic is simple: The total output (or very nearly the total output) of these systems will be exported to satisfy the needs of the surrounding systems. When quantity demanded goes up and quantity supplied can't keep pace, prices rise.
I would expect prices to go up when demand is high, but an agricultural world should not have a significant surplus of computers to sell. (...assuming the system is in a mostly equilibrium state.) Instead the RI world supplying the computers would have its price go up while the amount it offered for sale to go down. The amount the Agri. worlds would pay for more computers would go down if there's numerous nearby Ind. worlds...or it would go up if there's only one (or no!) nearby Ind. world. Only if "Agri" worlds have lower prices for computers than Ind. worlds would the Agri. worlds have leftover computers they want to sell. That would only be a short-term state that the player should be very unlikely to see. If that happened, those computers would flow back to the ind. worlds...forcing them to lower their prices and/or production.

The tiny number of "unreachable" worlds should pay near max (102 credits/TC) for items they do not make.
User avatar
ioannis
Dangerous
Dangerous
Posts: 72
Joined: Mon Apr 16, 2012 6:11 pm

Re: [WIP] Real-life economics OXP

Post by ioannis »

Thanks for the clarification, I say again, this is a great oxp, really changing the game's economy and contributing to a more "fluid" ooniverse.
Scratchbuilding miniatures:
http://miniaturesandstuff.wordpress.com/
the picture in my avatar is a Dwarf Berserker.
User avatar
Phasted
Competent
Competent
Posts: 51
Joined: Wed Jun 09, 2010 3:56 pm

Re: [WIP] Real-life economics OXP

Post by Phasted »

Switeck wrote:
I would expect prices to go up when demand is high, but an agricultural world should not have a significant surplus of computers to sell.
You have to consider not only what the system produces, but also the quantity that's imported... High prices attract traders laden with goodies.
Switeck wrote:
Instead the RI world supplying the computers would have its price go up while the amount it offered for sale to go down. The amount the Agri. worlds would pay for more computers would go down if there's numerous nearby Ind. worlds...or it would go up if there's only one (or no!) nearby Ind. world.
Correct.
Switeck wrote:
Only if "Agri" worlds have lower prices for computers than Ind. worlds would the Agri. worlds have leftover computers they want to sell. That would only be a short-term state that the player should be very unlikely to see. If that happened, those computers would flow back to the ind. worlds...forcing them to lower their prices and/or production.
I'm not 100% sure what you're driving at, but it sounds wrong...

Goods move from areas of lower price to areas of higher price. The greater the price disparity, the greater the quantity of goods transported.

Sadly, Oolite only allows for static markets. Prices and quantities are calculated exactly once, when the player first enters the system. After that, they can't be modified (or even read) by a script.

If Oolite allowed for more dynamic markets, then we could do some really interesting things:
• Prices and quantities changing (perhaps a little, perhaps a lot) every time the player hits F8.
• Prices changing in response to buying or selling decisions the player makes.
• Prices and quantites being affected by NPC actions (i.e. the Anaconda that docked just before you did dumped 80 tons of Computers and wrecked the market...)

Fun stuff!

Maybe someday... :wink:
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2412
Joined: Mon May 31, 2010 11:11 pm

Re: [WIP] Real-life economics OXP

Post by Switeck »

Phasted wrote:
Switeck wrote:
Only if "Agri" worlds have lower prices for computers than Ind. worlds would the Agri. worlds have leftover computers they want to sell. That would only be a short-term state that the player should be very unlikely to see. If that happened, those computers would flow back to the ind. worlds...forcing them to lower their prices and/or production.
I'm not 100% sure what you're driving at, but it sounds wrong...

Goods move from areas of lower price to areas of higher price. The greater the price disparity, the greater the quantity of goods transported.

Sadly, Oolite only allows for static markets. Prices and quantities are calculated exactly once, when the player first enters the system. After that, they can't be modified (or even read) by a script.
It should sound wrong. Agri worlds shouldn't end up with lower prices for computers than Rich Industrials. Even with a vast oversupply, the Agri worlds would still have a slightly higher price for computers. In such a scenario, a RI "fighting" for the limited Agri market would lower its prices to beat nearby competition. If they raised their prices, their sales would cease to exist quicker than they could cut back production. It would be economic suicide for the RI. For the Agri world, they would lower their (buying) price for computers because they can afford to hold out...but if nobody sells any computers to them, they lose too. Their need/want for computers doesn't go away just because their buying price changes. A "static market" equilibrium will be reached if there is enough active trade.

Tiny carrying capacity is why individual ships don't normally cause huge market price changes. Even an Anaconda with a full load of 750 TC of 1 type of commodity still represents a tiny drop in the bucket if the world's entire consumption is measured in millions of TC a year. Plus, there's the 63 TC buying/127 TC selling limits on spot markets (outside of the cargo contracts) to smooth that out further.
User avatar
Disembodied
Jedi Spam Assassin
Jedi Spam Assassin
Posts: 6881
Joined: Thu Jul 12, 2007 10:54 pm
Location: Carter's Snort

Re: [WIP] Real-life economics OXP

Post by Disembodied »

Phasted wrote:
  • Prices and quantities changing (perhaps a little, perhaps a lot) every time the player hits F8.
  • Prices changing in response to buying or selling decisions the player makes.
  • Prices and quantites being affected by NPC actions (i.e. the Anaconda that docked just before you did dumped 80 tons of Computers and wrecked the market...)
The trouble with that is, without careful controls, players could make money by buying stuff, hitting F8 until the price goes up, then selling it again. It shouldn't be possible to make money without the player taking goods out of the station and carrying them somewhere else.

Introducing NPC actions are problematic too, since it would be very hard to let the player see them happening and therefore to understand why a price has crashed. There's be a danger that it would just seem random.
User avatar
Phasted
Competent
Competent
Posts: 51
Joined: Wed Jun 09, 2010 3:56 pm

Re: [WIP] Real-life economics OXP

Post by Phasted »

Switeck wrote:
Phasted wrote:
Switeck wrote:
Only if "Agri" worlds have lower prices for computers than Ind. worlds would the Agri. worlds have leftover computers they want to sell. That would only be a short-term state that the player should be very unlikely to see. If that happened, those computers would flow back to the ind. worlds...forcing them to lower their prices and/or production.
I'm not 100% sure what you're driving at, but it sounds wrong...

Goods move from areas of lower price to areas of higher price. The greater the price disparity, the greater the quantity of goods transported.

Sadly, Oolite only allows for static markets. Prices and quantities are calculated exactly once, when the player first enters the system. After that, they can't be modified (or even read) by a script.
It should sound wrong. Agri worlds shouldn't end up with lower prices for computers than Rich Industrials.
Agricultural worlds won't have lower prices for Computers than nearby Industrial worlds. Distance is a factor. I put a great deal of thought and work (I'd say at least 30 hours over the course of two weeks...) into commodities.plist. Consider an industrial system in an overwhelmingly industrial cluster (market: IND_over_AG_4) and a nearby agricultural system. It's highly likely (not guaranteed, but likely) that the market in the agricultural system will be AG_under_IND_4. Most of the time (the random factor can produce some anomalies) IND_over_AG_4 will produce a lower price for Computers than will AG_under_IND_4. I took great care to insure that this holds true for all commodities in all markets.
Switeck wrote:
Even with a vast oversupply, the Agri worlds would still have a slightly higher price for computers. In such a scenario, a RI "fighting" for the limited Agri market would lower its prices to beat nearby competition. If they raised their prices, their sales would cease to exist quicker than they could cut back production. It would be economic suicide for the RI. For the Agri world, they would lower their (buying) price for computers because they can afford to hold out...but if nobody sells any computers to them, they lose too. Their need/want for computers doesn't go away just because their buying price changes. A "static market" equilibrium will be reached if there is enough active trade.
You were 100% correct until you got to that last sentence. Static markets do not move. Prices and quantities are calculated just once and after that, they are untouchable... If the market is not at equilibrium to begin with, it won't get there at all.
Disembodied wrote:
Phasted wrote:
  • Prices and quantities changing (perhaps a little, perhaps a lot) every time the player hits F8.
  • Prices changing in response to buying or selling decisions the player makes.
  • Prices and quantites being affected by NPC actions (i.e. the Anaconda that docked just before you did dumped 80 tons of Computers and wrecked the market...)
The trouble with that is, without careful controls, players could make money by buying stuff, hitting F8 until the price goes up, then selling it again. It shouldn't be possible to make money without the player taking goods out of the station and carrying them somewhere else.
I really don't envision the changes being entirely random. If I had direct access to prices and quantities, I would begin with all prices at the average between Oolite's high and low prices, and all quantities set to zero (the "equilibrium" market). I would then factor in system.economy, the local Economic Balance, and some small random factor to determine the "rest state" or "zero energy state" (to borrow a concept from physics) for each commodity's price.

Prices can then more or less randomly stray up or down from this "rest state". At any given moment, the price of any commodity could move in either direction, but it would be more likely to move in the direction of "rest".
Disembodied wrote:
Introducing NPC actions are problematic too, since it would be very hard to let the player see them happening and therefore to understand why a price has crashed. There's be a danger that it would just seem random.
The operation of any healthy market is completely unpredictable. It never occurred to me that anyone would question market movement, whether "random" or not...

Maybe (on those occasions that something out of the ordinary actually happens) a mission screen (triggered when the player hits F8) explaining that an unexpectedly large number of traders are currently connected to the trading interface... blah, blah, blah... station management apologizes for any inconvenience.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2412
Joined: Mon May 31, 2010 11:11 pm

Re: [WIP] Real-life economics OXP

Post by Switeck »

Phasted wrote:
Switeck wrote:
A "static market" equilibrium will be reached if there is enough active trade.
You were 100% correct until you got to that last sentence. Static markets do not move. Prices and quantities are calculated just once and after that, they are untouchable... If the market is not at equilibrium to begin with, it won't get there at all.
You missed my point. Since you can only simulate the static "steady state" markets, which I say would result in the Oolite universe (even if you can't do that via dynamic commodities.plist), the static market price for computers at Agri worlds would always be more expensive than RI worlds. ...Even for RI worlds not near the Agri worlds.
User avatar
Disembodied
Jedi Spam Assassin
Jedi Spam Assassin
Posts: 6881
Joined: Thu Jul 12, 2007 10:54 pm
Location: Carter's Snort

Re: [WIP] Real-life economics OXP

Post by Disembodied »

Phasted wrote:
Disembodied wrote:
Introducing NPC actions are problematic too, since it would be very hard to let the player see them happening and therefore to understand why a price has crashed. There's be a danger that it would just seem random.
The operation of any healthy market is completely unpredictable. It never occurred to me that anyone would question market movement, whether "random" or not...
Random chance, and bad (and good) luck are fine, in certain small, non-game-changing doses, but they need to be shown to the player, otherwise it just feels like things are happening for no reason (which of course is what random chance is, but at least in the real world we get to see the mechanisms in operation: we'd get to see the unloaded Anaconda, the huge piles of cargo crates, the disinterested buyers, etc.). It's very easy, in a game, when bad luck strikes, for the player to feel that the game is cheating them, because they player doesn't get to see the dice rolls.

If you wanted to include the chance of sudden price crashes because e.g. an Anaconda stuffed with Computers has just arrived and sold the lot, you'd need to have some sort of alert system to explain them – and they should happen during flight, and the market prices would need to update on the in-flight F8 screen. Bad luck with an explanation attached is a lot easier to stomach in a game than just bad luck on its own.

I don't think though that any one ship could have this sort of impact: the UK wholesale prices of goods don't plunge every time a container ship full of whatever turns up at Dover. Plus, what benefit would there be to the Anaconda pilot? If he's delivering enough to crash the market price, he's not going to get top dollar for his whole load – unless the entire planet only has one customer for any one commodity, which you might get in a Feudal or Communist or Dictatorship or certain forms of Corporate State world with institutionalised monopolies, but would be very unlikely anywhere else. Of course, such institutionalised monopolies would mean thriving black markets ...
User avatar
ioannis
Dangerous
Dangerous
Posts: 72
Joined: Mon Apr 16, 2012 6:11 pm

Re: [WIP] Real-life economics OXP

Post by ioannis »

It might also be interested if prices could be linked with potential pirate "blockades" or "wars". For example an alert from bloomberg could inform of price increases in all non-agricultural commodities in an agricultural world that is suffering a blockade, war or something similar. I know that this is already being done, but it could affect more than one commodity, as is the case presently. Heavy attacks from the beacon to the station could ensue should the player dare try his luck by "blockade running".
Scratchbuilding miniatures:
http://miniaturesandstuff.wordpress.com/
the picture in my avatar is a Dwarf Berserker.
Post Reply