Cargo Space Refit - apparent bug

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

Moderators: another_commander, winston, Getafix

Post Reply
DaveMatthews
Mostly Harmless
Mostly Harmless
Posts: 3
Joined: Sun Jan 21, 2024 11:26 am

Cargo Space Refit - apparent bug

Post by DaveMatthews »

Hi folks!

I'm new to Oolite - and loving it!

I seem to have uncovered a problem with the Cargo Space Refit ("CSR") feature. This is the one which doubles the capacity of your cargo bay. In my case I'm flying the usual Cobra Mark III and, having previously expanded it to 35 TC, I have now purchased the CSR to give me 70 TC capacity...

All was working fine with that, with me saving the game - as a new save file each time as I like to keep some old ones - every few planet hops. However when I exited the game and returned to it later, upon loading up my last save file, the cargo capacity has dropped back to 35 TC. I checked my inventory and the CSR is still present in the ship...

I inspected my save files and discovered something odd. In the first few that I saved after purchasing the CSR, the <max_cargo> value is set as 70, as you'd expect. However if I exit the game and later restart it and load the latest save, although the <max_cargo> figure still says 70 in the save file, on-screen Oolite informs me that I actually have 105 TC capacity! I guess this is a bug in which the cargo bay's earlier 35 TC capacity and the new 70 TC capacity have been inadvertently added together by the game (35 + 70 = 105). And indeed the game does allow me to store more than 70 TC in the cargo bay. Subsequent saves actually write a value 105 for the <max_cargo> element in the save file - and it's when I subsequently exit the game again, restart it and re-load that latest save file that the capacity has dropped back to 35 TC...

Checking the log file from loading that latest save, I can also see the following:

WARNING: player ship Cobra Mark III had more cargo (72) than it can hold (35). Removing extra cargo.

*** EDITED TO ADD: I'm running the OXZ version of the expansion, oolite.oxp.Reval.Cargo_Space_Refit.oxz - rather than the OXP version. When I get a chance, I'll try removing the OXZ and install the OXP instead.

---------------------------------------------------
Oolite version: version 1.90 (x86-64)
Windows version: 10.0.19045.3324 64-bit
CPU: AMD Ryzen 5 3500X 6-Core Processor
Build options: OpenAL, new planets.
---------------------------------------------------

Many thanks!

Dave Matthews
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4612
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Cargo Space Refit - apparent bug

Post by phkb »

Welcome aboard, commander! It's great you're enjoy the game so much.
DaveMatthews wrote: Sun Jan 21, 2024 12:02 pm
inspected my save files and discovered something odd. In the first few that I saved after purchasing the CSR, the <max_cargo> value is set as 70, as you'd expect. However if I exit the game and later restart it and load the latest save, although the <max_cargo> figure still says 70 in the save file, on-screen Oolite informs me that I actually have 105 TC capacity! I guess this is a bug in which the cargo bay's earlier 35 TC capacity and the new 70 TC capacity have been inadvertently added together by the game (35 + 70 = 105). And indeed the game does allow me to store more than 70 TC in the cargo bay. Subsequent saves actually write a value 105 for the <max_cargo> element in the save file - and it's when I subsequently exit the game again, restart it and re-load that latest save file that the capacity has dropped back to 35 TC...
I can see in the code there might be multiple points at which the cargo space doesn't get allocated correctly with this OXP. OXP's that play around with the cargoSpaceCapacity property of the player ship often end up fighting with the core game for control of the property! And depending on the order of events, it could result in cargo being lost.

I'll give the author of the OXP (Reval) a chance to address the issues, before jumping in on this one.
DaveMatthews wrote: Sun Jan 21, 2024 12:02 pm
*** EDITED TO ADD: I'm running the OXZ version of the expansion, oolite.oxp.Reval.Cargo_Space_Refit.oxz - rather than the OXP version. When I get a chance, I'll try removing the OXZ and install the OXP instead.
It shouldn't matter which version of the mod you use - they would be functionally identical. Although, running as an OXP might change the order in which things run, so you might see different results.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4612
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Cargo Space Refit - apparent bug

Post by phkb »

I've just pushed updates to the Goods Containers OXP and the Cargo Pods OXP to the Expansion Manager, to fix a couple of bugs/issues.

But here is the important one: CargoSpaceCorrection.oxz.
Download that OXP and put it in your AddOns folder. This mod will basically recalculate the correct cargo space, after all the goods containers, pods and refits are installed, and the restore any cargo you might have lost during the standard loading process. This should make the cargo space modifications work successfully, regardless of the order of events. Let me know how it goes.
Last edited by phkb on Fri Feb 09, 2024 2:33 pm, edited 1 time in total.
User avatar
hiran
Theorethicist
Posts: 2026
Joined: Fri Mar 26, 2021 1:39 pm
Location: a parallel world I created for myself. Some call it a singularity...

Re: Cargo Space Refit - apparent bug

Post by hiran »

While it is pretty cool that the expansion system can even be used to fix stuff somehow I believe such a bugfix should go into the core game.

How does this OXP handle different load sequences?
Sunshine - Moonlight - Good Times - Oolite
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4612
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Cargo Space Refit - apparent bug

Post by phkb »

hiran wrote: Mon Jan 22, 2024 5:56 am
How does this OXP handle different load sequences?
By bypassing the sequence entirely. It waits until all the startUp and startUpComplete events have fired (which is usually where the cargo space is changed) and then recalculates the correct space based on installed equipment, and updates the value again. And then it forces all the cargo back to the values stored when it was last saved.
hiran wrote: Mon Jan 22, 2024 5:56 am
I believe such a bugfix should go into the core game.
Not sure. Based on what Dave observed, there appears to be a small variation in the way cargo space is applied if you load a game after restarting the entire game, and if you're reloading from an existing game (or at least, that's what I read into Dave's comments). I'd need to do some tests to see if I can observe anything that can be patched.
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4612
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Cargo Space Refit - apparent bug

Post by phkb »

Anyone who downloaded version 1 of the CargoSpaceCorrection OXP should download it again - same link - to get version 1.1, which fixes an issue with equipment items that take up cargo space.
DaveMatthews
Mostly Harmless
Mostly Harmless
Posts: 3
Joined: Sun Jan 21, 2024 11:26 am

Re: Cargo Space Refit - apparent bug

Post by DaveMatthews »

Thanks for all that! So I've downloaded that OXP and put it in my AddOns but things got even weirder! I went back to an earlier save where I legitimately just had the 35 TC capacity and then purchased the Refit. It then shows 70 TC as expected, so I bought 70 TC of goods...

However when I save the game again at that point, exit it and then restart it, despite the save file saying that max_cargo is 70, as expected, the Market and Manifest screens both tell me the capacity is only 55 TC ?! Also, the log file says:

"[setCommanderDataFromDictionary.inconsistency.cargo]: ----- WARNING: player ship Cobra Mark III had more cargo (70) than it can hold (35). Removing extra cargo."

Yet rather than trimming down the cargo in the hold to 35 TC's worth, it actually trims it down to 55 TC's worth.

So however the game is deciding to reduce capacity to the 55 TC, it makes the problem even more obscure! :D

I then tried the exercise again but this time I didn't purchase any goods as I wondered if perhaps the bug was only triggered if there was stuff in the cargo bay. But no, I still got the drop from 70 TC to 55 TC on exit / restart / reload.

Is there an expansion pack that perhaps I should have uninstalled first?

--

Many thanks!

Dave
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4612
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Cargo Space Refit - apparent bug

Post by phkb »

A standard Cobra MKIII has 20TC of cargo capacity. Applying the refit to this ship will change the capacity to 40TC. Subsequently adding the Large Cargo Bay adds 15 and takes the total to 55TC.

When I start again, and add the Large Cargo Bay first, the total is now 35TC. Adding the refit to a Cobra MKIII in this state takes the total to...55TC.

The upshot is, 55TC is the *correct* value the refit should have applied (and does, if you haven't done anything else). The value of 70TC is a bug.

What you should notice from this point on, if you keep the CargoSpaceCorrection OXP installed, is that there are now no unexpected changes to the size of your cargo space. It should be consistent after every reload.
DaveMatthews
Mostly Harmless
Mostly Harmless
Posts: 3
Joined: Sun Jan 21, 2024 11:26 am

Re: Cargo Space Refit - apparent bug

Post by DaveMatthews »

OK, thanks for the explanation...

So the upshot is that the refit gives me an extra 20 TC. So should that cost me 20 TC x 500 Cr = 10,000 Cr ? I'm actually being charged 17,500 Cr - ie 35 TC x 500 Cr.

--

Thanks!

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

Re: Cargo Space Refit - apparent bug

Post by Cholmondely »

DaveMatthews wrote: Tue Jan 23, 2024 10:27 am
So the upshot is that the refit gives me an extra 20 TC. So should that cost me 20 TC x 500 Cr = 10,000 Cr ? I'm actually being charged 17,500 Cr - ie 35 TC x 500 Cr.
Sir Dave,

I don't think that that is the way it works.

Just as the Vanilla Game equipment ("Cargo Bay Expansion") costs a paltry 400₢ for almost doubling your cargo bay (adding in another 15TC), so too the Cargo Space Refit costs another 500₢ to add another 35TC.

If you have truly been charged 17,500₢ then you have been well and truly diddled. There are some shipyards that treble the costs of equipment (Rock Hermits, Galactic Navy shipyards, etc.). But that is a 35-fold increase.


An infestation of bugs? An unintended result of an unannounced proclivity to fiddle with dark side .plists? Some murky pit of degenerate ship's chandlers that only you have managed to unearth in the Ooniverse?

I think we should be told!
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?
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4612
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: Cargo Space Refit - apparent bug

Post by phkb »

Cholmondely wrote: Tue Jan 23, 2024 12:13 pm
I don't think that that is the way it works.
Actually, according to the wiki, that is exactly the way it's supposed to work:
For the work, you will be charged 500 cr per TC of your vessel's nominal capacity
DaveMatthews wrote: Tue Jan 23, 2024 10:27 am
So the upshot is that the refit gives me an extra 20 TC. So should that cost me 20 TC x 500 Cr = 10,000 Cr ? I'm actually being charged 17,500 Cr - ie 35 TC x 500 Cr.
Yep, the OXP is buggy. It's not calculating your "nominal" capacity correctly. So, as Cholmondely says, you have been diddled, not quite as much as he says, but still around 7500cr.
Post Reply