BSPI.grf - Stockpiling Industries

Find and discuss all the latest NewGRF releases for TTDPatch and OpenTTD here.

Moderator: Graphics Moderators

Post Reply
Borg
Engineer
Engineer
Posts: 10
Joined: 21 May 2005 06:45

BSPI.grf - Stockpiling Industries

Post by Borg » 22 Jan 2019 16:04

Hello.

I want to announce a NewGRF Ive been working on: BSPI.grf
Its basically vanilla industries in stockpiling mode.
Download:
ftp://ds-1.ovh.uu3.net/home/borg/openttd/BSPI.grf
ftp://ds-1.ovh.uu3.net/home/borg/openttd/X2025.grf

It have few additional features that can be configured via Param1:
bit0 - extractive industries have reserves
bit1 - secondary industries need electric power (Town zones)
bit2 - primary industries need valuables to boost production (Town zones)

If bit0 is on, extractive industries have limited reservces. Once depleted,
industry will announce closure.

If bit1 is on, secondary industries need electric power. So first, you need
to provide coal to Power Stations within town zone. Once Power Station
will produce some energy (Net power >0%) industries will be able to produce
goods.

If bit2 is on, primary industries max output is limited to 25%. It can go temporary
up by random production event, but will slowly return to 25%.
To boost production, u need to have Bank in Town and start transporting
valuables to that bank from other Bank. Every month, all primary industries
that production is above 25% will consume some valuables from Town.
If there is no valuables, production will start to decay to reach 25%.

Additionaly, to boost production of any industry (except Bank) you need to have
good station rating:
75%+ : production can increase
85%+ : random event will always double production

Also, if your rating is bad, production will decrease slowly too:
<50% : production decreases

Bank production is affected by Town population.

All secondary industries now produce every production tick (2.5 game days).
So, you can overload industry with cargo (it will stop paying for transport).
Also, you need to have some stockpiled cargo so production can increase.
Its roughy 250 units per 4%.

Cargo consumption is standard, 10 units per tick except coal, 5 units.
Max storage capacity: 15000 units except coal, 10000 units.

Thats it for now I think.
I run OpenTTD server w/ that GRF, so if someone want to take a look or play, go ahead.
Tag: Borg

Regards,
Borg
Last edited by Borg on 23 May 2019 18:05, edited 2 times in total.

SomeIndianGuy
Engineer
Engineer
Posts: 18
Joined: 19 Nov 2018 19:26
Location: Somewhere in India

Re: X2025.grf - Stockpiling Industries

Post by SomeIndianGuy » 26 Jan 2019 17:24

Very good!
Nothing to put here!

User avatar
sevenfm
Engineer
Engineer
Posts: 68
Joined: 25 Jul 2016 23:44
Location: Soviet Russia

Re: X2025.grf - Stockpiling Industries

Post by sevenfm » 26 Jan 2019 17:44

Borg wrote:If bit1 is on, secondary industries need electric power. So first, you need
to provide coal to Power Stations within town zone. Once Power Station
will produce some energy (Net power >0%) industries will be able to produce
goods.
How do the industries know about power station production level?
If bit3 is on, primary industries max output is limited to 25%. It can go temporary
up by random production event, but will slowly return to 25%.
To boost production, u need to have Bank in Town and start transporting
valuables to that bank from other Bank. Every month, all primary industries
that production is above 25% will consume some valuables from Town.
If there is no valuables, production will start to decay to reach 25%.
Should be interesting to play. Similar idea I have with my SPI rework, with the difference that I plan to use town consumer industries to convert goods/food/petrol etc to valuables and send them back to primary industries.
Additionaly, to boost production of any industry (except Bank) you need to have
good station rating:
75%+ : production can increase
85%+ : random event will always double production

Also, if your rating is bad, production will decrease slowly too:
<50% : production decreases
Doesn't look good to me, station rating can fluctuate too much with new vehicles becoming old, with difference between fast/slow vehicles etc, from my experience with ECS it makes production crazily unpredictable and production jumps annoying.
Bank production is affected by Town population.
A good reason to use town growth limiting game script.
So, you can overload industry with cargo (it will stop paying for transport).
Does it simply stop accepting cargo?
Also, you need to have some stockpiled cargo so production can increase.
Its roughy 250 units per 4%.
Looks similar to SPI, should be interesting.

User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5383
Joined: 13 Sep 2004 13:21
Location: The Moon
Contact:

Re: X2025.grf - Stockpiling Industries

Post by PikkaBird » 26 Jan 2019 18:18

sevenfm wrote:How do the industries know about power station production level?
The power station can set a flag in a persistent register of the town, which the other industries can read... hmm.

That's pretty damn clever. I might have to find a way to use that. :D

Borg
Engineer
Engineer
Posts: 10
Joined: 21 May 2005 06:45

Re: X2025.grf - Stockpiling Industries

Post by Borg » 26 Jan 2019 20:20

sevenfm wrote: How do the industries know about power station production level?
As PikkaBird wrote, this is done by Persistent storage in Towns.
You can access related object in GRF.. In case of Industry it is Town.
I can provide more technical details if you want.
sevenfm wrote:
Additionaly, to boost production of any industry (except Bank) you need to have
good station rating:
75%+ : production can increase
85%+ : random event will always double production

Also, if your rating is bad, production will decrease slowly too:
<50% : production decreases
Doesn't look good to me, station rating can fluctuate too much with new vehicles becoming old, with difference between fast/slow vehicles etc, from my experience with ECS it makes production crazily unpredictable and production jumps annoying.
Thats why my GRF provides custom station rating calculations. Im quite happy with the results.
sevenfm wrote:
Bank production is affected by Town population.
A good reason to use town growth limiting game script.
Yep, I use custom GS to handle few extra things :)
But its not that big problem, because Bank production is capped.
Max population is 10240 (currently hardcoded). Anything larger will
just dont affect Bank production.
sevenfm wrote:
So, you can overload industry with cargo (it will stop paying for transport).
Does it simply stop accepting cargo?
Well, cargo will be accepted (tile acceptance is not changed). I use Industry Opt Acceptance
callback, so industry will simply not pay for excees cargo (no profit).

Borg
Engineer
Engineer
Posts: 10
Joined: 21 May 2005 06:45

Re: X2025.grf - Stockpiling Industries

Post by Borg » 26 Jan 2019 20:34

PikkaBird wrote:
sevenfm wrote:How do the industries know about power station production level?
The power station can set a flag in a persistent register of the town, which the other industries can read... hmm.

That's pretty damn clever. I might have to find a way to use that. :D
Its even more complicated :) There are counters, because Power station output
levels vary (based on layout). Additionally, when you provide more coal to power station
it increases Burn Rate and so, provide more power. Same with industry, when it idles
at 4% production rate.. it consumes 1 unit of power per tick, but when it goes 100%
it eats 24 units of power. So you need to scale your coal transport with production.

User avatar
sevenfm
Engineer
Engineer
Posts: 68
Joined: 25 Jul 2016 23:44
Location: Soviet Russia

Re: X2025.grf - Stockpiling Industries

Post by sevenfm » 26 Jan 2019 22:21

Borg wrote:As PikkaBird wrote, this is done by Persistent storage in Towns.
You can access related object in GRF.. In case of Industry it is Town.
I can provide more technical details if you want.
I would appreciate a more detailed explanation. Does it work with NML? Looking at NML documentation, I don't see anything related.

User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5383
Joined: 13 Sep 2004 13:21
Location: The Moon
Contact:

Re: X2025.grf - Stockpiling Industries

Post by PikkaBird » 27 Jan 2019 03:07

sevenfm wrote:Does it work with NML? Looking at NML documentation, I don't see anything related.
You're looking for STORE_PERM and LOAD_PERM in https://newgrf-specs.tt-wiki.net/wiki/N ... _functions . Also read the last paragraph of https://newgrf-specs.tt-wiki.net/wiki/NML:Switch .

Borg
Engineer
Engineer
Posts: 10
Joined: 21 May 2005 06:45

Re: X2025.grf - Stockpiling Industries

Post by Borg » 27 Jan 2019 08:57

sevenfm wrote: I would appreciate a more detailed explanation. Does it work with NML? Looking at NML documentation, I don't see anything related.
Well, I dont use NML, so no clue here but it should.
Here is NFO info: https://newgrf-specs.tt-wiki.net/wiki/Storages
Look at Persistent storage accessed by GRFID.
Thats what I use.

User avatar
sevenfm
Engineer
Engineer
Posts: 68
Joined: 25 Jul 2016 23:44
Location: Soviet Russia

Re: X2025.grf - Stockpiling Industries

Post by sevenfm » 27 Jan 2019 10:38

PikkaBird wrote:You're looking for STORE_PERM and LOAD_PERM in https://newgrf-specs.tt-wiki.net/wiki/N ... _functions . Also read the last paragraph of https://newgrf-specs.tt-wiki.net/wiki/NML:Switch .
Thank you!
Unfortunately, it seems STORE_PERM and LOAD_PERM don't work for towns, when using:
switch (FEAT_INDUSTRIES, PARENT, town_hall_extra_text, STORE_PERM(77, 0))
{
return string(STR_EXTRA_TOWN_HALL);
}
it gives error
←[Knmlc ERROR: nmlc: An internal error has occurred:
nmlc-version: 2019-01-09-g7b7fcaf5
Error: (AssertionError) "Invalid feature number".
Command: ['c:\\dev\\nml\\nmlc', '-c', '--grf', 'spi1.32a.grf',
Location: File "nml\ast\general.py", line 54, in feature_name
With SELF switch it compiles ok.

User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9278
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: X2025.grf - Stockpiling Industries

Post by planetmaker » 02 Apr 2019 10:42

sevenfm wrote:
PikkaBird wrote:You're looking for STORE_PERM and LOAD_PERM in https://newgrf-specs.tt-wiki.net/wiki/N ... _functions . Also read the last paragraph of https://newgrf-specs.tt-wiki.net/wiki/NML:Switch .
Thank you!
Unfortunately, it seems STORE_PERM and LOAD_PERM don't work for towns, when using:
switch (FEAT_INDUSTRIES, PARENT, town_hall_extra_text, STORE_PERM(77, 0))
{
return string(STR_EXTRA_TOWN_HALL);
}
it gives error
←[Knmlc ERROR: nmlc: An internal error has occurred:
nmlc-version: 2019-01-09-g7b7fcaf5
Error: (AssertionError) "Invalid feature number".
Command: ['c:\\dev\\nml\\nmlc', '-c', '--grf', 'spi1.32a.grf',
Location: File "nml\ast\general.py", line 54, in feature_name
With SELF switch it compiles ok.
Reads like a bug or omission. Can you please provide code which actually tests this?

Does this help and does the resulting NewGRF work as intended? https://github.com/OpenTTD/nml/pull/26

User avatar
sevenfm
Engineer
Engineer
Posts: 68
Joined: 25 Jul 2016 23:44
Location: Soviet Russia

Re: X2025.grf - Stockpiling Industries

Post by sevenfm » 02 Apr 2019 10:58

planetmaker wrote:Reads like a bug or omission. Can you please provide code which actually tests this?
I tested it with highly modified SPI 1.32 code, unfortunately I don't have a separate test grf for this bug/feature.
planetmaker wrote:Does this help and does the resulting NewGRF work as intended? https://github.com/OpenTTD/nml/pull/26
I can test it if someone uploads a compiled win32 NML with needed changes.
Latest NML pack in usual place http://bundles.openttdcoop.org/nml/push/LATEST/ is from 2019-Jan-09.

User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9278
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: X2025.grf - Stockpiling Industries

Post by planetmaker » 02 Apr 2019 11:21

sevenfm wrote:
planetmaker wrote:Reads like a bug or omission. Can you please provide code which actually tests this?
I tested it with highly modified SPI 1.32 code, unfortunately I don't have a separate test grf for this bug/feature.
planetmaker wrote:Does this help and does the resulting NewGRF work as intended? https://github.com/OpenTTD/nml/pull/26
I can test it if someone uploads a compiled win32 NML with needed changes.
Latest NML pack in usual place http://bundles.openttdcoop.org/nml/push/LATEST/ is from 2019-Jan-09.
It's all python. So all you need is a python 3.5+ (e.g. 3.6 or 3.7) install and a download of nml (e.g. the pull request I linked) and you can run nmlc just fine

User avatar
sevenfm
Engineer
Engineer
Posts: 68
Joined: 25 Jul 2016 23:44
Location: Soviet Russia

Re: X2025.grf - Stockpiling Industries

Post by sevenfm » 02 Apr 2019 11:30

I only have Python 2.7 which was recommended by some NML install guide, and I don't have those files (nml/actions/action2var.py and nml/ast/general.py) you changed in that commit.

User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9278
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: X2025.grf - Stockpiling Industries

Post by planetmaker » 02 Apr 2019 11:32

I suggest the install guide which comes with the nml you actually use... e.g. https://github.com/OpenTTD/nml/blob/master/README.md

We need your help to maintain nml.

Borg
Engineer
Engineer
Posts: 10
Joined: 21 May 2005 06:45

Re: BSPI.grf - Stockpiling Industries

Post by Borg » 02 Apr 2019 15:21

Okey, some people told me that having GRF that changes
both Industries and Vehicles is bad idea, so I decided to
split this GRF into 2 new GRFs.

First one is BSPI.grf - Stockpiling Industries.
I already updated first post.

Second is X2025.grf (old name) with just adds 'X2025' (Electric).
It can additionally merge maglev into monorail via bit0 of Param1.

Download: ftp://ds-1.ovh.uu3.net/home/borg/openttd/X2025.grf

Post Reply

Return to “Graphics Releases”

Who is online

Users browsing this forum: No registered users and 3 guests