GS -> NewGRF callback (patch)

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

Post Reply
User avatar
OpenTTD Developer
OpenTTD Developer
Posts: 4552
Joined: 09 Jun 2003 18:21
Location: /home/sweden

GS -> NewGRF callback (patch)

Post by Zuu »


I would like help from someone who know how to make NewGRFs and work with the industry specs. This is needed to try out a patch. Please read background below if you are interested and the patch and a test GS is provided further down.

Currently the line between NewGRF and GS is very clear and there is pretty much no way for GS to tell NewGRF about its desires on industry production, closure etc. It can only build industries and initiate closure, but cannot tell industries to not close, or to increase/decrease production.

There is also some interest in allowing GS to send messages to NewGRF. Perhaps many other not yet though of NewGRF + GS combo things can be created.

Work so far
I, frosch123 and andythenorth has discussed a bit on #openttd IRC channel about how this could be implemented. The relevant parts of the chat log is 2015-07-09 and 2015-07-10.

Proposed commands:

Patch: *.patch
It currently only implements the command to work with specific industries. And not yet the tile animation CB. It is basically just a first patch that has been tested by GS but not yet NewGRF yet. (which is why I write here for help ;-) )

Test GS: IMessengerGS allow you to place signs ontop of industries with integer value to send to industry.

Test NewGRF: will store received value in permanent store of coal mines. Which you can read out using the inspector of gui.newgrf_developer_tools.

What to test [edit: no longer needed]
I would like help from someone to make a NewGRF that act upon the bits sent in var 10 of production callback. If you can make it visually show perhaps using NewGRF developer tools in the game some state change, that would be useful. If that is not possible, you could also make it so that some values could be used to trigger very low/high production so it is clearly visible when testing that the response we see is not OpenTTD random production change. Remember, you're the NewGRF expert here so I trust you to be creative and come up with some way that the NewGRF can tell me that the callback was received and the bits in var 10 were received.

I think it would be useful if you can run the tests yourself, but also attach the NewGRF as a testing/verification tool for me.

Future plans
  • GS -> NewGRF is proposed to invoke also animation callback.
  • GS area method has been proposed
  • Later on if we think that GS -> NewGRF works well and may be useful in trunk, it will probably be a separate new callback for NewGRFs so they know when GS call them and when OpenTTD call them. However, as of now it is easiest to not have to modify the spec to try things out.
Note it is possible to propose lot of more things, however, I think it is better now to keep it simple than to extend it too large at this point.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 1 guest