Stockpile limit
Moderator: OpenTTD Developers
Stockpile limit
I've recently been playing around with industry stockpiles (and having some success). I'm wondering if there's a limit to how large a stockpile can become at an industry?
Through occasional coding errors, I've seen 2.5m litres of alcohol at a hotel (firs based) so the limit must be higher than that, but how high? Also, does the game simply 'vanish' excess stock or does the game crash?
I wouldn't envisage huge stockpiles of cargos but I've been surprised how quickly it can build up. I'm presuming the stockpile limits are per cargo per industry.
Through occasional coding errors, I've seen 2.5m litres of alcohol at a hotel (firs based) so the limit must be higher than that, but how high? Also, does the game simply 'vanish' excess stock or does the game crash?
I wouldn't envisage huge stockpiles of cargos but I've been surprised how quickly it can build up. I'm presuming the stockpile limits are per cargo per industry.
Re: Stockpile limit
AFAIK, it is 32ku or 64 ku, I observed than if it is overloaded, strange things happen (probably sign byte is changed).3iff wrote:I've recently been playing around with industry stockpiles (and having some success). I'm wondering if there's a limit to how large a stockpile can become at an industry?
In manpower industry set I had dynamically changed consumption rate, more stockpile, higher consumption (and production),
but I underestimated players which was able to push large amounts of supplies and overload stockpile.
Now most of the manpower industries have hardcoded stockpile level limit below 32000 units.
It is much higher than in case of ECS, therefore it is not really an issue in case of simple supply chain, but make pushing many sources into one drain more challenging (on the other hand, with manpower option, you have ability to control production level, therefore you can somewhat overcome stockpile saturation by decreasing source production).
To avoid problems with cargodist link graph refreshing and flickering of station messages, there is hysteresis loop (acceptance cut off level is higher than acceptance restore level).
PS. 2.5 Ml equal 2500 units.
Formerly known as: McZapkie
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, wired, ECS industry extension, V4 CEE train set, HotHut.
Another favorite games: freeciv longturn, OHOL/2HOL.
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, wired, ECS industry extension, V4 CEE train set, HotHut.
Another favorite games: freeciv longturn, OHOL/2HOL.
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Stockpile limit
The limit is word size, thus 0xFFFF or ~65k. The internal volume unit is m^3 instead of the usual display unit litres, thus the limit for those is 65.535.000 litres3iff wrote:I've recently been playing around with industry stockpiles (and having some success). I'm wondering if there's a limit to how large a stockpile can become at an industry?
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: Stockpile limit
Thanks both.
What happens if that's exceeded, strange things?
How can I set stockpile limits (just point me in the right direction?). My industry set is fairly low production so I doubt I would get such quantities...but you never know.
(I use litres because it's more convenient than the imperial choice, but everything else is imperial...it's mad! )
What happens if that's exceeded, strange things?
How can I set stockpile limits (just point me in the right direction?). My industry set is fairly low production so I doubt I would get such quantities...but you never know.
(I use litres because it's more convenient than the imperial choice, but everything else is imperial...it's mad! )
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Stockpile limit
The math is found in DeliverGoodsToIndustry in economy.cpp:10353iff wrote:Thanks both.
What happens if that's exceeded, strange things?
How can I set stockpile limits (just point me in the right direction?). My industry set is fairly low production so I doubt I would get such quantities...but you never know.
The stockpile is internally capped to the limit. The industry will accept exactly up to the limit, and then the 2nd nearest industry is delivered and so forth. The rest of the not accepted cargo is IIRC discarded if any cargo at all was accepted (but that would need checking).
In NewGRFs you set a lower stockpile limit by checking for the current stockpile and denying cargo acceptance when the stockpile exceeds the amount you define as 'your' stockpile limit:
You check in callback 'stop_accept_cargo' for waiting_cargo_1/2/3. Make sure to synchronize that with the callback 'cargo_amount_accept' for the corresponding industry tiles: http://newgrf-specs.tt-wiki.net/wiki/NML:Industries
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Re: Stockpile limit
I had production level depending on stockpile amount, and observed low values of production level when stockpile reach its limit3iff wrote: What happens if that's exceeded, strange things?
(looks like stockpile was treated like negative number, but I didn't analysed it deeply).
If you are using nml, you can refer for example here:3iff wrote: How can I set stockpile limits (just point me in the right direction?).
http://dev.openttdcoop.org/projects/man ... wmill.pnml
here are two switches, mentioned by planetmaker, for tile itself and for whole industry.
Formerly known as: McZapkie
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, wired, ECS industry extension, V4 CEE train set, HotHut.
Another favorite games: freeciv longturn, OHOL/2HOL.
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, wired, ECS industry extension, V4 CEE train set, HotHut.
Another favorite games: freeciv longturn, OHOL/2HOL.
Re: Stockpile limit
that must have been a change in behaviour. back when i was using PBI, the remaining cargo was dumped at the station, where it could be loaded back into the vehicle.planetmaker wrote:The rest of the not accepted cargo is IIRC discarded if any cargo at all was accepted (but that would need checking).
Re: Stockpile limit
Thanks everyone. I use NML. I'm slowly getting to grips with it.
Is the other one NFO? It scared the hell out of me!
Is the other one NFO? It scared the hell out of me!
Re: Stockpile limit
It works if there is acceptance limit switch implemented, we are discussing case without stockpile limit coded into newgrf.Eddi wrote:that must have been a change in behaviour. back when i was using PBI, the remaining cargo was dumped at the station, where it could be loaded back into the vehicle.
BTW, I just realised, that I reinvented the wheel - UK Renewal Industry Set had very similar functionality of steel mill like manpower has.
Formerly known as: McZapkie
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, wired, ECS industry extension, V4 CEE train set, HotHut.
Another favorite games: freeciv longturn, OHOL/2HOL.
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, wired, ECS industry extension, V4 CEE train set, HotHut.
Another favorite games: freeciv longturn, OHOL/2HOL.
Re: Stockpile limit
Well the stockpile system is working well. I'm surprising myself!
I now have a problem where I want to put some extra text into the industry window. I already have a brief description in the lang file...
STR_EXTRA_SAWMILL :{BLACK}Cuts 32t of wood into lumber.
that's called via "extra_text_industry: sawmill_extra_text;"
Essentially it's just using normal FIRS code. This works fine but I want to add a calculation that says:
Production status: 5
turns with current stockpile.
Now, it seems I can have one or the other but not both at the same time. I'm hoping it's possible but I can't work out how to do it.
Also, unless I use a newline character, I get "Production status: 5turns with current stockpile." which is annoying. Is there a way to add a physical space?
I now have a problem where I want to put some extra text into the industry window. I already have a brief description in the lang file...
STR_EXTRA_SAWMILL :{BLACK}Cuts 32t of wood into lumber.
that's called via "extra_text_industry: sawmill_extra_text;"
Essentially it's just using normal FIRS code. This works fine but I want to add a calculation that says:
Production status: 5
turns with current stockpile.
Now, it seems I can have one or the other but not both at the same time. I'm hoping it's possible but I can't work out how to do it.
Also, unless I use a newline character, I get "Production status: 5turns with current stockpile." which is annoying. Is there a way to add a physical space?
Re: Stockpile limit
there are two ways to combine two strings into one callback, both involve a string like this
or alternatively with a newline
one works statically (i.e. NML combines the string, and the game can use the combined string as one entity)
and the other one works dynamically (i.e. the game combines the strings, which NML kept separately)
i don't understand your space problem. just add a space?
Code: Select all
STR_CONCAT :{STRING}{STRING}
Code: Select all
STR_CONCAT :{STRING}{}{STRING}
Code: Select all
return string(STR_CONCAT, string(String1), string(String2))
Code: Select all
switch(blah, STORE_TEMP(string(String1) | string(String2) << 16, 0x100)) {
return string(STR_CONCAT);
}
Re: Stockpile limit
I'd halfway found the answer via the NMLwiki, using a different method than you suggest...but yours seems a bit easier. I'll see if I can sort it out this afternoon.
The lang code is as follows.
Production Status: {WHITE}{COMMA}{BLACK} turns with current stockpile.
There's a space before 'turns' but it seems to be whitespaced out. I hope it's not as simple as adding a second space?
HEY, it does need an extra space...
Eddi, thanks for that info, seems to work fine. The number isn't working again but that's my fault. I'll pop up a screenshot once I have something functional.
As promised, a screenshot; a work in progress, still lots to adjust.
The lang code is as follows.
Production Status: {WHITE}{COMMA}{BLACK} turns with current stockpile.
There's a space before 'turns' but it seems to be whitespaced out. I hope it's not as simple as adding a second space?
HEY, it does need an extra space...
Eddi, thanks for that info, seems to work fine. The number isn't working again but that's my fault. I'll pop up a screenshot once I have something functional.
As promised, a screenshot; a work in progress, still lots to adjust.
Re: Stockpile limit
Well, I can confirm there is a stockpile limit, of 65535 tonnes of iron ore (for example) and any extra ore delivered just vanishes, so that's perfect...as I don't have to worry about it.
In normal gameplay I wouldn't be concerned that I would ever get stocks that high but I was testing using AI companies and they just delivered stuff everywhere.
In normal gameplay I wouldn't be concerned that I would ever get stocks that high but I was testing using AI companies and they just delivered stuff everywhere.
Who is online
Users browsing this forum: No registered users and 54 guests