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

Number of towns is silently limited if town name generator runs out of names #8088

Open
agentw4b opened this issue Apr 15, 2020 · 9 comments
Labels
bug Something isn't working

Comments

@agentw4b
Copy link

agentw4b commented Apr 15, 2020

Version of OpenTTD

OpenTTD 1.10.0 (Maybe also older or newer ...)

Expected result

The ability to create thousands of cities or towns , just like other game countries.

Actual result

More than 327 Finnish cities or towns cannot be created.

Steps to reproduce

Create more than 327 Finnish cities or towns.

@agentw4b agentw4b changed the title More than 327 Finnish cities cannot be created. More than 327 Finnish cities or towns cannot be created. Apr 15, 2020
@James103
Copy link
Contributor

  1. What NewGRFs are you using?
  2. Are you using the OpenTTD supplied Finnish town name set?
  3. Can you reproduce this with other OpenTTD-supplied town name sets?

@agentw4b
Copy link
Author

  1. No NewGRF
  2. Game Options/Town Names/Finnish
  3. Thousands of cities can be created with English and Czech city names, but with a Finnish set of only 327 cities. Normally, I don't use the Finnish name set. I ran into the problem by accident.

@agentw4b
Copy link
Author

The problem was found in the discussion on the JGRPP version forum, but I found that the problem is not in JGRPP but in OpenTTD.

https://www.tt-forums.net/viewtopic.php?f=33&t=73469&start=2720

@Eddi-z
Copy link
Contributor

Eddi-z commented Apr 16, 2020

This problem exists with several of the town name generators, especially some NewGRF ones. Back when they were introduced, we had only 256x256 maps, which never had much more than 100 towns. but now we have 4kx4k maps which can easily fit 10k towns, and the town name generators run out of names.

unfortunately, we cannot really modify the town name generators, as that might break(*) old savegames.

(*) they could still be loaded, but the names will be diffferent, and duplicates may appear.

@JGRennison
Copy link
Contributor

(Ignoring the savegame compatibility issue momentarily).

The Finnish town name tables and algorithm should support 780 names (which is better than 327 but still quite poor).
31 using "real" table.
27 using table 1.
722 using table 1/2 + table 3.

The use of SeedChance is such that which method to use and the indices into the various tables are linearly related due to use of overlapping or the same parts of the seed bits.
In general SeedChance and related methods are not a good way to extract bits from a random seed.

@lanurmi
Copy link

lanurmi commented Apr 17, 2020

While it is entertaining to point out how bad the Finnish name generator is, as @Eddi-z pointed out, it was made back in the days when maps were smaller, and running out of unique town names was not an issue. And also it is not likely to be the only generator suffering from the same problem.

Additionally, at the time (~15 years ago) there was no specification as to how many unique names should a generator be able to produce. Is there such a specification even today?

Moreover, the fact that generators can never ever be modified due to save game compatibility is clearly a design flaw of OpenTTD itself, not of any particular generator.

@nielsmh
Copy link
Contributor

nielsmh commented Apr 17, 2020

Can we somehow keep the original (broken) Finnish generator around while also making an improved/fixed one? The original only gets used during savegame loading, to convert all town names into strings (as if they were renamed by the player) rather than the seed, and the new generator gets used for all new towns in old and new games.

@TrueBrain TrueBrain added the bug Something isn't working label Jan 1, 2021
@LordAro LordAro changed the title More than 327 Finnish cities or towns cannot be created. Number of towns is silently limited if town name generator runs out of names Feb 1, 2021
@Wuzzy2
Copy link
Contributor

Wuzzy2 commented Feb 1, 2021

Relevant: https://www.tt-forums.net/viewtopic.php?f=29&t=88477

The French town name generator is even worse, it's only 70 unique names.

Here are some possible solutions that would always work, but they might not be the prettiest:

  1. When the town name generator runs out of names, start to generate fallback names (appending numbers to existing names, etc.)
  2. Specify an optional fallback town name generator for all generators. If the generator runs out of names, switch to the fallback generator. If that one runs out as well, switch to the fallback of that generator. The default fallback town name generator is English.

Example for 2: If you selected Swiss town names, and run out, switch first to Austrian, then to German, then to English.

These solutions are not very pretty, but at least they guarantee that every town gets an unique name.

At the very least, a warning should be shown if the town name generator ran out of names.

Finally, I suggest a rule for official new town name generators. They should at least generate 5,000 unique names, and have been throughly tested before they find their way into the game. 5,000 because that's the current maximum of towns you can generate.

@James103
Copy link
Contributor

James103 commented Mar 2, 2021

5,000 because that's the current maximum of towns you can generate

Actually, you can get way more than 5,000 towns. To verify, use the following map settings:
image
and start the game with the following Game Script (that prints the names of all towns, followed by how many towns there are):
Town Name Dump.zip

Example output (the final number at the end is the number of towns generated):
image

With this method, you can get somewhere between 11,000 - 13,000 towns in your game, instead of only 5,000, provided that your town name generator has enough names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants