Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Map generation fails when no town buildable roads are available #10574

Closed
Ufiby opened this issue Mar 17, 2023 · 21 comments
Closed

[Bug]: Map generation fails when no town buildable roads are available #10574

Ufiby opened this issue Mar 17, 2023 · 21 comments
Labels
component: NewGRF This issue is related to NewGRFs

Comments

@Ufiby
Copy link

Ufiby commented Mar 17, 2023

Version of OpenTTD

20230316-master-g0bf6d80cd7 (Win10 64)

Expected result

Without failures of creating a new map

Actual result

Message

Steps to reproduce

  1. Download NewGRF: or U&RaTT, or Rattroads
  2. Starting game in 1900 year
@James103
Copy link
Contributor

James103 commented Mar 17, 2023

Can confirm. Most likely, that's because no town-buildable road type is available that early; therefore, map generation fails on town generation as it can't build any road to place housing on.

Can also reproduce in the Scenario Editor:

  • "New town" -> click on map just inserts a town in the map data without building anything.
  • "Random town" -> error "Can't build any towns, there is no more space on the map"
  • "Many random towns" -> game hangs for several seconds before the routine aborts with the same error as "Random town".

@PeterN
Copy link
Member

PeterN commented Mar 17, 2023

Bug in the road-type NewGRF, no town-buildable road-types exist in 1900.

@Ufiby
Copy link
Author

Ufiby commented Mar 17, 2023

version 13.0 everything works smoothly, it looks like something you will change. what is forbidden to use with the flag: bitmask(ROADTYPE_FLAG_HIDDEN, ROADTYPE_FLAG_TOWN_BUILD)

@PeterN
Copy link
Member

PeterN commented Mar 17, 2023

Not something I've changed. Hidden types are meant for providing compatibility between otherwise incompatible types, not for placing on the ground.

@Ufiby
Copy link
Author

Ufiby commented Mar 17, 2023

quick check
ROADTYPE_FLAG_HIDDEN + ROADTYPE_FLAG_TOWN_BUILD = will fail

@JGRennison
Copy link
Contributor

It was changed here: #10546

@2TallTyler 2TallTyler added the component: NewGRF This issue is related to NewGRFs label Mar 19, 2023
@2TallTyler 2TallTyler changed the title [Bug]: The generation of the map was interrupted [Bug]: Map generation fails when no town buildable roads are available Mar 19, 2023
PeterN added a commit to PeterN/OpenTTD that referenced this issue Mar 28, 2023
PeterN added a commit to PeterN/OpenTTD that referenced this issue Mar 28, 2023
@PeterN
Copy link
Member

PeterN commented Mar 28, 2023

#10574 works around RattRoads' issue, however with U&RaTT there are no town-buildable road types in 1900, even when hidden-but-town-buildable roads are allowed.

This means that previously the game was reverting back to the first road type, completely ignoring all of its properties.

@Ufiby
Copy link
Author

Ufiby commented Mar 29, 2023

You will be able to add a new feature, thanks to which some roads will be built only in cities inaccessible to players. But in the editor, the map is always available and even built by players.
ROADTYPE_FLAG_ONLY_SE ?

@PeterN
Copy link
Member

PeterN commented Mar 29, 2023

As #10546 prevented this, I don't see the need for a new flag to bring back the previous behaviour.

@andythenorth
Copy link
Contributor

The rationale (with no opinion from me for or against or any opinion at all)

[09:07]Emperor Jake (エコレールマーク): Some roadsets have a town roadtype that updates automatically while the player buildable ones are separate types
[09:13]andythenorth: updates for decor, surface etc?
[09:58]reldred: Yup.
[09:59]reldred: U&RATT most recent version is a good example of this, starts dirt, progresses through various asphalt styles
[09:59]reldred: the dirt is dirt in certain townzones and the city streets are either cobble/paving stone, etc depending on climate
[09:59]reldred: it's quite nice
[09:59]reldred: rattroads also does similar
[09:59]reldred: basically most of the 'complete' road sets use this technique

@FLHerne
Copy link
Contributor

FLHerne commented Mar 29, 2023

Why is it desirable for the 'magic' roadtype to not be player-buildable?

If it isn't, player alterations to town roads (e.g. to repair damage around other construction, improve bus routes, or just for aesthetics) will be mismatched or become so as the town roadtype changes.

I do a lot of 'patching up' town roads like that, often just one or two tiles at a time.

@TheMowgliMan
Copy link

Why is it desirable for the 'magic' roadtype to not be player-buildable?

If it isn't, player alterations to town roads (e.g. to repair damage around other construction, improve bus routes, or just for aesthetics) will be mismatched or become so as the town roadtype changes.

I do a lot of 'patching up' town roads like that, often just one or two tiles at a time.

Don't let the player build the magic roadtype.

Instead, have the town replace road with the magic roadtype when it grows. Of course, it's setting controllable.

@FLHerne
Copy link
Contributor

FLHerne commented Mar 29, 2023

Don't let the player build the magic roadtype.

Instead, have the town replace road with the magic roadtype when it grows. Of course, it's setting controllable.

  • This has never been possible so is an additional feature request, right?

  • Towns converting roads would be unwanted in many cases. You'd need a "should be converted" flag on types and some way to inform the player about that.

  • What problem would that solve compared to the player building "town" roads directly where appropriate?

@Andrew350
Copy link

Apologies for being a bit late to the discussion, but perhaps I can shed some light on our perspective on this roadtype issue.

The reason we NewGRF authors have been using the HIDDEN and TOWN_BUILD flags together is to define a roadtype which can be built by towns on map generation but are not meant to be built by the player. This is used to create a unique aesthetic at game start without cluttering the player's roadtype list with a useless roadtype for the rest of the game.

For example, in RattRoads there are two early roadtypes: dirt and sett pavement. If either of these were set to be town buildable, then all towns big and small would exclusively use only that roadtype on map generation. In order to make early towns look a bit more interesting I introduced a third, hidden, roadtype which displays as dirt road in the outskirts of town, and sett pavement in large city centers. This "magic" roadtype is hidden because the effect it produces is 100% reproducible by the player during gameplay by using the other already implemented roadtypes, thereby making this "special" roadtype completely superfluous to the player. Apparently the other affected NewGRFs have followed suit using a similar effect, as seen in this ticket.

Another example is Wasteland, where I use this same feature to generate "destroyed" roads on map generation, but since allowing the player to build new pre-destroyed roads during gameplay is completely nonsensical, I mark this special roadtype as hidden, again to avoid cluttering the build list with a useless roadtype.

I'll be honest: removal of this ability is a relatively minor issue in the grand scheme of things, basically resulting in an extra useless roadtype being shown in the build list. But the real issue is that we've been using this feature exactly as it was (seemingly) intended for the last 4-5 years or so, and to have it suddenly ripped away, thus breaking our NewGRFs and the game without being given an obvious reasoning as to why, is a little irritating.

Ultimately I don't care whether this patch is upheld or not - we can always make changes - but we would at least like to see the previously described behavior that we've been using all this time to be kept available in some form or another.

@rubidium42
Copy link
Contributor

Not that it directly affects the NewGRFs, though a game script has access to essentially all road types, even those you "declared" as "for town only". This as game scripts can build (some things) as owner town.

I previously made a change to allow game scripts to only build road types that are visible to the user or buildable by towns, and enforcing that. As before that it could literally build road types that did not even exist. #10546 was built on top of that.

I do not care whether it's ("user visible" and "town buildable") or only "town buildable" for determining whether a town may use the road. However, if it's only "town buildable", then game scripts will get ("user visible" or "town buildable") as filter to determine whether they are allowed to build that road. This as game scripts can build some things as town.

@auge8472
Copy link
Contributor

My two cents:

Also in my road set the type ROAD is a hidden road type (the only one). On the other side there are two road types (this and that), which are the two road types, that are defined as buildable by towns (with roadtype_flags: bitmask(ROADTYPE_FLAG_TOWN_BUILD);). Year dependent the towns build the one or the other road. Different from @Andrew350's system, in my set are these roads also buildable by the players (and I don't know any reason to forbid it) and therefore are visible. Because of the system with the road types, that are compatible with ROAD and are buildable by towns and are not hidden, my system works with the changes in #10546.

IMHO it is debatable to hide the ROAD road from the player. I know, there are road sets with a plenty of types, that really clutter the road type list (the set alone or in combination with further sets). Thatswhy I understand the wish to hide a few types, especially when they are meant to be buildabe by towns only (no entry for the road if the player cannot use the road type). I for myself think, that there is no reason to have a road type, that is buildable only by a town but not for me as a player. Other authors and players may judge this differently.

@Ufiby
Copy link
Author

Ufiby commented Apr 18, 2023

I know that there are sets of roads with a lot of types that really clutter up the list of road types.

It doesn't matter. OpenTTD can use 64 types.

In order to make early towns look a bit more interesting I introduced a third, hidden, roadtype which displays as dirt road in the outskirts of town, and sett pavement in large city centers. This "magic" roadtype is hidden because the effect it produces is 100% reproducible by the player during gameplay by using the other already implemented roadtypes, thereby making this "special" roadtype completely superfluous to the player.

Right. Similar to how U&RaTT has a "sequence" parameter in the "Used time epoch", a road that changes over time and none of them have the "TOWN_BUILD" flag set. Because the only reason why the "TOWN_BUILD" flag does not update roads automatically, except for creating maps and financing the repair of city roads. In case there are free roads by the end of the year, which will be tedious to lay around the city on a large map. Otherwise, in modern times, to say that dirt roads are being built in the city is ridiculous.
Description:
TOWN_BUILD
Enables the roadtype to be built by towns, picked by highest speed (defaults to ROAD if no speed limits?)

Another option and could it be better ?
TOWN_BUILD
Allows you to select the type of road by city depending on the time of year (defaults to ROAD "if used for 0 years"?)

Do you have a plan to redo the "TOWN_BUILD" flag to force the road to upgrade automatically?

@PeterN
Copy link
Member

PeterN commented Apr 19, 2023

63 types.

There is zero player/author feedback on the proposal in #10582 or #10585, so we can probably assume that nobody is interested in having this changed...

@PeterN
Copy link
Member

PeterN commented Apr 25, 2023

So far you're up to no comments on #10582 and one comment on #10585...

@2TallTyler
Copy link
Member

@PeterN Was this resolved by #10585?

@PeterN
Copy link
Member

PeterN commented Dec 23, 2023

Nobody has been complaining since, so I assume so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: NewGRF This issue is related to NewGRFs
Projects
None yet
Development

No branches or pull requests