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

Smarter random town names #7037

Closed
nikolas opened this issue Jan 11, 2019 · 6 comments
Closed

Smarter random town names #7037

nikolas opened this issue Jan 11, 2019 · 6 comments
Labels

Comments

@nikolas
Copy link
Member

@nikolas nikolas commented Jan 11, 2019

I would like a feature that attempts to name towns appropriately. For example, when random names are chosen, only towns that are near water will be chosen to be named things like "Puerto Ayacucho" (in Spanish), or something like "Vandhavn" (in Danish).

@nielsmh

This comment has been minimized.

Copy link
Contributor

@nielsmh nielsmh commented Jan 11, 2019

I suppose you could try to determine some "feature bits" for town construction by sampling the terrain in a radius around the site. If sufficient samples are water you get a water-feature bit, if there's sufficient elevation differences you might get a hill/mountain feature bit. However I can't really think of any more useful features to test for, since many landscape features would be hard to detect (lake vs. coast vs. fjord), many aren't well modeled by the game (like natural resources), and some (like industries) are dependent on the town already existing.

@nikolas

This comment has been minimized.

Copy link
Member Author

@nikolas nikolas commented Jan 11, 2019

I see, thanks for the insight. I just thought it would be kind of a fun feature to try and implement. Maybe I'll put a PR together this weekend.

We could also use the water distance to infer things like, "okay, never put Paris on a coast, because in real life it's not on a coast". Maybe that's a bit much though.. since if you're interested in realism like that you can just use a custom France heightmap or something.

@andythenorth

This comment has been minimized.

Copy link
Contributor

@andythenorth andythenorth commented Jan 11, 2019

The obvious features I could think of:

  • near coast (any climate)
  • in desert (sub-tropic)
  • in rainforest (sub-tropic)
  • above snowline (sub-arctic)
  • above height level x (any climate)

Not sure enough town names sets would take advantage of it to be worthwhile, but it's a nice idea :)

@nielsmh

This comment has been minimized.

Copy link
Contributor

@nielsmh nielsmh commented Jan 11, 2019

I imagine having two bit-fields per name (part), a mask and a value. The location bits calculated for the new town site would be AND-masked by the mask, then compared to the value. If equal, the name (part) is a candidate. This will allow specifying locations where the name would be valid and locations where it would never be valid, and locations that would be required for it.

Pseudocode:

uint site_location_bits = GetLocationBits(tile);
vector<TownName> candidates;
for (var name : all_town_names) {
    if (name.location_bits == (site_location_bits & name.location_mask)) {
        candidates.push_back(name);
    }
}
string town_name = SelectTownName(candidates);
nikolas added a commit to nikolas/OpenTTD that referenced this issue Jan 12, 2019
nikolas added a commit to nikolas/OpenTTD that referenced this issue Jan 13, 2019
nikolas added a commit to nikolas/OpenTTD that referenced this issue Jan 13, 2019
nikolas added a commit to nikolas/OpenTTD that referenced this issue Jan 13, 2019
nikolas added a commit to nikolas/OpenTTD that referenced this issue Jan 13, 2019
nikolas added a commit to nikolas/OpenTTD that referenced this issue Jan 13, 2019
nikolas added a commit to nikolas/OpenTTD that referenced this issue Jan 13, 2019
nikolas added a commit to nikolas/OpenTTD that referenced this issue Jan 13, 2019
I found a bunch of minor grammar problems when reading the town name
generation code related to OpenTTD#7037.
nikolas added a commit to nikolas/OpenTTD that referenced this issue Jan 13, 2019
nikolas added a commit to nikolas/OpenTTD that referenced this issue Jan 13, 2019
nikolas added a commit to nikolas/OpenTTD that referenced this issue Jan 13, 2019
nikolas added a commit to nikolas/OpenTTD that referenced this issue Jan 13, 2019
nikolas added a commit to nikolas/OpenTTD that referenced this issue Jan 17, 2019
nikolas added a commit to nikolas/OpenTTD that referenced this issue Jan 17, 2019
nikolas added a commit to nikolas/OpenTTD that referenced this issue Jan 17, 2019
This adds structure for some basic town naming rules based on location.

When towns are generated, a mask is read for the random name, to see if
it's a suitable name for this town tile. Currently it just prevents
towns from being named with "Puerto" or "havn" if they're not near the
water, and will only do anything on Latin-American, Danish, or Norwegian
town names.
nikolas added a commit to nikolas/OpenTTD that referenced this issue Jan 17, 2019
This adds structure for some basic town naming rules based on location.

When towns are generated, a mask is read for the random name, to see if
it's a suitable name for this town tile. Currently it just prevents
towns from being named with "Puerto" or "havn" if they're not near the
water, and will only do anything on Latin-American, Danish, or Norwegian
town names.
nikolas added a commit to nikolas/OpenTTD that referenced this issue Jan 17, 2019
This adds structure for some basic town naming rules based on location.

When towns are generated, a mask is read for the random name, to see if
it's a suitable name for this town tile. Currently it just prevents
towns from being named with "Puerto" or "havn" if they're not near the
water, and will only do anything on Latin-American, Danish, or Norwegian
town names.
nikolas added a commit to nikolas/OpenTTD that referenced this issue Jan 22, 2019
This adds structure for some basic town naming rules based on location.

When towns are generated, a mask is read for the random name, to see if
it's a suitable name for this town tile. Currently it just prevents
towns from being named with "Puerto" or "havn" if they're not near the
water, and will only do anything on Latin-American, Danish, or Norwegian
town names.
@Simons-Mith

This comment has been minimized.

Copy link

@Simons-Mith Simons-Mith commented Jan 22, 2019

Just came across this - I suggest looking at the Wesnoth placename generator a) for inspiration as to the types of features you could base naming on and b) because Wesnoth also names [some of] the features. You can have a River Tal, and then a Talford, and a Talmouth. Rivers, Hills, Valleys, Peaks, Fords, Bridges, Castles, Marshes, Moors, Deserts, Woods, Plains, Lakes, Seas, Bays, Harbours, Springs etc. Seeing how the placename generation is hooked in to the terrain generator may also be of use.

And you don't need many towns to take advantage for it to become a worthwhile addition, because even if only a few do, the fact that some do still adds verisimilitude to the map as a whole.

@stale

This comment has been minimized.

Copy link

@stale stale bot commented Mar 23, 2019

This issue has been automatically marked as stale because it has not had any activity in the last two months.
If you believe the issue is still relevant, please test on the latest nightly and report back.
It will be closed if no further activity occurs within 7 days.
Thank you for your contributions.

@stale stale bot added the stale label Mar 23, 2019
@stale stale bot closed this Mar 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.