[WIP] Real-life economics OXP

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

Moderators: winston, another_commander

User avatar
Phasted
Competent
Competent
Posts: 51
Joined: Wed Jun 09, 2010 3:56 pm

[WIP] Real-life economics OXP

Post 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.
Last edited by Phasted on Wed Jan 22, 2014 4:52 am, edited 4 times in total.
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Real-life economics

Post 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.
User avatar
Ironfist
Commander
Commander
Posts: 218
Joined: Tue Jun 28, 2011 2:16 pm
Location: London

Re: Real-life economics

Post 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
64bit Mint 10 and Win 8 64bit on E8400 at 3.6GHz - ATI HD5750 graphics.
Concentration is the ability to think of absolutely nothing when it is absolutely necessary.
User avatar
Phasted
Competent
Competent
Posts: 51
Joined: Wed Jun 09, 2010 3:56 pm

Re: Real-life economics

Post 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!
realbrit70
Above Average
Above Average
Posts: 19
Joined: Fri Feb 17, 2012 5:11 pm

Re: Real-life economics

Post 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.
User avatar
Phasted
Competent
Competent
Posts: 51
Joined: Wed Jun 09, 2010 3:56 pm

Re: Real-life economics

Post 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.
User avatar
Dr.Tripsa
Dangerous
Dangerous
Posts: 84
Joined: Mon Apr 30, 2012 9:33 pm
Location: In your cargo bay, eating your chips.

Re: Real-life economics

Post 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
Zireael
---- E L I T E ----
---- E L I T E ----
Posts: 1396
Joined: Tue Nov 09, 2010 1:44 pm

Re: Real-life economics

Post by Zireael »

Love the idea, going to grab it...
User avatar
Phasted
Competent
Competent
Posts: 51
Joined: Wed Jun 09, 2010 3:56 pm

Re: Real-life economics

Post 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:
Last edited by Phasted on Fri May 18, 2012 1:57 pm, edited 1 time in total.
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: Real-life economics

Post 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
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
Phasted
Competent
Competent
Posts: 51
Joined: Wed Jun 09, 2010 3:56 pm

Re: Real-life economics

Post 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.
Last edited by Phasted on Fri May 18, 2012 1:59 pm, edited 3 times in total.
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16081
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: Real-life economics

Post 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).
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Re: Real-life economics

Post 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.
User avatar
Phasted
Competent
Competent
Posts: 51
Joined: Wed Jun 09, 2010 3:56 pm

Re: Real-life economics

Post 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.
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Real-life economics

Post 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...
Post Reply