GS: Industry Constructor

Discuss the new AI features ("NoAI") introduced into OpenTTD 0.7, allowing you to implement custom AIs, and the new Game Scripts available in OpenTTD 1.2 and higher.

Moderator: OpenTTD Developers

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

Re: GS: Industry Constructor

Post by sevenfm »

Found this script very interesting.
Is it possible to modify it to only build new industry if town has enough population?

For example:
1000 - max 1 industry
2000 - max 2 industry
4000 - max 3 industry
...

With this change and industry building set to town type only, the player will have to grow towns to get new industries, representing economy deveolpment and the fact that industry needs workers.
For example, if towns are allowed to grow to 1000 by only passenger/mail service, this will give starting set of industries, then if you want to develop country more, deliver food/goods to a group of towns to allow towns grow to 2000, this will allow opening of new industries and so on.
I like trains. They are soothing.
User avatar
Ben1338
Traffic Manager
Traffic Manager
Posts: 171
Joined: 17 Nov 2007 17:23
Skype: ben313371

Re: GS: Industry Constructor

Post by Ben1338 »

There seems to be a problem with the game script, I look at the debug menu and it repeatedly says that the Town List is empty.
User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 708
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: GS: Industry Constructor

Post by JacobD88 »

A wee bit of a necro
However, i have found a previously unreported crash with the Map Constructor update given on Page 2 of this thread

To replicate, add the Map Constructor GS, create a new game (i used 512x512 with industry generation set to "funded only") the script crashes shortly after launch
MapConstructor_v0-9_Crash1.png
(32.23 KiB) Not downloaded yet
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: GS: Industry Constructor

Post by MagicBuzz »

Why do you use version 1 while there is a version 3 both on BaNaNaS and on the first message of the thread?
User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 708
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: GS: Industry Constructor

Post by JacobD88 »

MagicBuzz wrote: 21 Jul 2020 17:21 Why do you use version 1 while there is a version 3 both on BaNaNaS and on the first message of the thread?
Because version 0.9/1.0 of MAP Constructor on Page 2 of this thread (second download at the bottom of page) is newer than version 3 of Industry Constructor with new features like town generation and road linking
As the original dev said, it's far more than an Industry Creation script now, so was rebranded
But sadly not uploaded to BaNaNaS
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: GS: Industry Constructor

Post by MagicBuzz »

I see in the code the program throw an error when the industry it tries to build is not build-able.

According to the NewGRF and some other parameters (game date, etc.) industries actually can't be unavailable and I wonder why the author thrown an error in this case.

I "fixed" it by simply aborting industry construction.
But I didn't tested it.
Attachments
MapConstructor.tar
(180.5 KiB) Downloaded 137 times
User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 708
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: GS: Industry Constructor

Post by JacobD88 »

Many thanks, will try out and report back
Have you halted all industry building or just the failed industry?
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: GS: Industry Constructor

Post by MagicBuzz »

Just the building attempt when it occurs.
So the next time the script would try to create industries it should try again.
User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 708
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: GS: Industry Constructor

Post by JacobD88 »

Hmmm, odd
Your modified script appears to be missing all of the newer Map Constructor features (like road linking)

Your modified version
MapConstructor_v0-9_Modified_Issue1.png
(82.72 KiB) Not downloaded yet
Unedited version from bottom of Page 2
MapConstructor_v0-9_Settings 1.png
(118.42 KiB) Not downloaded yet
Did you definitely modify the Map Constructor Script?
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: GS: Industry Constructor

Post by MagicBuzz »

I see only one MapConstructor download at page 2 and I downloaded it.

Are you sure you use this one ?
User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 708
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: GS: Industry Constructor

Post by JacobD88 »

I did
It's very very odd that your modified one removes those options unintentionally
But the one from page 2 still has them

But there's a 110KB difference between the page 2 tar (290kb) and your one (180KB) also
User avatar
GeekToo
Tycoon
Tycoon
Posts: 961
Joined: 03 Jun 2007 22:22

Re: GS: Industry Constructor

Post by GeekToo »

MagicBuzz wrote: 23 Jul 2020 18:04 I see only one MapConstructor download at page 2 and I downloaded it.

Are you sure you use this one ?
Actually, there are 2 downloads, also here: viewtopic.php?p=1110996#p1110996
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: GS: Industry Constructor

Post by MagicBuzz »

Doh! :shock:

That explains many things!

Here is the modified version of this second download...
Attachments
MapConstructor.tar
(290 KiB) Downloaded 131 times
WalkedBy
Engineer
Engineer
Posts: 18
Joined: 08 Aug 2021 11:45

Re: GS: Industry Constructor

Post by WalkedBy »

Here is another big rewrite to this script, it was used to populate a big 4096 map in 1820 with FIRS 3
updated: v3.5 contains multiple fixes, improvements, and simple nice sampling example, which is used to place marine industries fast, contains some auto-debug too

Warnings!:
- this one is editor-only (SS) branch of this script, not like it was originally created as GS script;
it's supposed to be used only for industry generation as last part of scenario creating (keeping clean map without industries is a good practice)
to use, add script to scenario, reload, re-run if it does nothing, check logs. After it finishes, the game will show error, which is actually in most cases correct result
after crash, it's supposed to be replaced with any other script you would like to use during game while still in editor
4096 map is supposed to have result about 20 of each primary, 6 of each secondary, 2 others etc
- In game industry generation is supposed to be disabled most of the time, except for small intervals to generate newly available industries or without them (and with only-prospect-by-player mode)
- all presets which we used are for hard mode, other presets (easy, normal from info.nut) may not work well
- if script hangs (it happens more and more rarely with each clean-up, but can), then re-load clean scenario without any scripts and re-apply and re-run script; it's in general not recommended switching scripts too much or run them twice, may damage scenario
- will work only on pause by now

There is still a lot of things to clean up / simplify /improve in this script in general, very far from perfect, may lockup sometimes, however most cases are now much easier to fix because of how industries declared and all routines reorganized.
Also works much faster in lots of cases.
Change settings at your own risk (some of them may work fine in 3.5) :mrgreen:

May be worse than script attached above, because based on much older files uploaded here, but it's not clear.

Having such script even in raw shape was great, and thanks for uploading it back then.
Attachments
SS_Industry_Constructor-3.5.tar
after multiple updates&bugfixes in recent days, this version is most promising
(113.5 KiB) Downloaded 85 times
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 6 guests