Page 5 of 7

Slight possible bug

Posted: 02 Jun 2007 19:40
by MaxKnight
Please excuse this bump, I wasn't sure whether to bring it up here or not since it's inclusion into Trunk.

It seems that it doesn't detect slopes properly when it wants to build junctions. If the tile a junction is supposed to be built on is sloped, it still builds the junction, but it gets built on foundations and is only three-way, with the last direction the one it came from. It appears to be a bug to me, but I wasn't sure if it needed to be reported to FlySpray or not. I've included a screenshot of the occurence.

Re: Slight possible bug

Posted: 02 Jun 2007 23:25
by skidd13
MaxKnight wrote:Please excuse this bump, I wasn't sure whether to bring it up here or not since it's inclusion into Trunk.

It seems that it doesn't detect slopes properly when it wants to build junctions. If the tile a junction is supposed to be built on is sloped, it still builds the junction, but it gets built on foundations and is only three-way, with the last direction the one it came from. It appears to be a bug to me, but I wasn't sure if it needed to be reported to FlySpray or not. I've included a screenshot of the occurence.
I've no problem with this bump. ;)
This behavior is intended. Well most of it. The three way is build because it is the most connective street-junction. Sure it looks a bit wired in this case. In code I marked this already, but from the coding point I don't know a nice and easy solution (yet).

Posted: 02 Jun 2007 23:38
by MaxKnight
Now, I solved the problem for that town by demolishing those ugly roads and lowering the land so that the junction would be on flat land.

Since towns are capable of minor terraforming in order to build roads and whatnot, couldn't you add a check for where these junctions are to be built and force the town to try to lower the entire tile to the height of the road leading into it? If it's not possible, then skip trying to expand that direction and go another way. Would this be possible in code? I know C++, but not enough to figure out how to do something like this.

Posted: 02 Jun 2007 23:47
by skidd13
MaxKnight wrote:Now, I solved the problem for that town by demolishing those ugly roads and lowering the land so that the junction would be on flat land.

Since towns are capable of minor terraforming in order to build roads and whatnot, couldn't you add a check for where these junctions are to be built and force the town to try to lower the entire tile to the height of the road leading into it? If it's not possible, then skip trying to expand that direction and go another way. Would this be possible in code? I know C++, but not enough to figure out how to do something like this.
I get what you mean, but the selection where to grow the city is random (more or less). If you want to check from where the city opticaly grow you have to check the tiles around the target one and do some math there... That would cause many if cascades... not very nice. I decided to check only the slopes and not the growing direction. It looks nicer in code if you have a clean switch instead of 20-30 if cascades... ;) IMHO

Posted: 11 Jul 2007 15:47
by skidd13
I'm working on the town again. ATM I'm trying to get rid of the inconnective dead ends created by the town road layout.

Here is the first (not working as expected ATM) diff.

Edit: small fix.

Posted: 11 Jul 2007 15:51
by Chicago Rail Authority
Not sure I follow... what is it about dead-ends that you're trying to get rid of?

Posted: 11 Jul 2007 15:53
by skidd13
Chicago Rail Authority wrote:Not sure I follow... what is it about dead-ends that you're trying to get rid of?
Roads leading into water, etc.

Posted: 12 Jul 2007 09:55
by MarkyParky
Hello,

do you think it would be possible to implement "town builds no roads" to scenario editor as well? It would be handy to create custom city layouts by simply drawing the streets first, than building the city in the middle and expanding it just by clicking the button in editor...

Posted: 12 Jul 2007 14:32
by belugas
It is possible, but it has been objected.
If you really do want to create your own layout, it is quite easy. Simply create a small town and deal with the road yourself.

Posted: 12 Jul 2007 15:09
by Bilbo
belugas wrote:It is possible, but it has been objected.
If you really do want to create your own layout, it is quite easy. Simply create a small town and deal with the road yourself.
Yes, build small city, bulldoze it completely, then add your own street layout and then "expand" the city for letting it build the buildings

Posted: 12 Jul 2007 18:47
by Mchl
I just got an idea. Would it be possible to make cities build bridges or tunnels when crossing railways? I don't mean there should be no level crossings, but from time to time, a town could afford a bridge ;)

Not sure if it is in scope of this patch, probably not :oops:

Posted: 12 Jul 2007 19:47
by Bilbo
Mchl wrote:I just got an idea. Would it be possible to make cities build bridges or tunnels when crossing railways? I don't mean there should be no level crossings, but from time to time, a town could afford a bridge ;)

Not sure if it is in scope of this patch, probably not :oops:
Definitely when crossing maglev track, since maglev crossings are rather crossnigs of death. Maybe the chance to biuld bridge instead of crossing would depend on max. speed of vehicle that could go over it. For <100 km/h never build a bridge, for >250 km/h almost always build a bridge, between these two make some linear fade ....

Posted: 13 Jul 2007 16:31
by skidd13
Mchl wrote:I just got an idea. Would it be possible to make cities build bridges or tunnels when crossing railways?
Sure it'd be possible. But ATM I' working still on fixing the behavior of the town growth, to something less stupid. Moreover I hope I can simplify the code so that it need less performance.

Posted: 13 Jul 2007 19:39
by MarkyParky
Yes, build small city, bulldoze it completely, then add your own street layout and then "expand" the city for letting it build the buildings
That does not work because city builds its own new roads resulting two problems:

a) roads already build becomes messy
b) city keeps expanding new roads so it loses its premade shape

Posted: 13 Jul 2007 20:22
by Mchl
skidd13 wrote:Sure it'd be possible. But ATM I' working still on fixing the behavior of the town growth, to something less stupid. Moreover I hope I can simplify the code so that it need less performance.
What'd you done so far is one of my favourite patches ;)
Good work

Re: Patch: Town road layout

Posted: 26 Jul 2007 18:36
by skidd13
The town road cleanup patch should be functional complete now! :D
  • Features
  • Nicer town surface (no more roads leading into water/houses/etc.)
  • Better town bridges
  • No more strange behavior on slopes (grid layouts)
  • Roadworks will cleanup the road tiles.
I hope you enjoy the patch.

Latest patch is availible at Flyspray -> http://bugs.openttd.org/task/1090

Preview: No manual road improvement!!!

Re: Patch: Town road layout

Posted: 02 Aug 2007 12:51
by kilo.dollar
Will the patch correct already wrongly-built town roads?

Re: Patch: Town road layout

Posted: 02 Aug 2007 13:03
by skidd13
kilo.dollar wrote:Will the patch correct already wrongly-built town roads?
skidd13 wrote:
  • Roadworks will cleanup the road tiles.
So yes.

Re: Patch: Town road layout

Posted: 25 Aug 2007 01:08
by Dave_McMahon
skidd13

please be so kind as to visit

http://www.tt-forums.net/viewtopic.php?f=32&t=33756

(I didn't know this was your patch, and thank you so much for it! It forms the basis for my games already. I'm basically looking to make the 3x3 grid (Which I always use) to synchronize with all the other towns grids.

Re: Patch: Town road layout

Posted: 25 Aug 2007 07:58
by skidd13
My town road cleanup patch(Take a look to a few posts earlier) does this, so no need to write more stuff. ;) It' isn't in trunk so, there's still some optimisation needed but it's fully working.