Page 1 of 1

API request - expose industry founder to gamescript.

Posted: 01 Sep 2014 22:12
by PikkaBird
It would be useful, for a competitive game script, to know which company founded an industry. This information is already known to OpenTTD - it's industry var A7.

Re: API request - expose industry founder to gamescript.

Posted: 02 Sep 2014 17:29
by frosch
Technically it's not known to OpenTTD. The founder information is incorrect when companies close and restart. But NewGRF never bothered about that.

Edit: Nevermind, it is actually updated on bankrupt or takeover.

Re: API request - expose industry founder to gamescript.

Posted: 02 Sep 2014 19:47
by PikkaBird
frosch wrote:Edit: Nevermind, it is actually updated on bankrupt or takeover.
That's handy. :)

In any case, I was planning to check the founder only at the moment the industry was created, and handle companies closing down explicitly elsewhere.

Re: API request - expose industry founder to gamescript.

Posted: 03 Sep 2014 04:30
by Alberth
Afaik there is no way to query the founder of an industry for a user, so when buying a company, I may become founder of an industry, but I have no way to find out if so, or which one(s).

Re: API request - expose industry founder to gamescript.

Posted: 03 Sep 2014 06:42
by PikkaBird
Alberth wrote:I have no way to find out if so, or which one(s).
Unless the GS tells you, of course. :)

Re: API request - expose industry founder to gamescript.

Posted: 03 Sep 2014 07:43
by Alberth
/me grabs the magic bulldozer to delete all those weird industries inherited from a former competitor :D

Re: API request - expose industry founder to gamescript.

Posted: 03 Sep 2014 07:51
by PikkaBird
Still, it's not really an issue for what I want to do with it. :)

To give a very simplified idea of what I had in mind: a GS where the winner is the first company to found 100 new industries. On GSEventIndustryOpen, the script would check which company built the industry and credit it to them. If a company closes down, its list will be cleared; the existing industries will not be recredited.

Re: API request - expose industry founder to gamescript.

Posted: 03 Sep 2014 07:58
by planetmaker
PikkaBird wrote:Still, it's not really an issue for what I want to do with it. :)

To give a very simplified idea of what I had in mind: a GS where the winner is the first company to found 100 new industries. On GSEventIndustryOpen, the script would check which company built the industry and credit it to them. If a company closes down, its list will be cleared; the existing industries will not be recredited.
I think Alberth's concern is more that we then have (potentially) a mechanism which the player cannot understand or follow. However I do believe that this is a thing which for *game scripts* is not strictly necessary. If they wish to be opaque, so it be. As such *I* don't see a problem in exposing that variable to GS (contrary to exposing it to AI).

Re: API request - expose industry founder to gamescript.

Posted: 03 Sep 2014 08:21
by keoz
planetmaker wrote:I think Alberth's concern is more that we then have (potentially) a mechanism which the player cannot understand or follow. However I do believe that this is a thing which for *game scripts* is not strictly necessary. If they wish to be opaque, so it be. As such *I* don't see a problem in exposing that variable to GS (contrary to exposing it to AI).
There would be a way to make that more transparent.

If the GS keeps a list of the industries founded by a company, it can then publish and update the list in the storybook.

Re: API request - expose industry founder to gamescript.

Posted: 03 Sep 2014 11:45
by krinn
PikkaBird wrote: To give a very simplified idea of what I had in mind: a GS where the winner is the first company to found 100 new industries. On GSEventIndustryOpen, the script would check which company built the industry and credit it to them. If a company closes down, its list will be cleared; the existing industries will not be recredited.
In case it might be of help for you :

- You can "guess" who made the industry, to a certain limit. On industry open you can browse all companies money spent (its not a cheap expense and it might also goes into some specific category, see the API expenses/money for details) and check this against the prize of the industrytype that was create.
There's limit, if two industrytype appears at the same time, or when two companies found two industries within the same month, you won't be able to tell what industry was found by whom, but you can still credits both companies have founded an industry. If your aim is only # of founded industries by companies.

- You can also make your GS drives player : player must add a sign at position where to build the indutry, GS read the special sign, remove it and create the industry for the player. So the GS take the hand of player and do build it (using the player money). In this form your GS can gives credit to any company that found industry using the sign trick ; validating owner itself.
GS have access to all signs, as such, any companies can speak with GS thru signs. (that's script communication protocol base to speak with all companies).

Re: API request - expose industry founder to gamescript.

Posted: 03 Sep 2014 11:59
by krinn
planetmaker wrote: I think Alberth's concern is more that we then have (potentially) a mechanism which the player cannot understand or follow. However I do believe that this is a thing which for *game scripts* is not strictly necessary. If they wish to be opaque, so it be. As such *I* don't see a problem in exposing that variable to GS (contrary to exposing it to AI).
I do know your concern about AI must be do what human can do only ; and cheat issues. But i hardly follow you why any AI should remain blind to that info in this case.

Re: API request - expose industry founder to gamescript.

Posted: 03 Sep 2014 15:03
by Alberth
krinn wrote:
planetmaker wrote: I think Alberth's concern is more that we then have (potentially) a mechanism which the player cannot understand or follow. However I do believe that this is a thing which for *game scripts* is not strictly necessary. If they wish to be opaque, so it be. As such *I* don't see a problem in exposing that variable to GS (contrary to exposing it to AI).
I do know your concern about AI must be do what human can do only ; and cheat issues. But i hardly follow you why any AI should remain blind to that info in this case.
What I pointed out was that a normal player doesn't have this information either at this moment. As such normal players and AIs are the same.

If the GS gets this information, it should provide a way for the AI to get the same information that a player gets from the GS.


To be honest, I very much doubt that all GS authors will bother to make a story book page for users about their industries (both bought and inherited), especially if only a few industries are involved for the GS. I have even more doubts that they will also provide that information to the AI, and that an AI will understand such information.

Re: API request - expose industry founder to gamescript.

Posted: 04 Sep 2014 15:50
by PikkaBird
krinn wrote:its not a cheap expense
That's a rather NewGRF-specific assumption. ;)