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

Buildings "wander" north away from roads #7604

Closed
MingweiSamuel opened this issue May 23, 2019 · 4 comments
Closed

Buildings "wander" north away from roads #7604

MingweiSamuel opened this issue May 23, 2019 · 4 comments
Labels
bug Something isn't working
Milestone

Comments

@MingweiSamuel
Copy link
Contributor

MingweiSamuel commented May 23, 2019

Buildings "wander" away from roads in the negative x and negative y directions. As suggested by Eddi|zuHause on irc, this seems to happen when a lot larger than 1x1 is replace by a 1x1 lot, then that in turn is replaced by a larger lot again. When the 1x1 lot replaces a larger lot, it always goes in the top corner (-x, -y dir), which means buildings can slowly move north over time. This process seems to take maybe 6-10 in-game years. See attached pictures.

image

image

I have observed this happening with the Total Town Replacement Set new GRF, so it may be related to that GRF, or the GRF may have some changes that exacerbate this problem. I'll test in vanilla soon
happens in vanilla as well

Version of OpenTTD

1.9.1

Expected result

Buildings should be built adjacent to roads.

Actual result

Buildings are able to move away from roads when they are replaced

Steps to reproduce

Build a city. Make some busses so it'll grow. Make sure "towns are allowed to build roads" is off. Fast forward, over time this will begin to happen.

@TrueBrain TrueBrain added bug Something isn't working needs triage This issue needs further investigation before it becomes actionable labels Jan 3, 2021
@TrueBrain TrueBrain added this to the 1.11.0 milestone Jan 5, 2021
@erenes
Copy link

erenes commented Jan 6, 2021

I can confirm this happens in 1.10.2 as well.

Specifically I saw a football stadium being replaced with houses, then a stadium again, and another house, resulting in a house 2 tiles away from the road.

1987: image
1989: image

@andythenorth
Copy link
Contributor

Would it be convenient to have a house and industry check 'at least one tile of a house/industry layout is adjacent to road'?

This could be used by the house placement algorithm, and exposed as a newgrf house/industry var.

It is possible for newgrf industry to check for adjacent road currently, but it's fiddly to do.

@TrueBrain
Copy link
Member

The code to replace houses is lovely naive:

		ClearTownHouse(t, tile);

		/* Rebuild with another house? */
		if (GB(r, 24, 8) >= 12) BuildTownHouse(t, tile);

So yeah, there is a good chance this happens :D It also means it doesn't really wander off, as in, it doesn't continue to happen, I think. At most, with non-grid layouts, a house can be 2 tiles away from a road :)

@TrueBrain
Copy link
Member

TrueBrain commented Jan 6, 2021

Nope, I am wrong; it can truly wonder. Chances are very slim, but it is possible :D When a 2x2 house is build, it can put it in all directions .. so yeah, truly "wandering" :D

image

TrueBrain added a commit to TrueBrain/OpenTTD that referenced this issue Jan 6, 2021
…hen rebuilding

When a multi-tile house is rebuild, it always used the most northern
tile to build the new house. This can very easily lead to houses
wandering off in the north-ish direction (either NW or NE).

To prevent this, pick the tile closest to town center when rebuilding
on a multi-tile house. This still means a house can be build away
from a road, but it is no longer wandering around finding another
town to call home.
@TrueBrain TrueBrain removed the needs triage This issue needs further investigation before it becomes actionable label Jan 6, 2021
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

4 participants