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

Feature: setting for more flexible town spacing #7745

Draft
wants to merge 1 commit into
base: master
from

Conversation

@Eddi-z
Copy link
Contributor

Eddi-z commented Sep 16, 2019

This is an old patch i found on my disk, from around 2011, that i don't remember how complete it was

It allows more flexibility in specifying road layouts by setting the minimum distance between parallel roads in either a "natural" (randomized) or a "grid" (fixed) pattern

during rebasing, i kinda fudged the AI bits, which were not present in the original patch. there probably needs to be some kind of compatibility layer, which i have no clue how it works

@Eddi-z

This comment has been minimized.

Copy link
Contributor Author

Eddi-z commented Sep 17, 2019

a screenshot made with a simpler version of the patch:
screenshot1

old forum discussion: https://www.tt-forums.net/viewtopic.php?p=982943#p982943

@Eddi-z

This comment has been minimized.

Copy link
Contributor Author

Eddi-z commented Sep 17, 2019

What's definitely missing is a rework of the scenario editor gui for selecting road layout

@nielsmh

This comment has been minimized.

Copy link
Contributor

nielsmh commented Sep 17, 2019

This is totally an OpenTTD 2.0 feature (by which I mean we should merge it ASAP and call the version 2.0)

@andythenorth

This comment has been minimized.

Copy link
Contributor

andythenorth commented Sep 18, 2019

Tested with min 4, max 6.

Results from a few random new maps are compelling. I didn't run a long game yet to see results as towns grow.

Observations

  • looks better IMO
  • doesn't create enough gaps to trivially build rail stations or smaller airports in towns (I think this would be useful, but maybe hard to achieve)
  • does create enough gaps to ease building tunnels, bridges, rails, RV depots etc in towns
  • I noticed in rare occasions, 1x1 buildings placed with no adjacent road tile, I wasn't sure if that was intended

Related idea, it would be helpful if towns built more bridges of n+1 or n+2 length instead of n. Town bridges tend to be a constraint that block potential routes, and they're non-removable. Creating bridge spans over empty tiles allows routing under the bridge, makes river corridors a viable route into towns. Case could even be made that it's realistic (flood arches) 😺 I put a crude 'delta + 1' hack into GrowTownWithBridge, which works for NE-SW direction only, appears to break bridges for other directions, out of my depth here. Would be a different PR anyway.
bridge_n_plus_1

@Eddi-z

This comment has been minimized.

Copy link
Contributor Author

Eddi-z commented Sep 18, 2019

* I noticed in rare occasions, 1x1 buildings placed with no adjacent road tile, I wasn't sure if that was intended

that does not sound like anything this patch should cause, so this is likely existing master behavior

@nielsmh

This comment has been minimized.

Copy link
Contributor

nielsmh commented Sep 18, 2019

I've seen mentioned that if a 2x2, 2x1, or 1x2 building is replaced with a 1x1 building, the 1x1 building is always in the top corner of the replaced building, which may be away from a road.

@andythenorth

This comment has been minimized.

Copy link
Contributor

andythenorth commented Sep 18, 2019

I've seen mentioned that if a 2x2, 2x1, or 1x2 building is replaced with a 1x1 building, the 1x1 building is always in the top corner of the replaced building, which may be away from a road.

Non-issue for this PR then 👍

@Eddi-z

This comment has been minimized.

Copy link
Contributor Author

Eddi-z commented Sep 18, 2019

Note that i am touching some code containing calls to "GrowTownWithExtraHouse", where "extra house" means "fill in the middle of a 3x3 grid", which would not directly touch any roads. IIRC this requires roads on at least 3 sides, 1 tile away.

case TL_3X3_GRID:
if ((grid_pos.x & 3) < 2 || (grid_pos.y & 3) < 2) return false;
case TL_GRID:
grid_pos.x = Mod(grid_pos.x, t->spacing + 1);

This comment has been minimized.

Copy link
@LordAro

LordAro Nov 2, 2019

Member

Not a fan of this weird mod thing. Why is it that % doesn't work / produce desirable results ?

This comment has been minimized.

Copy link
@Eddi-z

Eddi-z Nov 2, 2019

Author Contributor

% rounds towards 0, whereas this Mod function rounds towards -infinity, which does different things for negative numbers.

using plain % would thus create special cases

@andythenorth

This comment has been minimized.

Copy link
Contributor

andythenorth commented Nov 2, 2019

I experimentally increased MAX_TOWN_SPACING to 12.

I think it's of benefit when player wants grid layouts with space for infrastructure. Examples attached showing grids with min 8 and max 12. There were no really pathological examples when I tested.

Obviously the centre of towns looks odd, as large buildings are adjacent to empty green space. But that can be avoided by choosing lower grid spacing. Player choice eh.

For the natural town layout, increasing the grid spacing is a neutral choice. Towns work fine, there's no real gameplay benefit for spacing 8 or 12 compared to 6, and no pathological effects.

For the grid layouts, the improvement I see is for players who want to build metro / urban train networks, where the empty areas can accommodate short stations and tunnel entrances etc.

7745_3

7745_1

7745_2

@LordAro LordAro added this to the 1.11.0 milestone Nov 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.