Cargo Contracts MOD for Oolite v1.77 and v1.79!

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

User avatar
Cholmondely
Archivist
Archivist
Posts: 5364
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Cargo Contracts MOD for Oolite v1.77 and v1.79!

Post by Cholmondely »

Switeck wrote: Sun Jan 02, 2022 11:00 pm
You have to save the contents of the script into:
oolite-contracts-cargo.js
...which on my computer is found inside:
C:\Oolite\oolite.app\Resources\Scripts

Make a copy/Back up the original before you do.
I'm on an AppleMac, where the important stuff is all hidden from view from us ignorant oiks by the all-knowing near-godly geniuses... While I've got the magic pathway to find the invisible latest.log, I can't find anything else, certainly not oolite-contracts-cargo.js ... just the various AddOns folders and the Application itself with nothing else apparent.

What should I do? I'm stumped, Araminta has gone off for cocktails with Arabella and Augusta, Benedict has fled (on holiday hunting Killer Mountain Seoids with his blunderbuss up in the foothills above Lesser Walsingham), cousin Digby is deeply distracted by a bout of Extreme Dominoes up on the terraces with Great-Aunt Gertrude (and bluntly refuses to have anything to do with it)...
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: Cargo Contracts MOD for Oolite v1.77 and v1.79!

Post by Switeck »

Since I don't use an AppleMac, I can't help you there.

No wonder you wanted me to turn my OXPs into OXZs...including this, no doubt.
User avatar
Cholmondely
Archivist
Archivist
Posts: 5364
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Cargo Contracts MOD for Oolite v1.77 and v1.79!

Post by Cholmondely »

Switeck wrote: Mon Jan 03, 2022 1:17 pm
Since I don't use an AppleMac, I can't help you there.

No wonder you wanted me to turn my OXPs into OXZs...including this, no doubt.
Nope. OXZ's can be easily stored on our wiki and then easily downloaded from there. That is the one and only reason for turning oxp's into oxz's if you don't intend to put them on the in-game Expansions Manager.

As regards this, maybe it is a doddle to change the vanilla game code in windows and linux. I wouldn't know. But one seems to need to have embraced the Dark Side in order to do so on the AppleMac.

Did you have a good X-mas/New Year?
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: Cargo Contracts MOD for Oolite v1.77 and v1.79!

Post by Switeck »

Not really, Covid happened to friends and family and I have to wonder if the "little bit sick" I feel is something worse than usual.

Btw, did you get my private messages over the last week?
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4830
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Cargo Contracts MOD for Oolite v1.77 and v1.79!

Post by phkb »

To turn this into an OXP, and in doing so replacing the core Oolite contracts system, all it needs to do is have the same filename as the core Oolite file. Otherwise, all the standard OXP requirements remain unchanged. When Oolite opens and reads all the script files, the core script file will be overwritten by this new one, and it all should be fine from there.
User avatar
Cholmondely
Archivist
Archivist
Posts: 5364
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: Cargo Contracts MOD for Oolite v1.77 and v1.79!

Post by Cholmondely »

Switeck wrote: Mon Jan 03, 2022 7:22 pm
Not really, Covid happened to friends and family and I have to wonder if the "little bit sick" I feel is something worse than usual.

Btw, did you get my private messages over the last week?
Sorry to hear that. What a dreadful start to the year.

Wishing you and yours better!

Yes, of course I got your messages, thank you! I need to print them out so I can fillet them for the programming nuggets!

Have you checked this over? Do I need to change anything?

I've tried to link it in to some of the other relevant wiki pages, but have yet to create the tagged redirects so that they show up on the Category:Equipment OXPs & Category:Equipment pages.
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: Cargo Contracts MOD for Oolite v1.77 and v1.79!

Post by Switeck »

No doubt I'm sick now, but only about as bad as a cold. Pfizer vaccine probably helped.

There is not so much programming nuggets in my PMs to you as trying to convey the extreme bunch of ideas that I'm "throwing into" Cargo Contracts Mod. Taxes, hidden fees, security deposit, "new math", achieving profitability, beating the original formula despite using far more restricted price limits, etc.

The original core game contracts decreases the buying price by as much as 35% and increases the selling price by as much as 17.5%...then a big chunk of that is lost to shipping companies taking their "cut"/share. At long distances, they only take 10% but up close you can be paid as little as 13%!

Even worse, to make cargo contracts harder, the original had a "safety: now multiply the fee by 2 compared with 1.76 contracts prevents exploit discovered by Mad Hollander at"
https://bb.oolite.space/viewtopic.php?p=188127

It's pretty easy for my method to be more profitable than the original if there's only 1 or 2 jumps. But if there's 10 or more jumps and the amount is over 350 (for 35% bonus), it's near-impossible to be as profitable.


The Switeck bio looks good. I'm just a crotchy old rock hermit that's lost his mind jumping through witchspace way too many times...and experienced the madness that comes with it. I've even done 12-14 L.Y. individual hyperspace jumps in earlier versions of Oolite without changing the core game code. Silly, but useless. Misjumping is where the madness sets in...

I still have not formalized the code necessary to find the fastest misjump route. Pretty sure that'd require the use of infinitesimals in Calculus to get the exact answer.
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: Cargo Contracts MOD for Oolite v1.77 and v1.79!

Post by Cody »

Switeck wrote: Tue Jan 04, 2022 4:09 pm
... lost his mind jumping through witchspace way too many times...and experienced the madness that comes with it.
Misjumping is where the madness sets in...
<nods sagely>
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!
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: Cargo Contracts MOD for Oolite v1.80 and later!

Post by Switeck »

And here's the latest version of the Cargo Contract script:
https://controlc.com/2ce09d67

...THIS version removes the looping to find highest/lowest prices and eliminates about 6 local variables as well.

It still includes the core game formulas for calculating prices+profits for comparison and use if profit is really low...but because the destination price used is the highest possible will result in higher profits when my method is too low (like <2000 if your cargo contract reputation is decent).

For comparison, earlier versions are at:
https://controlc.com/6b7a3bfe
https://controlc.com/5456e0c0
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: Cargo Contracts MOD for Oolite v1.77 and v1.79!

Post by Switeck »

One of the big hold-ups I'm having right now is the quandary of what to do to either prevent (choose a different system, requiring more looping) or work with (less profitable, at least for the highly variable commodities...pure loss for something like computers/luxuries) "Wrong way" trading -- like trying to take Furs from a Rich Industrial system to anywhere.

The rules kinda reverse when you get high enough reputation to start getting Gold/Platinum/Gems contracts -- because they are always "Wrong way" trading if you get them at Rich Industrial systems!

At (very?) negative reputation, low-profit + very-long-range contracts are not a bug but a feature, so I don't have to worry about them.

The intermediate-level reputations are where I have to have the most complex logic to avoid very low profit results.
Is same-type economy good enough?
What about differing by only 1 economic type, such as Rich Industry to Average Industry?

I'm also making it range-dependent -- if the destination can be reached in 1 jump, a low profit isn't as much of an issue.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: Cargo Contracts MOD for Oolite v1.77 and v1.79!

Post by Switeck »

Another updated version of the Cargo Contract script:
https://controlc.com/3a1e8043

This has reduced variation between lowest and highest profits.
Extremely negative reputation or short distances isn't as likely to wipe out almost all the profits...
...but on the opposite side of that spectrum, very positive reputation doesn't always guarantee max profit if the cargo contract is small and only 1 jump away. It's still 90-99% of max though.
User avatar
szaumix
Deadly
Deadly
Posts: 171
Joined: Sun Apr 24, 2022 4:23 am

Re: Cargo Contracts MOD for Oolite v1.77 and v1.79!

Post by szaumix »

Oh man am I ever super interested in this. I've considered cargo contracts as an idea several times before but never found anything.. wait maybe I saw this but didn't install for I forget what reasons, something about it I didn't like the sound of despite the overall idea.

How close to finished is this and what kind of bug/balance testing are you looking for? Are you still unsure about anything or still working on anything?
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: Cargo Contracts MOD for Oolite v1.77 and v1.79!

Post by Switeck »

Cargo Contracts are already a part of the core game.
My mod is an attempt to game-balance them.

This is semi-close to being finished.
What it needs is testing!
See the script I released in my previous post?
...replacing your original oolite-contracts-cargo.js (found in C:\Oolite\oolite.app\Resources\Scripts typically for PCs) with that modified script is all you need to do to install it, although it helps to save a copy of the original before you do.

You need to have a good understanding of the original commodities market in Oolite for most of the cargo contracts changes I did to make sense.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: Cargo Contracts MOD for Oolite v1.77 and v1.79!

Post by Switeck »

Latest updated version of the Cargo Contract script:
https://controlc.com/076f245d

This one uses a slightly more complex method for choosing which commodity for a cargo contract, with very negative reputation using a "pick anything" list.

Max unitsize for Gold/Platinum/Gemstone contracts also doesn't get larger past 10 jumps, so a 15+ jump distance route doesn't create a contract size of 30,000+ g of gemstones for >1/2 million profit.

I'm still seeing 100,000+ credits profit Platinum and Gemstones contracts...and perhaps still too often.
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: Cargo Contracts MOD for Oolite v1.77 and v1.79!

Post by Switeck »

Latest updated version of the Cargo Contract script:
https://controlc.com/464d29c0

I simplified the profit calculation slightly (fewer lines of code).

Original-style Gold/Platinum/Gemstones cargo contracts get a calculated discount bonus based on their base amount rather than their boosted unitsize.

They were unfairly almost always at 35% discount... when the only other contracts to get a 35% discount were huge contracts that only an Anaconda could carry.
This change matters little, since my profit method (based on max - min price differences) has long been used for Gold/Platinum/Gemstone contracts...unless profit is <100 credits, which should be almost impossible.

I have already removed earlier alternate profit methods, so in future versions I may remove the original-style method as well.
Post Reply