Page 2 of 2

Re: Let us modify the NewGRFs we can use in scenarios

Posted: 10 Aug 2017 12:37
by andythenorth
Effwon wrote:A dev will take you up on that, probably! :lol:
It's more likely that there will be deafening silence about that idea from anyone with commit rights ;)

Re: Let us modify the NewGRFs we can use in scenarios

Posted: 11 Aug 2017 05:44
by Alberth
A dev will take you up on that, probably! :lol:
Devs currently have a different plan :p

Rather than trying to derive a rule when it's safe to change newgrfs, the plan is to throw away scenarios as we know them.

Scenarios are just savegames, changing that to make newgrfs changeable is a very deep pit filled with red-hot lava. You really don't go there even if life depended on it. So instead, we want to change what "scenario" is. Rather than a world that you can load, we'd like a scenario to be a description of how to assemble the world. You have to provide a bunch of files for this purpose, a heightmap, a road map, a water map, list of industries, list of towns, etc.
When you load such a scenario, the program quickly interprets all those files, and builds the world for you as you described it.

First idea of that plan is at https://wiki.openttd.org/Terkhen/Scenario_format


Of course, the OpenTTD scenario editor will be able to load the above descriptions, allow you to edit it, and save the files again. However, the description is designed to be open, as it uses standard file formats, like PNG. This means you can make a scenario by just providing those files in any way you want. In other words, you can use whatever software to make each of the files, assemble them all into a scenario, then load and play. So if you want to have real-world placements of cities or roads, write or use software that generates the right file data, and it will work.


How well things work if you make changes in the description is one of the things that is not known yet, but much depends on the format of the description. Some form of NewGRF list will be in the description, and it seems feasible to allow editing of that list before the world is constructed. How well that actually works is not yet understood though, but much depends on what you can say in the world assembly instructions.
If it can only say "Place FIRS2 industry #26 at (x,y)", changing FIRS by another version of FIRS or by another Industry GRF would be problematic. On the other hand, if the assembly instructions say "Put an industry that produces COAL at (x,y)", that would be more easy to accommodate.

This holds for a lot of things. Saying "I want a city of 30 houses at (x,y)" is more flexible with changed newgrfs than "city has house 32 at (x1,t1), house 35 at (x2,y2), etc".

If you extend this idea further, and give more global descriptions rather than the exact placement at each and every tile, you could get scenarios that are different each time you play them. For example, if you could say "Make 5 coal industries in this area please", that would be really nice.
Such global instructions could also work at different map sizes, if you allow scaling of positions to map size.

Re: Let us modify the NewGRFs we can use in scenarios

Posted: 12 Aug 2017 13:40
by YNM
@ Alberth : Advanced Heightmap wasn't it called ?

To be honest, Scenarios do share their format with savegames in TT(O/D)/TTDPatch/OTTD (just change the extension, it's how you hack a scenario to have existing companies at start or magically change things in ye olden days), and it's a hellhole of problems to change the GRFs loaded (I am naughty, I do change NewGRFs during running games), and too often it'll lead to errors somewhere waiting to happen or be read. Although, if I may say, during the making of Scenarios, perhaps it's fine to change the NewGRFs if the map hasn't been filled with any objects apart from terrain ? That could be the only allowed changing of NewGRF after the thing is "made". There's risk of the problems haunting in the background, ruining the game after reaching long timescales, but would it be too much effort ?

On the point of "Advanced Heightmaps" however, one problem I've always have problems with for such method of semi-random generation is tile placing. This can be seen in in-game "Prospecting" mode for placing industries. Industries and such do sometimes comes in tight places IRL. Perhaps it'd help to enable auto-landscaping to truly allow near-random placing of things ? Maybe, along with increased height level, there should be some sort of double-height slopes to avoid the landscaping to destroy the original landscape ?

Re: Let us modify the NewGRFs we can use in scenarios

Posted: 12 Aug 2017 14:22
by Effwon
Alberth wrote:
A dev will take you up on that, probably! :lol:
Devs currently have a different plan :p

Rather than trying to derive a rule when it's safe to change newgrfs, the plan is to throw away scenarios as we know them.

Scenarios are just savegames, changing that to make newgrfs changeable is a very deep pit filled with red-hot lava. You really don't go there even if life depended on it. So instead, we want to change what "scenario" is. Rather than a world that you can load, we'd like a scenario to be a description of how to assemble the world. You have to provide a bunch of files for this purpose, a heightmap, a road map, a water map, list of industries, list of towns, etc.
When you load such a scenario, the program quickly interprets all those files, and builds the world for you as you described it.

First idea of that plan is at https://wiki.openttd.org/Terkhen/Scenario_format


Of course, the OpenTTD scenario editor will be able to load the above descriptions, allow you to edit it, and save the files again. However, the description is designed to be open, as it uses standard file formats, like PNG. This means you can make a scenario by just providing those files in any way you want. In other words, you can use whatever software to make each of the files, assemble them all into a scenario, then load and play. So if you want to have real-world placements of cities or roads, write or use software that generates the right file data, and it will work.


How well things work if you make changes in the description is one of the things that is not known yet, but much depends on the format of the description. Some form of NewGRF list will be in the description, and it seems feasible to allow editing of that list before the world is constructed. How well that actually works is not yet understood though, but much depends on what you can say in the world assembly instructions.
If it can only say "Place FIRS2 industry #26 at (x,y)", changing FIRS by another version of FIRS or by another Industry GRF would be problematic. On the other hand, if the assembly instructions say "Put an industry that produces COAL at (x,y)", that would be more easy to accommodate.

This holds for a lot of things. Saying "I want a city of 30 houses at (x,y)" is more flexible with changed newgrfs than "city has house 32 at (x1,t1), house 35 at (x2,y2), etc".

If you extend this idea further, and give more global descriptions rather than the exact placement at each and every tile, you could get scenarios that are different each time you play them. For example, if you could say "Make 5 coal industries in this area please", that would be really nice.
Such global instructions could also work at different map sizes, if you allow scaling of positions to map size.
Woah. I like that. G Devs with more brain than me :lol: :bow: :P

Re: Let us modify the NewGRFs we can use in scenarios

Posted: 13 Aug 2017 04:59
by Alberth
YNM wrote:@ Alberth : Advanced Heightmap wasn't it called ?
Never heard of that, but it's possible.

About old scenarios, I cannot imagine we will remove support for the old scenario files, if only for keeping the ability to play the original scenarios. How that works out is a detail I don't know.
YNM wrote:That could be the only allowed changing of NewGRF after the thing is "made". There's risk of the problems haunting in the background, ruining the game after reaching long timescales, but would it be too much effort ?
I don't believe there is a safe subset (unless you see the empty set as a proper subset). NFO is much too powerful for that. Mostly the only reason why it doesn't break more often is because most grf authors make nicely behaving NewGRFs, but that is not something you can assume.
YNM wrote:On the point of "Advanced Heightmaps" however, one problem I've always have problems with for such method of semi-random generation is tile placing. This can be seen in in-game "Prospecting" mode for placing industries. Industries and such do sometimes comes in tight places IRL. Perhaps it'd help to enable auto-landscaping to truly allow near-random placing of things ? Maybe, along with increased height level, there should be some sort of double-height slopes to avoid the landscaping to destroy the original landscape ?
Industry placement is a problem, but it exists also outside scenarios as you say. Therefore it is a separate problem (we always try to make as many small problems as we can, since many small problems are easier to solve than one immensely huge problem). Proper discussion should be in another thread, but the short answer is, I think, to enable the NewGRF to tell OpenTTD what landscape it wants. Concretely, one guy has to write a NFO spec defining how to express this. Once the spec is approved, tools and programs can be changed to support that.

You also speak about non-landscapable areas? Not sure what "double height slopes" does there. Currently, there is no way to express something like that (and tbh personally I am not convinced it is a good idea). If you want it, the first step would be to make a patch that introduces it, so people can use it, and form an opinion about it.