Page 1 of 5

[WIP] Real-life economics OXP

Posted: Fri Mar 30, 2012 7:20 pm
by Phasted
A quick-and-dirty OXP that takes a stab at adding a touch of reality to trade in the Ooniverse. Link to latest version...


FRIENDLY WARNING:

Real-life economics modifies system.info.market, which makes permanent changes to the save file... so you might want to start a new game. That way there won't be any unsightly mess to clean up if you decide that you don't like the OXP.

Re: Real-life economics

Posted: Fri Mar 30, 2012 9:31 pm
by cim
Phasted wrote:
A quick-and-dirty OXP that takes a stab at adding a touch of reality to trade in the Ooniverse. Give it a whirl...
Interesting idea! Certainly shakes things up for traders.

There seem to be a few bugs in the commodities lists - Diso appears to be so Agricultural it gets an overflow error of some sort - there were 37TC of Computers on the market at 0.0Cr. each. (Prices can't be more than 102.0Cr, or they wrap, and the quantity is surprising for an Agri surrounded by Agris too) The rest of the prices there looked fairly plausible, though. Lave's prices were plausible for an Agri in an Agricultural region, but the quantities looked more like they were Industrial (no Liquor, no Fur, plenty of expensive Computers). Leesti, Zaonce, Qutiri and Aronar looked okay, though - maybe there's something not quite right in the Agricultural plists?

A few minor scripting bugs - in script.js, system.infoForSystem should be System.infoForSystem and system.systemNameForID should be System.systemNameForID, to get the static methods rather than the instance methods.

Also a couple of minor packaging issues - Oolite on Linux is case sensitive, so the CONFIG directory needs to be renamed to Config, and the Script.js file needs to be renamed to script.js, or it doesn't work at all.

Re: Real-life economics

Posted: Sat Mar 31, 2012 12:30 pm
by Ironfist
Hi,

Just downloaded and unpacked the zip. Noticed that the Config Directory name is actually all in CAPITALS I think this may cause problems for Mac and Linux users. I currently have my WIN XP disks in and can't check until tomorrow.

Ironfist

Re: Real-life economics

Posted: Mon Apr 02, 2012 3:38 pm
by Phasted
Thanks to cim, Ironfist, and Svengali for helpful hints... I didn't know case-sensitivity was an issue (I've never used a Mac or Linux machine :oops:).

Currently at work on next test version, which will include:

- code to modify a system's economy (migrating toward Mainly AG/IND) if the player visits too often.
- an updated commodities.plist (though I dread the thought of wrestling with that bear again :evil:).
- occasional interaction with the quietly homicial trader/pirates of Fast Eddie's Faster-Than-Light Transport Company.

Coming soon to an internet connection near you!

Re: Real-life economics

Posted: Fri Apr 13, 2012 6:04 pm
by realbrit70
Just saw this and haven't had a chance to download and look at it yet but wanted to comment that I'd had the same idea of tweaking the economics and I wondered how you'd done it. I see you altered the system.info.market but I didn't realise that could be set from within javascript functions.

My intent was to add a ships_override.plist that provided a list of roles for all known stations that used the default commodities list. These roles defined the available commodities lists and I have created a base commodities market for each economy type. Upon creation of the station the primary role of the station would change to be the appropriate commodity list depending on the economy of the system. This doesn't affect it's role as a station as that does not need to be defined as a primary role, but it does change the commodity list used as that is chosen based on primary role if system.local.market is not provided. This doesn't then require alterations to the save file.

I'll also be interested in how you reconfigured the commodities for the various economies. If you're interested let me know and we'll compare ideas.

Re: Real-life economics

Posted: Thu May 03, 2012 6:20 pm
by Phasted
realbrit70 wrote:
Just saw this and haven't had a chance to download and look at it yet but wanted to comment that I'd had the same idea of tweaking the economics and I wondered how you'd done it.
The central idea is the Economic Balance [this.econBalance].

Every system is at the center of its own cluster of stars. A cluster consists of every system within 7 LY. Clusters are either Industrial (this.econBalance < 0), Agricultural (this.econBalance > 0), or at equilibrium (this.econBalance == 0).

Every system in the cluster is assigned a value from -4 to +4, depending on its economy (RichInd is -4; PoorAg is +4) and its distance from the player's present system (the greater the distance, the lower the influence of that system on this.econBalance).

There are other factors. The distance to the nearest agricultural system is subtracted from the distance to the nearest industrial system, and that number is added to this.econBalance. Then the total number of industrial systems is subtracted from the total number of agricultural systems. This result is also added to this.econBalance.

I've done a few systems "by hand" to ensure that the code is actually doing what I intended it to do. The results for Malama and Qudira (in galaxy 0) are:

-------------------------------------------------------------
Malama [RI -4] econBalance: -12.1 Market: "IND_over_AG_4"
NearestAgSystem 1.2 LY / NearestIndSystem 3.6 LY [+2.4]
AgEconomies 4 / IndEconomies 7 [-3]
-------------------------------------------------------------
Malama is 6.4 light-years from Zaatxe [RI -1.5]
Malama is 4 light-years from Esbiza [RI -2]
Malama is 6.8 light-years from Alaza [AA +0.5]
Malama is 4.8 light-years from Soinuste [PI -2]
Malama is 5.6 light-years from Celabile [MA +0]
Malama is 1.2 light-years from Qudira [PA +3]
Malama is 3.6 light-years from Inines [RI -2]
Malama is 6.4 light-years from Bierle [RI -1.5]
Malama is 6 light-years from Edreor [MA +0]
Malama is 6.8 light-years from Anle [RI -1]
Malama is 6.8 light-years from Tianve [RI -1]
-------------------------------------------------------------
Qudira [PA +4] econBalance: -15.8 Market: "AG_under_IND_4"
NearestAgSystem n/a / NearestIndSystem 1.2 LY [-5.8]
AgEconomies 2 / IndEconomies 6 [-4]
-------------------------------------------------------------
Qudira is 3.2 light-years from Esbiza [RI -2]
Qudira is 1.2 light-years from Malama [RI -3]
Qudira is 6.8 light-years from Aate [MI -0]
Qudira is 3.2 light-years from Soinuste [PI -1]
Qudira is 6.8 light-years from Celabile [MA +0]
Qudira is 4.4 light-years from Inines [RI -2]
Qudira is 4.8 light-years from Bierle [RI -2]
Qudira is 6.8 light-years from Edreor [MA +0]
-------------------------------------------------------------

I hope this answers your question.

Re: Real-life economics

Posted: Thu May 03, 2012 9:32 pm
by Dr.Tripsa
should different Governments have different economies?
for instance Communist:

takes all 'profits' from sales
while providing 'free' fuel and maintenance

this is semi tongue in cheek BUT would be realistic :P

Re: Real-life economics

Posted: Fri May 04, 2012 7:28 am
by Zireael
Love the idea, going to grab it...

Re: Real-life economics

Posted: Mon May 07, 2012 2:04 pm
by Phasted
Test version 0.03 is now available for your downloading pleasure...

• Case-sensitivity issues are now resolved...
• NEW and IMPROVED commodities.plist...

Again, I offer heart-felt apologies to those who downloaded test version 1 and found it lacking...

I shouldn't have been in such a hurry to turn it loose. :oops:

Re: Real-life economics

Posted: Mon May 07, 2012 2:34 pm
by Smivs
Phasted wrote:
Again, I offer heart-felt apologies to those who downloaded test version 1 and found it lacking...

I shouldn't have been in such a hurry to turn it loose. :oops:
It was a test version - nobody would expect it to be perfect, and I can understand your keen-ness to release. I'm sure there is not an author out there who isn't keen to show off what they've made. :D

Re: Real-life economics

Posted: Tue May 08, 2012 1:09 pm
by Phasted
This is getting to be a bad habit... :oops:

While I was testing the OXP, I modified this.checkForEconomyChange(), to make sure it really did what it was supposed to do.

Then, in a lightning stroke of genius, I forgot to change it back...

If you've downloaded test version 0.02, you'll find that the economy of a system changes (migrating toward Mainly Agricultural/Mainly Industrial) if you visit more than 3 times in 500 hours... not at all what I intended.

I'm gonna get the hang of this eventually.

Re: Real-life economics

Posted: Tue May 08, 2012 1:16 pm
by Cody
Phasted wrote:
This is getting to be a bad habit.
Don't fret about that, Phasted. I'd only add that you should remind people to restart the game with shift held down until the spinning Cobra appears if anything internal has been changed (such as replacing a script).

Re: Real-life economics

Posted: Tue May 08, 2012 1:17 pm
by another_commander
Phasted wrote:
• Restart your computer (if necessary)
That's a bit radical isn't it? I would think restarting Oolite with Shift held down should be enough.

Re: Real-life economics

Posted: Tue May 08, 2012 2:09 pm
by Phasted
El Viejo wrote:
...you should remind people to restart the game with shift held down until the spinning Cobra appears if anything internal has been changed (such as replacing a script).
another_commander wrote:
I would think restarting Oolite with Shift held down should be enough.
Honestly, I had no idea... I've been going through hell every time I make changes to my OXP's.

Re: Real-life economics

Posted: Tue May 08, 2012 2:22 pm
by cim
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...