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
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4554
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: GS: Industry Constructor

Post by Zuu »

R2dical wrote:So I have almost finished a new version of this, it is a complete rewrite and has some new features. Actually I think I may wish to re-release it as a new script because "Industry Constructor" is now just a part of what it does. Is there any official policy regarding re-branding?
I don't think we have an official policy on re-branding.

However, if you want to rename please change all of these:
  • Short name (in info.nut)
  • Name (in info.nut)
  • Upload new content to bananas (eg. don't update the old content entry)
  • In the new bananas entry, use a new name, preferable the name used in info.nut
I think the intention was that short name should be used as AI identifier all over. However, the long name is actually used at some places. IIRC the savegame uses the long names. Thus I recommend you to make sure to change both and also use a new bananas entry to keep problems due to renaming at minimum.

As a consequence of the above, users of old versions of your script will not have an upgrade path to the new on existing save games. Please do not try to allow users to upgrade to your new brand/name in existing save games by cheating and only doing part of the above list. You'll likely to screw up more than you gain.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)

LSky
Traffic Manager
Traffic Manager
Posts: 170
Joined: 25 Jun 2005 10:44
Location: The Netherlands

Re: GS: Industry Constructor

Post by LSky »

v3 is giving me some of these errors when I try to generate a new map;
Unnamed, 5th Jan 1990_m.png
(42.81 KiB) Downloaded 8 times
No newgrfs, running r26287

R2dical
Traffic Manager
Traffic Manager
Posts: 165
Joined: 18 Mar 2013 22:22

Re: GS: Industry Constructor

Post by R2dical »

Thanks for the info Zuu. This new implementation has new all-of-the-above already IIRC, but anyway since it was a complete rewrite it wasn't meant to be compatible in any case.
LSky wrote:v3 is giving me some of these errors when I try to generate a new map;
You should be able to resolve this with the "prospect abnormal industries rather than use methods" selected. (Good error report btw).

You may wish to try the new WIP version 2 posts back which handles these situations much better :)

Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: GS: Industry Constructor

Post by Kogut »

It seems really interesting and almost like something that I planned but never had time to start coding it :)

Thanks for your work!

Have you considered using version control (for example git, with repository hosted on http://dev.openttdcoop.org/ or github)?
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD

User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4554
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: GS: Industry Constructor

Post by Zuu »

My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)

R2dical
Traffic Manager
Traffic Manager
Posts: 165
Joined: 18 Mar 2013 22:22

Re: GS: Industry Constructor

Post by R2dical »

Kogut wrote:It seems really interesting and almost like something that I planned but never had time to start coding it :)

Thanks for your work!
A pleasure :) Yeah ever since Terragenesis was added this is something I was looking for, and was not long after my first "Hello World" that my eye turned toward doing this...it took a while before it actually happened though :)
Kogut wrote:Have you considered using version control (for example git, with repository hosted on http://dev.openttdcoop.org/ or github)?
This could be something that is useful, since I have a (much larger) AI project in the works too. Though I think the GS is almost done, original goals and all stretch ones too. Is there a particular use for repository in this case?
Zuu wrote:If you want to use eints web translator to manage translations
Thanks Zuu, though I don't know how widely used this GS is or the desire for localization, I will make use of this feature if I create a repository.

Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: GS: Industry Constructor

Post by Kogut »

R2dical wrote:Though I think the GS is almost done, original goals and all stretch ones too. Is there a particular use for repository in this case?
1) Makes it easier for other people to acquire last version of code (no hunting for last posted version of forums and comparing it with BaNaNaS version)
2) It is an additional backup. At least once I deleted by mistake both last attachment on forum and copy of code on my hard drive. But code uploaded to server survived and it was trivial to undo entire mess, without loss of any work. (I simply cloned repository)

And I really recommend git (or some other revision control tool) for your next project, it is not taking long to learn it and benefits are enormous.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD

R2dical
Traffic Manager
Traffic Manager
Posts: 165
Joined: 18 Mar 2013 22:22

Re: GS: Industry Constructor

Post by R2dical »

Yeah, I think it will be important for my large AI project, so may as well do it for GS even though mostly done with it :)

maxucao
Engineer
Engineer
Posts: 7
Joined: 18 Mar 2014 03:57

Re: GS: Industry Constructor

Post by maxucao »

dude i have a error the log doesn't say anything so i don't know what is happen...
the scrip appears not to work....i have the firs industries remplacement and the settings of your scrip is the original
except that i change managa amoun industry and same industries per town

but in other savegame the script seems to work fine!!!!!!!!!! but one thing it's says primary industry 0 secondary 0 and so...

can you help me please!! :(

R2dical
Traffic Manager
Traffic Manager
Posts: 165
Joined: 18 Mar 2013 22:22

Re: GS: Industry Constructor

Post by R2dical »

You need to start a new game with the script, loading an existing save and enabling the script will not work (though I'm not sure this can even be done). It does support save/load however, so once you start a new game you can save/load as desired with the script part of the game.

The specific industry stuff needs to be hardcoded for each industry set (as API doesn't show Newgrf properties), FIRS is not currently included and depending on how its set up many or all industries may not appear.

So, try the alpha version in the first post (this is not on Bananas yet), and start a new game. If with FIRS and it doesn't work nice post and I will include FIRS explicitly.

If I missed, or misinterpreted anything, describe exactly what you are trying, what you expect, and how it goes wrong (screenshots or log/errors help A LOT) :) Also, the log level can be set to the most explicit level for more details btw.

maxucao
Engineer
Engineer
Posts: 7
Joined: 18 Mar 2014 03:57

Re: GS: Industry Constructor

Post by maxucao »

it doesn't show up any error it just crash
i think it could be by the firs because other GS industrie stabilizer crash as well

EDIT:::::

no it not for firs it crash in the original industries...
can you show me the advance settings for the game and what library I need for use your script

i start a random game and crash after the firs refresh
Attachments
crash.png
(204.5 KiB) Downloaded 4 times

R2dical
Traffic Manager
Traffic Manager
Posts: 165
Joined: 18 Mar 2013 22:22

Re: GS: Industry Constructor

Post by R2dical »

You need to disable standard industry generation, on the map setup screen select 'Funding Only' for the industries dropdown menu.

maxucao
Engineer
Engineer
Posts: 7
Joined: 18 Mar 2014 03:57

Re: GS: Industry Constructor

Post by maxucao »

Yes!!! It workss but one question have random error but the script doesnt stop
says for example "industry cant build" something like that

how can I probe it?? Ths log says a lot of things

by the way...thanks for reply

R2dical
Traffic Manager
Traffic Manager
Posts: 165
Joined: 18 Mar 2013 22:22

Re: GS: Industry Constructor

Post by R2dical »

If you are trying with FIRS, then it most likely will do this. Else with standard industries (not OpenGFX+ Industries, they have a known bug so don't use) the Readme included has quite a bit of info for how to handle this kind of thing.

Otherwise, you can try the alpha version here. The log has been cleaned quite a bit but it has less error handling ability.

Maybe post a pic of the error?

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

Re: GS: Industry Constructor

Post by planetmaker »

R2dical wrote:(not OpenGFX+ Industries, they have a known bug so don't use
Err.... what?

R2dical
Traffic Manager
Traffic Manager
Posts: 165
Joined: 18 Mar 2013 22:22

Re: GS: Industry Constructor

Post by R2dical »

planetmaker wrote:Err.... what?
Posted in the OpenGFX+ thread when it came up, and had a FS Task when I picked it up using GS.

EDIT: By "known bug", I meant known to me, at least in the scope of this GS :) Basically the API says that some OpenGFX+ industries are "processing type" but they are not actually in game (like Power Station, and Water Tower).
Last edited by R2dical on 27 Mar 2014 08:47, edited 1 time in total.

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

Re: GS: Industry Constructor

Post by planetmaker »

R2dical wrote:
planetmaker wrote:Err.... what?
Posted in the OpenGFX+ thread when it came up, and had a FS Task when I picked it up using GS.
Ah, thanks :)
I guess it's about time to re-visit that NewGRF

maxucao
Engineer
Engineer
Posts: 7
Joined: 18 Mar 2014 03:57

Re: GS: Industry Constructor

Post by maxucao »

Hi dude it's me again jejeje

I wanna say to you that industry constructor works well now even with FIRS but i give a try to map constructor and this made an error wtih FIRS just like you say

its FIRS problem or yours game script?? it only works with original or supose to work with others Newgrf???

I upload a image file of my crash


I use the map constructor of page 2 on the final

UPDATE: with ECS works in the firsh year almost but its somethin
UPDATE2: I think its because a limit in some function because I agree mor ECS NewGRF and get the same crash
Attachments
crash.png
(288.13 KiB) Downloaded 1 time

R2dical
Traffic Manager
Traffic Manager
Posts: 165
Joined: 18 Mar 2013 22:22

Re: GS: Industry Constructor

Post by R2dical »

It will be no small task to add proper support for FIRS and/or ECS in this script, as I am not familiar with the way Newgrf is done (NML, and Python in FIRS it looks like). So I need to do research into this to even answer what is going wrong in MapConstructor with FIRS.

That particular error is from the API returning false for "GSIndustryType.CanBuildIndustry" for the "Recycling Depot" in FIRS (I think thats what "Deposito de Reciclado" is). This is not a "direct" error in my script or FIRS and most likely my script needs to handle this better and/or have a FIRS specific related function for these industries.

There are a number of other (unlreated) roadblocks preventing development for this GS (some API stuff and also waiting to finish code from my AI project to port across to use in here). So for now if the IndustryConstructor version is working fine, use that :) Or use MapConstructor with default, or OpenGFX+ when v0.4 comes out (thanks planetmaker!).

maxucao
Engineer
Engineer
Posts: 7
Joined: 18 Mar 2014 03:57

Re: GS: Industry Constructor

Post by maxucao »

Okay then....thanks a lot dudr...i've watch your code and is...woah jajaja...good work keep going

Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 2 guests