Cargo Contracts MOD for Oolite v1.77 and v1.79!
Moderators: winston, another_commander, Getafix
Re: Cargo Contracts MOD for Oolite v1.77 and v1.79!
Yes, Cargo Contracts Mod seems broken in some ways when attempting to use it with Oolite v1.80 and later.
I may try to make a later version, but I still cannot figure out how to generate lowest and highest possible prices for a remote system or even the system I'm in!
Instead i get a bunch of sample prices and just pick the lowest and highest ones of the bunch.
I may try to make a later version, but I still cannot figure out how to generate lowest and highest possible prices for a remote system or even the system I'm in!
Instead i get a bunch of sample prices and just pick the lowest and highest ones of the bunch.
Re: Cargo Contracts MOD still broken!
Now using Oolite v1.88!
I still cannot figure out how to generate lowest and highest possible prices for a remote system or even the system I'm in!
Instead i get a bunch of sample prices and just pick the lowest and highest ones of the bunch.
Lowest price for starting system, highest price at destination.
Subtract starting cost from destination amount to get "max" profit, which can be pretty pathetic because even 20 random samples may not be within 90% of the real max or min.
I have to use an arbitrary money cheat to make this work -- multiply the profit results by up to 150% for high cargo reputation, which even still may be less than theoretical max profit.
I still cannot figure out how to generate lowest and highest possible prices for a remote system or even the system I'm in!
Instead i get a bunch of sample prices and just pick the lowest and highest ones of the bunch.
Lowest price for starting system, highest price at destination.
Subtract starting cost from destination amount to get "max" profit, which can be pretty pathetic because even 20 random samples may not be within 90% of the real max or min.
I have to use an arbitrary money cheat to make this work -- multiply the profit results by up to 150% for high cargo reputation, which even still may be less than theoretical max profit.
Re: Cargo Contracts MOD for Oolite v1.77 and v1.79!
This mod is still broken, as my workaround causes multi-second-long game freezes on entering a system as it tries to calculate new cargo contracts using a loop that makes 100+ very slow Oolite library calls.
The workaround also is less profitable than the original was.
The workaround also is less profitable than the original was.
- hiran
- Theorethicist
- Posts: 2410
- Joined: Fri Mar 26, 2021 1:39 pm
- Location: a parallel world I created for myself. Some call it a singularity...
Re: Cargo Contracts MOD for Oolite v1.77 and v1.79!
Would it be feasible to trigger a thread on entering a system, and this thread would run the 100+ Oolite calls in it's own time, while the original thread returns and allows the game to move on? I doubt a player needs all contracts in the event the ship emerges from witchspace.Switeck wrote: ↑Wed Nov 24, 2021 11:39 pmThis mod is still broken, as my workaround causes multi-second-long game freezes on entering a system as it tries to calculate new cargo contracts using a loop that makes 100+ very slow Oolite library calls.
The workaround also is less profitable than the original was.
Sunshine - Moonlight - Good Times - Oolite
Re: Cargo Contracts MOD for Oolite v1.77 and v1.79!
I wouldn't know.
Most of my modified cargo contract .js file is identical to the original file due to my limited programming skills.
I'm vaguely familiar with callback: function ...but only because I've seen it in a couple other OXP's .js files.
There is internal logic for this that is .js accessible that would be much faster...I just can't get it to work.
Most of my modified cargo contract .js file is identical to the original file due to my limited programming skills.
I'm vaguely familiar with callback: function ...but only because I've seen it in a couple other OXP's .js files.
There is internal logic for this that is .js accessible that would be much faster...I just can't get it to work.
- hiran
- Theorethicist
- Posts: 2410
- Joined: Fri Mar 26, 2021 1:39 pm
- Location: a parallel world I created for myself. Some call it a singularity...
Re: Cargo Contracts MOD for Oolite v1.77 and v1.79!
I am no JavaScript expert. But Google brought me toSwiteck wrote: ↑Tue Nov 30, 2021 4:24 amI wouldn't know.
Most of my modified cargo contract .js file is identical to the original file due to my limited programming skills.
I'm vaguely familiar with callback: function ...but only because I've seen it in a couple other OXP's .js files.
There is internal logic for this that is .js accessible that would be much faster...I just can't get it to work.
https://stackoverflow.com/questions/737 ... new-thread
Maybe that helps?
Sunshine - Moonlight - Good Times - Oolite
Re: Cargo Contracts MOD for Oolite v1.77 and v1.79!
The script already does something like that.
Re: Cargo Contracts MOD for Oolite v1.77 and v1.79!
Here is the testing form of my Cargo Contracts MOD for Oolite v1.8 and later:
Oolite Cargo Contract Mod Script
https://controlc.com/6b7a3bfe
It is set to try to return 20 cargo contracts at every system, does not try to pick sensible commodities, and does not try to pick sensible or nearby destinations.
This is strictly for testing, with most of the important results in Oolite's Latest.log file.
It no longer gets NaN (Not a Number) errors or Division By Zero errors...but the prices generated using efactor for commodities is still obviously wrong.
Oolite Cargo Contract Mod Script
https://controlc.com/6b7a3bfe
It is set to try to return 20 cargo contracts at every system, does not try to pick sensible commodities, and does not try to pick sensible or nearby destinations.
This is strictly for testing, with most of the important results in Oolite's Latest.log file.
It no longer gets NaN (Not a Number) errors or Division By Zero errors...but the prices generated using efactor for commodities is still obviously wrong.
- Cholmondely
- Archivist
- Posts: 5381
- 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!
Can I do anything to help?
GalCop Health Warning: In an entire year and a half of play I've taken one parcel contract (but failed to get there on time) and no cargo/passenger contracts. And three of Phkb's GalCop contracts (black boxes and stuff - and flubbed one of those too!), and the Start Advice.oxp mission!
GalCop Health Warning: In an entire year and a half of play I've taken one parcel contract (but failed to get there on time) and no cargo/passenger contracts. And three of Phkb's GalCop contracts (black boxes and stuff - and flubbed one of those too!), and the Start Advice.oxp mission!
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?
•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?
Re: Cargo Contracts MOD for Oolite v1.77 and v1.79!
When testing cargo contracts, it's helpful to have both a ship capable of carrying a LOT of stuff and also being able to easily/quickly jump everywhere using cheats. LongRangeScanner OXP (found at https://app.boxcn.net/s/bpl582x1hu ) is just the sort of cheat to have to do this...but I use others as well.
But even if you play at all and don't do any cargo contracts, if you have that script loaded into Oolite...it will generate latest.log information for cargo contracts every time you jump to a new system. Has to do it even if you don't visit the main station because I found an exploit for that by reloading from savegame to get the contracts I wanted.
Still, the Latest.log won't be terribly useful...since I already know the estimates for commodities prices are wrong.
But even if you play at all and don't do any cargo contracts, if you have that script loaded into Oolite...it will generate latest.log information for cargo contracts every time you jump to a new system. Has to do it even if you don't visit the main station because I found an exploit for that by reloading from savegame to get the contracts I wanted.
Still, the Latest.log won't be terribly useful...since I already know the estimates for commodities prices are wrong.
Re: Cargo Contracts MOD for Oolite v1.77 and v1.79!
Now the updated Oolite Cargo Contract Mod Script for Oolite v1.80 or later...Switeck wrote: ↑Wed Dec 29, 2021 8:31 amHere is the testing form of my Cargo Contracts MOD for Oolite v1.80 and later:
Oolite Cargo Contract Mod Script
https://controlc.com/6b7a3bfe
It is set to try to return 20 cargo contracts at every system, does not try to pick sensible commodities, and does not try to pick sensible or nearby destinations.
This is strictly for testing, with most of the important results in Oolite's Latest.log file.
It no longer gets NaN (Not a Number) errors or Division By Zero errors...but the prices generated using efactor for commodities is still obviously wrong.
https://controlc.com/5456e0c0
It should be a fully-working script...but still uses the slow looping method for comparing to the new method.
It tries to pick sensible commodities and tries to pick sensible destinations.
It is for testing but should be useful as a replacement for the original cargo contract script.
It still logs a lot of info to Oolit's Latest.log file...but understanding the output isn't a given.
The "PrDif=" value in the Latest.log file entries for it should show whether the new profit method you helped me build is more profitable than the original method used by the game.
Positive = mine is more profitable, Negative = original method was more profitable
What remains for me to do is remove the old profit-calculating methods, clean up the script of other now-irrelevant parts, and hopefully get it turned into an OXZ.
Anyone trying this?
- Cholmondely
- Archivist
- Posts: 5381
- 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!
I'm a dumb pilot rather than a programmer.
What should I be doing with the script?
What should I be doing with the script?
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?
•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?
Re: Cargo Contracts MOD for Oolite v1.77 and v1.79!
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.
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.
Re: Cargo Contracts MOD for Oolite v1.77 and v1.79!
Once you're satisfied it does what you want it do, I could help you optimize the code to get rid of part of the long freezes. Many oxp's do heavy lifting when exiting witchspace; it's not just you. Try testing with most of your oxp's removed and it's not so bad. I profiled
_initialiseCargoContractsForSystem
and it took about 200 ms (1/5 sec).By caching the static references, I was able to reduce execution time by about 20%. More savings could be realized by spreading out the workload. You don't need all the contracts the instant you exit witchspace. The work can be done in chunks spread over a few seconds w/ a Timer (or over frames using a frameCallback, which is probably overkill in this situation).
"Better to be thought a fool, boy, than to open your trap and remove all doubt." - Grandma [over time, just "Shut your trap... fool"]
"The only stupid questions are the ones you fail to ask." - Dad
How do I...? Nevermind.
"The only stupid questions are the ones you fail to ask." - Dad
How do I...? Nevermind.
Re: Cargo Contracts MOD for Oolite v1.77 and v1.79!
The slow looping part is where it uses random price checks to try to find the lowest and highest prices.
I'll be removing that part in final release, which should greatly reduce the slowdowns.
They're just still in the script for legacy checking reasons...to make sure the new method is always better/more profitable.
I'll be removing that part in final release, which should greatly reduce the slowdowns.
They're just still in the script for legacy checking reasons...to make sure the new method is always better/more profitable.