Cargo decays from overloaded stations
Sidenote: An oil rig is a 'station' of sorts, it includes a neutral dock and helipad all companies can use.
The reasons for this mechanic include three things:
- Game stability Too many cargo packets slows down the game
- Protection from integer overflow. Only so much cargo fits in the savefile/spec
- Clearing unused stations. When no vehicles arrive for years on end, the station is abandoned.
Station cargo is last I checked stored as a 2-byte number, which supports between 0 and 65535 for each cargotype.
The precise answer can be found on the official wiki, if you carefully read the section on station rating mechanics, as well as in the code. The exact code can be found here.
When you have a very large amount of cargo waiting at a station, it will eventually lower the station's rating below the threshold value where cargo will naturally start to decay. This is by default 50%. The decay rate increases as the rating goes down further.
The cargo decay process
The natural decay rate is a random value clamped via bitwise AND between 0 and 31 units of cargo every 185 game ticks if the rating is below 25% and you have at least 200 units waiting but less than 4,096.
Then, if there are more then 0 units waiting and the rating is below 50%, between 0 and 3 units will additionally be removed randomly.
Then, if there are more than about 4,000 units remaining, the game will decay your cargo much faster; at 1/64th of the total stored above 4,000.
Finally, if you somehow manage to out-pace this decay rate too, the game will remove any amount of cargo above 32,767
0x8FFF as overflow protection.
You can also use this table:
| Rating | Amount waiting | Decay rate (per 185) |
| <25% | >100 | 0-31 |
| <50% | >0 | 0-3 |
| any | >4096 | (x-4096)/64 |
| any | >32767 | (x-32768) |
So, in your specific case, the first two lines applied. Apparently the computer rolled say
22 + 2 = 24 and removed 24,000 litres of oil (each unit of oil is represented as 1,000 litres or 1 m3 in game).
How to solve your problem
This might be all fine and good, but how do you solve your problem of losing (leaking?) precious oil?
The answer is not to let too much stuff sit in a station. As long as fewer than 4,096,000 litres of oil are in the station and the rating is 50% or higher, no oil is lost. So you could engineer a situation in which your rating is kept at this amount by various methods.
For example, you could found a town on a little manmade islet at your transfer point and build a dock and statue there. Then, you can use periodic advertisement campaigns to boost the rating. There are openTTD patches / alternative clients that can automatically keep up advertising so you don't have to do it manually.
The net effect is to raise the storage cap before losses start to happen to 4,096,000 litres.
This is quite an expensive solution. With the default relatively low operating costs, it's likely1 cheaper to just do this:
Buy more big tankers, in your case have at least two. Make sure that the place where the tankers load always has at least one tanker waiting there.
The default rating algorithm is known to be a bit wonky and weird. It's one of the game's leftovers from the original Chris Sawyer version (handcoded assembly). In 286/386 computers, cycles and bytes are both expensive.
A few newGRF authors have bothered to update some of the rating algorithm's specifics. Here's one that just alters the ratings. You can configure it to force cargo ratings to 100%, which stops decay until 4,096,000 litres are piled up.
1) If you've turned on "Inflation" in economy settings or have newGRF multipliers to ship prices and/or running costs, that might change the math here in favour of solution I.