The International Simutrans Forum

Development => Bug Reports => Topic started by: Giziar on October 19, 2014, 02:24:06 PM

Title: [r7332] Newly built townhall got built a bit away from town
Post by: Giziar on October 19, 2014, 02:24:06 PM
Here you have the lovely town of Nootdorp:

(http://i61.tinypic.com/2nc2i36.jpg)

And here is the townhall of Nootdorp:

(http://i59.tinypic.com/s5e720.jpg)

As you can see here it's built a bit away from the town. The road towards it was laid down at the same time as the townhall got built. It is now located about 100 tiles North and 100 tiles West of the town. Obviously there was space enough closer to town.

(http://i58.tinypic.com/2uzxv2f.jpg)

To be fair, it's not bothering me much but I found it peculiar.
Title: Re: [r7332] Newly built townhall got built a bit away from town
Post by: Václav on October 19, 2014, 04:30:32 PM
Giziar,

new townhalls are built in original places - unless there are buildings like monuments or curiosities (that cannot be demolished, excepting you do it manually from public service player).

It seems like game searches for empty place at first (if new townhall cannot be placed in original place) - and then game searches else ways. I found it some time ago too - playing pak96.comic that has townhalls of three sizes (1 tile, 1*2 tiles and 2*2 tiles).

But that townhall was placed so far from town is really strange.



I think that if you would take a look on behaviour of some governments, you would find more crazy cases of moving of any bureau.  :o



Tip for next times: disable showing of stop coverage and names of stops. Showing of both made that screenshot very confusing.
Title: Re: [r7332] Newly built townhall got built a bit away from town
Post by: prissi on October 19, 2014, 09:19:52 PM
I never saw this once. If this continues I would suggest to download simutrans again. Otherwise I would put this to a alpha pariticle altering the register just during calulation ...
Title: Re: [r7332] Newly built townhall got built a bit away from town
Post by: DrSuperGood on October 20, 2014, 03:31:16 AM
If you look closely there appears to be a house near the new townhall. Maybe it belongs to the town before the townhall was made and so it thought that the road was a valid town hall location inside the town area. However it also could have appeared after the townhall was made as a result of the town expanding to fit it in.

Title: Re: [r7332] Newly built townhall got built a bit away from town
Post by: eipi on October 20, 2014, 08:29:02 AM
My guess is that the new town hall can not be built in all climates - notice the different colours of the grass near the new town hall. This might be pakset specific.
@Giziar: Do you use pak64 or pak64.german?
Title: Re: [r7332] Newly built townhall got built a bit away from town
Post by: Ters on October 20, 2014, 04:35:24 PM
Quote from: eipi on October 20, 2014, 08:29:02 AM
My guess is that the new town hall can not be built in all climates - notice the different colours of the grass near the new town hall. This might be pakset specific.
@Giziar: Do you use pak64 or pak64.german?

I think the (dis)coloring of the grass is the catchment area of the stop, but looking at the minimap, you might still be on to something.
Title: Re: [r7332] Newly built townhall got built a bit away from town
Post by: Giziar on October 20, 2014, 04:48:23 PM
@DrSuperGood: the house near the new townhall was built shortly after the new townhall appeared.

@eipi: pak64. Also I think you won the jackpot. The original town is all in the sub-tropical climate. The newly built townhall is just on the edge of the temperate climate and it looks like this was the closest by option which had temperate climate.

Checked the rest of the towns on my map. I think there's one town with not enough space in the temperate climate to allow for expansion and possibly two others as well. Curious where they end up :)
Title: Re: [r7332] Newly built townhall got built a bit away from town
Post by: Ters on October 20, 2014, 05:46:57 PM
There is one town hall in pak64 that doesn't like all climates (well, none likes deserts), and that's a special type only built between 1400 and 1929. Before 1805, it's the only type available. Will the game try another type of town hall if the one initially selected can't be placed inside the town, or will it stick to it and rather go far away looking for a suitable climate. Or maybe this town hall was built before the more "adaptable" town halls became available?
Title: Re: [r7332] Newly built townhall got built a bit away from town
Post by: Giziar on October 20, 2014, 06:20:19 PM
This specific new townhall was built in 1931
Title: Re: [r7332] Newly built townhall got built a bit away from town
Post by: DrSuperGood on October 20, 2014, 06:25:31 PM
Townhalls being special structures should have a very well defined order of precedence.

When founding a town the town hall probably should be chosen as follows...
1. Look up all townhalls for the appropriate town size (also filter by timeline).
2. Filter by target location climate, building the first (or random) one which matches.
3. Since none matched, look around the immediate (5-7 tiles?) for a climate which does match one and build it.
4. If the game has the setting "townhall_strict_climate" set then throw an error saying the build location is invalid.
5. Choose the first (or random?) townhall and build it at the location ignoring climate completely.

Upgrading a town hall probably should be chosen as follows...
1. Look up all townhalls for the appropriate town size (also filter by timeline).
2. Filter by current townhall location climate, building the first one which matches.
3. If the new townhall is bigger try and place it over the exiting one by demolishing buildings (and/or road with low monthly usage?).
4. If multiple sizes are available try placing a smaller size over the existing town hall.
5. Look around the town area for an appropriate build space for the new townhall, accepting alternative climate types that the building alllows.
6. Look around the town area for an appropriate build space for any appropriate size town hall, in case others allow for different climates that are in the town area.
7. If the game does not have the setting "townhall_strict_climate" set then build the first (or random), preferring one of the size to fit partly over the last one ignoring climate placement.
8. Fail to upgrade the townhall, keeping the existing one intact (maybe send out a problem notification "Plans to build new town hall in X put on hold due to planning problems.").
9. Try again later (new townhall types may be available as time progresses, town might also expand to include new climate types)?

Some randomness could be added in the case of choices which are equally valid. This would be great if there are dozens of townhall art for the same development progress to allow for some variation between towns in the same climate. In real life very few town halls are exact clones.

Under no circumstance should a new townhall expand the town area, or if it does so it should only be by being placed directly on the town border. It should never become disconnected from the town area by a huge space as shown above as that just is not logical (rather not upgrade than upgrade in such a nonsense way).

That said, pak authors should make sure town halls are available for most climates unless specifically desired (maybe no towns on permafrost or sand desert?). There should probably be a "universal" (any) climate which basically skips all climate tests as that would be a lot more future compatible in case any more climates are added during development.
Title: Re: [r7332] Newly built townhall got built a bit away from town
Post by: Ters on October 20, 2014, 07:24:26 PM
Quote from: Giziar on October 20, 2014, 06:20:19 PM
This specific new townhall was built in 1931

So this only happened when the town hall was upgraded?
Title: Re: [r7332] Newly built townhall got built a bit away from town
Post by: Giziar on October 20, 2014, 07:32:00 PM
Quote from: Ters on October 20, 2014, 07:24:26 PM
So this only happened when the town hall was upgraded?

Aye. Got the message that "Nootdorp has built a new townhall when it reached 5236 population" and when I checked it out I noticed the out of town townhall
Title: Re: [r7332] Newly built townhall got built a bit away from town
Post by: Ters on October 20, 2014, 08:35:10 PM
Strange, because it should have been the previous town hall that could not have been in the town, if it even was of that type.
Title: Re: [r7332] Newly built townhall got built a bit away from town
Post by: prissi on October 20, 2014, 11:05:44 PM
What the game does is indeed checking if there is a suitable townhall for the climate. If not, no town will be founded. When upgrading then old climate is used to search for the new townhall. Somehow the climate information must have be changing for the town. Did you fiddle with the climate settings after generating the game?

QuoteUpgrading a town hall probably should be chosen as follows...
1. Look up all townhalls for the appropriate town size (also filter by timeline).
2. Filter by current townhall location climate, building the first one which matches.
3. If the new townhall is bigger try and place it over the exiting one by demolishing buildings (and/or road with low monthly usage?).
4. If multiple sizes are available try placing a smaller size over the existing town hall.
5. Look around the town area for an appropriate build space for the new townhall, accepting alternative climate types that the building alllows.
6. Look around the town area for an appropriate build space for any appropriate size town hall, in case others allow for different climates that are in the town area.
7. If the game does not have the setting "townhall_strict_climate" set then build the first (or random), preferring one of the size to fit partly over the last one ignoring climate placement.
8. Fail to upgrade the townhall, keeping the existing one intact (maybe send out a problem notification "Plans to build new town hall in X put on hold due to planning problems.").
9. Try again later (new townhall types may be available as time progresses, town might also expand to include new climate types)?
Simutrans selects a matching random one from all matching. If there is no match, no upgrade will be done. A bigger townhall will almost never work, since there are roads and roations involved. But if same and smaller size Simutrans will try to keep the same location. It currently only does not do number 7 from your list. 6 will never work for small towns, (like 6x3 town area) so a strict check of border is not possible. However, the  current implementation may be too tolerant. Maybe the update should rather fail than go too far.
Title: Re: [r7332] Newly built townhall got built a bit away from town
Post by: Giziar on October 21, 2014, 04:57:04 PM
Quote from: prissi on October 20, 2014, 11:05:44 PM
What the game does is indeed checking if there is a suitable townhall for the climate. If not, no town will be founded. When upgrading then old climate is used to search for the new townhall. Somehow the climate information must have be changing for the town. Did you fiddle with the climate settings after generating the game?

Game was started in 1.11, later upgraded to 1.20, later upgraded to Nightly7332.
After playing the game for a while I did run a test game and fiddled with the climate settings. However in-game nothing seems to have changed (before I was not allowed to start cities in sub-tropical and I still am not allowed). Maybe a result from upgrading from earlier versions?
Title: Re: [r7332] Newly built townhall got built a bit away from town
Post by: prissi on October 21, 2014, 10:07:52 PM
I guess. But still there will be sooner or later a safeguard against moving the townhall too much. Maybe tomorrow.