[patch] coastal cities
Moderator: OpenTTD Developers
[patch] coastal cities
I discovered openttd a few days ago, and after playing a while (I can almost make a correct 4-way junction) I figure I'd jump in and see if I can help improve it. Since none of the games I've played so far have had much scope for ship traffic I figured I would start there.
To that end this patch makes the terrain generator add a few more towns to the coastline. I implemented it in the simplest possible way. When generating towns, any time it randomly generates a position that wouldn't be suitable because it's underwater I simply have it search nearby for the nearest land tile. Of course, that tile itself will never be suitable, since it'll be a sloped tile, so I then search near it for a nice flat spot further inland.
The results are moderately successful. On a small map it might give you one extra town, on a 2k×2k map with a high town density I generally get about 150-200 extra. On the other hand, since they all pretty much right next to the coast they tend to be pretty small, with populations in the 20-200 range. I found I had to add a check to make sure the population of the towns is never zero, because occasionally it would find some tiny ledge on the side of a mountain with room for exactly one road square to build on. Obviously that could have happened in any game without this patch, but it would have been very unlikely.
Enjoy, and let me know what you think.
To that end this patch makes the terrain generator add a few more towns to the coastline. I implemented it in the simplest possible way. When generating towns, any time it randomly generates a position that wouldn't be suitable because it's underwater I simply have it search nearby for the nearest land tile. Of course, that tile itself will never be suitable, since it'll be a sloped tile, so I then search near it for a nice flat spot further inland.
The results are moderately successful. On a small map it might give you one extra town, on a 2k×2k map with a high town density I generally get about 150-200 extra. On the other hand, since they all pretty much right next to the coast they tend to be pretty small, with populations in the 20-200 range. I found I had to add a check to make sure the population of the towns is never zero, because occasionally it would find some tiny ledge on the side of a mountain with room for exactly one road square to build on. Obviously that could have happened in any game without this patch, but it would have been very unlikely.
Enjoy, and let me know what you think.
- Attachments
-
- coastal.diff
- coastal cities more likely; diff against revision r15476
- (3.08 KiB) Downloaded 135 times
-
- Tycoon
- Posts: 1656
- Joined: 08 Jun 2007 08:00
Re: [patch] coastal cities
The idea is good.. Any screenies of minimap?
- NukeBuster
- Traffic Manager
- Posts: 222
- Joined: 04 Jan 2006 18:16
- Location: Alphen aan den Rijn, The Netherlands
- Contact:
Re: [patch] coastal cities
This sounds like an interesting patch, I usually regenerate the map about 10 times before getting a map with good coastal cities.
NukeBuster
Transport Empire: The Transport Empire Linux effort
Join the Transport Empire IRC channel: [url]irc://irc.oftc.net/transportempire[/url] !
OpenTTD patch(es): Password at join
Transport Empire: The Transport Empire Linux effort
Join the Transport Empire IRC channel: [url]irc://irc.oftc.net/transportempire[/url] !
OpenTTD patch(es): Password at join
Re: [patch] coastal cities
Sure, I can do a screenshot.
- Attachments
-
- Unnamed, 1st Jan 1950.png
- (261.91 KiB) Downloaded 410 times
Re: [patch] coastal cities
Here's an updated version. Apparently it was pretty late when I was doing this, because I made a silly logic error that was producing suboptimal results.
Also, here's a screenshot showing some debug info that illustrates how it works.
Also, here's a screenshot showing some debug info that illustrates how it works.
- Attachments
-
- coastal-2.diff
- (3.4 KiB) Downloaded 116 times
Re: [patch] coastal cities
the patch in the bug in slightly newer. just a minor tweak http://bugs.openttd.org/task/2635
Re: [patch] coastal cities
It would be nice if you actually uploaded the patch theredb48x wrote:the patch in the bug in slightly newer. just a minor tweak http://bugs.openttd.org/task/2635

Re: [patch] coastal cities
Thanks Yexo. I'm pretty sure I told it to upload when I filed the bug, but I dunno…
Re: [patch] coastal cities
Welcome to OTTD. Nice work: useful, unobtrusive, but I haven't tested it yet so I can't really say. I'd like to make a suggestion: Cities spawning on mountains annoy me. Little villages are okay, but if I want to connect the bigger cities with proper rail links, it's quite annoying if there's one that's hardly reachable with a rail link that isn't insanely steep. I mean: if a town is so hard to reach, would it ever grow into a large city?
Re: [patch] coastal cities
Thanksel koeno wrote:Welcome to OTTD. Nice work: useful, unobtrusive, but I haven't tested it yet so I can't really say. I'd like to make a suggestion: Cities spawning on mountains annoy me. Little villages are okay, but if I want to connect the bigger cities with proper rail links, it's quite annoying if there's one that's hardly reachable with a rail link that isn't insanely steep. I mean: if a town is so hard to reach, would it ever grow into a large city?
I agree with you here, although this patch doesn't really affect it either way. I suppose we could make a separate patch to try and address it. The easiest thing to do would be to reset the city flag to false if the town couldn't grow enough to make it worth while.
Re: [patch] coastal cities
The patch has been updated to make a few improvements. I'd like to encourage you guys to test it out - you the game better than I, so you will be more likely to notice if anything is amiss. Thanks.
- Attachments
-
- coastal-6.diff
- (9.98 KiB) Downloaded 131 times
Who is online
Users browsing this forum: No registered users and 13 guests