### Author Topic: More rules for existing building rotations  (Read 1041 times)

0 Members and 1 Guest are viewing this topic.

#### Leartin

##### More rules for existing building rotations
« on: April 03, 2017, 02:31:44 PM »
We currently have 8 rotations for citybuildings, which are used when there is a road on one side, or on two sides next to each other.

If there is no road on any of the four sides of the building, or three+ roads, then the building is buildt with random rotation. I think the 8 existing rotation could be reused in different situations, which would make a bit more sense than just 'random'.

To explain, imagine there are 8 spots around the building B, which could be roads.
Code: [Select]
`1 2 34 B 56 7 8`
So for example, if 2 and 4 were roads, B would be a corner-piece, right? I think, if nothing but 8 was a road, it should be the same corner piece. And for all corners:
24 -> 8
25 -> 6
47 -> 3
57 -> 1
The reasoning is simple. If 8 is a road, but 5 is not, chances are there is a building at 5. That building could be a rowhouse, and if so, it would either be straight and a adjusted to 8, or there is a road to the right and it's a corner piece. Either way, it would connect to B. The same is true for 7 - therefore, B should be a corner piece connecting to 5 and 7.

If 2 was the only road, B would be a straight piece. If 7 was a road, B would also be a straight piece. So it should be either of these two straight pieces if 2 and 7 both were a road, or if 2,7 and 5 were roads, or if 2,7 and 4 were roads.
2/7 -> 27; 247; 257
4/5 -> 45; 245; 457
The reasoning is that if you have a one-tile-thick block, buildings in that block should still connect, rather than them all showing the connection side to the road. It also works neatly with the inverted corners from above.

What if 1 and 3 were roads? In that case, act as if 2 was a road:
2 -> 13
4 -> 16
5 -> 38
7 -> 68

Reasoning is, that the straight pieces look usually better than the corner pieces, and these have the highest chance of connecting to similar buildings to both sides.

For the rest, it really is random.

#### prissi

• Developer
• Posts: 8698
• Total likes: 300
• Languages: De,EN,JP
##### Re: More rules for existing building rotations
« Reply #1 on: April 03, 2017, 11:42:41 PM »
Most cityrules favour straight roads. Hence, if 8 is a road, the it depends very much on the direction of 8 what is most likely next. If there is a gap between buildings, then this is very likely filled with a road. If there is no gap, well then this should be the next house.

B becoming a corner with a road in 8 is unlikely (depending on cityrules) because the probability for a road o extend straight is the highest.

Imho, the house rotation rules should check also for buildings in case of a single street tile. (But most cityrules will not allow such buildings, becasue this will have a very fast spread of buildings.)

Imho, I am not convinced that the situation your describe is a real game scenario given the existing cityrules.

#### Leartin

##### Re: More rules for existing building rotations
« Reply #2 on: April 04, 2017, 11:31:06 AM »
I was under the impression that with each renovation, rotation is checked seperately for the new building replacing the old one, rather than using the rotation the previous building had. Which makes sense, given that not all buildings have all rotations, and you can't select a rotation that does not exist for manually placed buildings. So this is not about where roads will be placed in the future at all.

Just take a look at the (very ugly, paint-compressed) attachment. Non of these buildings have special rotations, but let's assume they all will upgrade to become rowhouses. At a later point.
All of them would use the current rules for rotations, except for those in circles, which would be random - and which I suppose to be pretty much "inverted corners".

Since I'm not at my pixel-PC, let's use an older screenshot to show what I mean:

Just imagine the plazas on the corners would be roads. With the current rules, the inner 4 buildings would be random. The very first 'new' rule (and most important one to me) would allow for these 'inverted corners' to spawn naturally.

Just to mention it myself: This would not work well with all 8-directional buildings. Especially those which differentiate greatly between the front-side and the yard-side of the rowhouse. For those, "inverted corners" would require additonal graphics, which are not part of this request - I'm trying to keep it simple here.
« Last Edit: April 04, 2017, 12:22:12 PM by Leartin »

#### prissi

• Developer
• Posts: 8698
• Total likes: 300
• Languages: De,EN,JP
##### Re: More rules for existing building rotations
« Reply #3 on: April 04, 2017, 01:03:35 PM »
I fail to see how any rules could spawn such a "circle" as above. Or rather, with the current rules, it should spawn, if the roads are already like that. (But as said, it is extremly unlikely that cityroads would spawn like that. There is a 70-80% porbability of generating a straight road tile next, if there was already a straight road tile. I rearely see building rules like

...
.h.
..s

Because those would spawn houses in random places. So all building rules, which do not fille empty places between houses are with two street tiles or more.

And a said before, one could think for the inner house rotaion to take their neightbour`s one, starting with the left neighbour.

#### Leartin

##### Re: More rules for existing building rotations
« Reply #4 on: April 04, 2017, 03:25:02 PM »
No, the "circle" as a whole cannot be spawned naturally, that was just a quick example since I could not make a proper screen.

Buildings that only connect to a road via corner do spawn, at least in p192c we do have them in the rules. This following screen is entirely game-generated:

The black building in the center only connects diagonally to a road. And it's good that these buildings exist - roads should never spawn without connection to existing roads, and empty spots in a city are not really good, especially if they are easily visible (the tile to the west of the black building is empty as well, but it's hidden behind buildings and would just be a backyard garden)
Now I don't know if the rules are
Code: [Select]
`....h...s`or something more like
Code: [Select]
`....hh.hs`but as far as I am concerned, that does not really matter for the rotation of the building. It's just a fact that there are buildings that only connect to a road via a corner.

Now, looking at the screenshot again, only two buildings have a 'wrong' rotation. One is the black building at the center, which should be an inverted corner to connect to the two orange buildings to the south and east.
The other is the turquoise building at the south-east corner of that block, which faces to the south road, while it should face east (or west), to connect to the building north of it.

here is a manually corrected version of the same building block:

Something I did not notice before though: The turquise building was not randomly wrong, it actually follows some rule.
The following was created manually, with the "auto" rotation setting:

Buildings which have roads to three sides always face the middle of the three roads, buildings with road to the south and north always face south, buildings with road to the west and east always face east. I don't think that's a good solution, here is what it ought to look like:

I hope the images make it a lot clearer what I'm after.

#### TurfIt

##### Re: More rules for existing building rotations
« Reply #5 on: April 05, 2017, 02:05:36 AM »
I think the images make it crystal clear. It looks like when there's multiple roads surrounding the building, and hence multiple choices for the rotation to face the street, the logic needs to pick the same rotation as the already existing adjacent building.  Your last image with the buildings all neatly aligned looks much more realistic than the jumble that is the middle image. But also a little too uniform - perhaps a random choice for the first buildings (i.e. when no adjacent building) so they don't always face east or south.

#### Leartin

##### Re: More rules for existing building rotations
« Reply #6 on: April 05, 2017, 05:03:04 AM »
If it's a single line of buildings, there is little choice. If the building line stretches south-north, all buildings kinda have to face either east or west to create a block with adjecent buildings.
Of course it looks very uniform in the screenshot, because it's only one single building, and very uniform roads. If it were several different buildings, like in the first screenshot, it would not be that uniform, just neat. And of course, the cityrules don't generate a road-net like that.

I still think adding some checks about the position of streets would be enough to give better results. Of course, giving buildings "ribis" or something complicated like that might give even better results, I just don't know if it's worth it.

#### Ters

• Coder/patcher
• Devotee
• Posts: 4577
• Total likes: 167
• Languages: EN, NO
##### Re: More rules for existing building rotations
« Reply #7 on: April 05, 2017, 06:06:50 AM »
A bit on the side, but several of these flat top buildings lack some side edges on the roof. I guess that makes sense if two identical buildings are side by side, but considering how unlikely that apparently is, it would perhaps be better if they always had them. It looks really odd when the next nearer building is lower, and I suspect that having an edge next to a higher building won't look quite as out of place. (The higher building could have come later.) I don't have too much experience with such kinds of buildings, at least in how they look from above, but the likelihood of two non-identical buildings having the same height, even if they have the same number of floors, is very low.

And the turquoise building doesn't look that oddly rotated, although that might only be because I can only see it from one angle that obscures any potential gap between it and the next building.

#### prissi

• Developer
• Posts: 8698
• Total likes: 300
• Languages: De,EN,JP
##### Re: More rules for existing building rotations
« Reply #8 on: April 05, 2017, 07:51:12 AM »
If the black building in the center was built before and adjacent buildings, then it would have made sense following the neighboring building.

More sophisticated routines could indeed see, that a road running towards a building can go nowhere and thus needs a corner buidling. But on the building surrounded by roads on three sides, the situation is only clear if there are already rotateable buildings. If not, having the orientation towards the most roads is a good idea.

#### Leartin

##### Re: More rules for existing building rotations
« Reply #9 on: April 05, 2017, 12:31:10 PM »
The likelihood of two non-identical buildings having the same height, even if they have the same number of floors, is very low.
The likelyhood of two independent buildings having the same height is very low. But for two rowhouses next to each other, I'd think it's not uncommon. Maybe I'm biased because I lived in one:
Google Maps shows you where I lived
Though I don't know exactly how they come to be. Might be they were exactly identical when buildt, but were renovated at different times in different ways.
Either way, for the game, it feels like having them at the same height if they have the same floor number seems to make the most sense, even if that's not how it works in reality.

If the black building in the center was built before and adjacent buildings, then it would have made sense following the neighboring building.

Sorry, I can't follow. If it was buildt before any adjacent buildings, there wouldn't have been any neighboring buildings to follow?
The building order does not really matter. At least in p192c, we don't have any level 1 rowhouses, so the first building buildt on any tile would never be a rowhouse. Rowhouses and their rotation only become a thing with renovations, when the buildings are upgrading.

But on the building surrounded by roads on three sides, the situation is only clear if there are already rotateable buildings. If not, having the orientation towards the most roads is a good idea.
In p192c, rowhouses use the rowhouse cluster. Therefore, even if there is not a rowhouse on the adjecent tile, it is very, very likely to spawn in later. Since at that point in time the building won't update anymore (and it shouldn't!) it should be buildt appropriatly in the first place.

I don't think rotational buildings other than rowhouses are a huge concern here, either. They usually are only rotated so the front door faces the road, maybe with a little pathwalk connecting the door to the sidewalk of the road. Therefore, they should work fine as long as they face any road - which they still would.
In fact, I'd say it's more likely that a non-rowhouse would still face the same way as it's neighbour, since that means they are in the same street.
Now this goes too far for Simutrans, but quite often you would have a 'road for travelling' with no or few houses buildt at it, but instead, a lot of additional, smaller roads just to connect a bunch of houses to the 'road for travelling'. This means that there are less intersections on the 'road for travelling' (counting any garage or parking spot for a single house as an intersection) and therefore, easier travel. Since Simutrans is not Simutrancity, that concept does not matter at all - but it goes to show that turning the house 90° so it faces the same road as it's neighbour makes a bit more sense than facing the 'middle' road for no reason at all

#### Ters

• Coder/patcher
• Devotee
• Posts: 4577
• Total likes: 167
• Languages: EN, NO
##### Re: More rules for existing building rotations
« Reply #10 on: April 05, 2017, 03:46:43 PM »
The likelyhood of two independent buildings having the same height is very low. But for two rowhouses next to each other, I'd think it's not uncommon. Maybe I'm biased because I lived in one:

Those have pitched roofs. I think those are more likely to have equal height. Maybe it is easier to adjust with an attic. I was writing about flat-roofed buildings only.

#### prissi

• Developer
• Posts: 8698
• Total likes: 300
• Languages: De,EN,JP
##### Re: More rules for existing building rotations
« Reply #11 on: April 06, 2017, 12:52:56 AM »
I modified the selection rules to be more "clever", but in about 50 cities created and grown, I just found one place with two rowhouses next to each other. Is there a certain year when this could happen more frequently? So far I lack any ability to test it, respective it seems a solution without a problem.

#### Leartin

##### Re: More rules for existing building rotations
« Reply #12 on: April 06, 2017, 05:09:34 AM »
I modified the selection rules to be more "clever", but in about 50 cities created and grown, I just found one place with two rowhouses next to each other. Is there a certain year when this could happen more frequently? So far I lack any ability to test it, respective it seems a solution without a problem.
I'll send you my current testing pakset when I'm back at my PC, there are enough rowhouses and the cluster-factor helps as well. Or at least it should.

Those have pitched roofs. I think those are more likely to have equal height. Maybe it is easier to adjust with an attic. I was writing about flat-roofed buildings only.
Top of my head, I can't think of any flat-roof rowhouses at all, only bigger buildings which are best represented in the game as rowhouses. I guess we'd have to ask Flemmbrav about that, since he created all those flat-roof rowhouses.

#### Flemmbrav

##### Re: More rules for existing building rotations
« Reply #13 on: April 06, 2017, 09:06:46 AM »
The 1950s baby blue painted building is one of plenty the same looking buildings. The roof is like that in reallity too, at least that's what i recall passing it twice a day. (Von-Berge-Weg, Hamburg, Germany)
Also we have like pretty standarised flat sizes and layout in germany which may leads to houses sharing hight too.
The newer buildings are all part of one big development project i hamburg. The plan usually does not put buildings of the same high next to ech other, but i think i'm not far off with them sharing the same hight.

I'ld love to see the improvements to rowhouse rotations Leartin suggested.
Current Citys look either pretty forced with just straight roads or the other way around - a bit like we currently have it, with a kind of mess in building rotations and such.
Watching a city grow in nice fashion always gives me motivation to add something new to it. May it be good in game infrastructure or it be a new painting - which does not necessarily has to be something just eye candy-isch.

#### prissi

• Developer
• Posts: 8698
• Total likes: 300
• Languages: De,EN,JP
##### Re: More rules for existing building rotations
« Reply #14 on: April 07, 2017, 01:15:45 AM »

#### Leartin

##### Re: More rules for existing building rotations
« Reply #15 on: April 09, 2017, 04:00:58 PM »
There is at least one bug. This is something I buildt using the auto-function (which is conveniently the standard rotation now, thanks for that) - upon rotating the map, the building gets a bit crazy. Same is the case with game-generated buildings.

I could see other things as well, though it seemed mostly wrong - perhaps caused by the same bug?

The middle block of 5 buildings has road behind it. The old behaviour would have placed the corner and the straight pieces correctly, just the ends would have been rotated. Now, there are 4 corners next to each other, which is worse than the original behaviour.
To the left, and right, you see two short single-rows. The left one is 'correct', as all buildings are connected, but to the right, the buildings are not connected at all again. I have not seen any "inverted corners" either.

As you mentioned in your PN, placing buildings in "auto"-mode is not affected at all; it places everything according to the old rules, and everything else as a zero. Why, though? Isn't manually placing buildings in the rotation they would be buildt if the game buildt them the very reason an 'auto' mode exists, both for city creation and testing purposes?

#### prissi

• Developer
• Posts: 8698
• Total likes: 300
• Languages: De,EN,JP
##### Re: More rules for existing building rotations
« Reply #16 on: April 10, 2017, 02:25:19 AM »
That the rotations are wrong during rotation probably mean that the definition of citybuildings rotations are wrong. I think they are rotated like 8 layout stations. Check r8201, where the building editor places the building now in aut also similar to cities (including the takeover of streets).

#### Leartin

##### Re: More rules for existing building rotations
« Reply #17 on: April 10, 2017, 10:13:19 AM »
You are correct, the broken map rotation is older. It probably never surfaced since the number of buildings using 8 rotations was generally low, and on the network test game there is no rotation. Is that easy enough to fix not to require a seperate bug report?

Will check r8201 in the evening.

• Developer