Patch: new town grids (r15096)
Moderator: OpenTTD Developers
Patch: new town grids (r15096)
New version based against r15096! Go to this post to get it.
What the new version does:
Pre-Set grids are a thing of the past! You can now choose the X and Y values yourself, anywhere from 1 to 10.
1, of course, isn't very useful. I'll remove that in the next version.
Also, the minor problem of towns sometimes building where the grid's road should go has been fixed... mostly. Once in a while, especially when two towns are close by, they'll still build in the way, but that's not often.
Finally, a note to anyone who looks at the patch's code.... yes, there's a line in the english strings file that says not to remove the two lines underneath - if you don't beleve me that it's needed, take them out, and compile - the other languages throw up a load of warnings. I could fix that, but I don't speak any other language to translate the three new strings, so anyone who wants to help with that is welcome to PM me the translations for the other languages.
===========
Original Post:
At last, my first patch!
Ahem.
Small patch at the moment, what this does is add into the economy tab's settings the option to have towns in grids of 4x4 and 5x5. Both have a few small issues still, such as sometimes a 2x2 or larger building will block one of the roads, and on 5x5, there's often empty space in the middle of the grid.
Both have been tested in the editor and in game, though so far not with the town funding patch, although I doubt there will be any issues there.
It shouldn't be too much of a problem to add any more new grid sizes in, and I think it's possible to do something like 3X5, though I'm still looking into that.
Attached is the diff against r14667 and a prepatched windows binary.
What the new version does:
Pre-Set grids are a thing of the past! You can now choose the X and Y values yourself, anywhere from 1 to 10.
1, of course, isn't very useful. I'll remove that in the next version.
Also, the minor problem of towns sometimes building where the grid's road should go has been fixed... mostly. Once in a while, especially when two towns are close by, they'll still build in the way, but that's not often.
Finally, a note to anyone who looks at the patch's code.... yes, there's a line in the english strings file that says not to remove the two lines underneath - if you don't beleve me that it's needed, take them out, and compile - the other languages throw up a load of warnings. I could fix that, but I don't speak any other language to translate the three new strings, so anyone who wants to help with that is welcome to PM me the translations for the other languages.
===========
Original Post:
At last, my first patch!
Ahem.
Small patch at the moment, what this does is add into the economy tab's settings the option to have towns in grids of 4x4 and 5x5. Both have a few small issues still, such as sometimes a 2x2 or larger building will block one of the roads, and on 5x5, there's often empty space in the middle of the grid.
Both have been tested in the editor and in game, though so far not with the town funding patch, although I doubt there will be any issues there.
It shouldn't be too much of a problem to add any more new grid sizes in, and I think it's possible to do something like 3X5, though I'm still looking into that.
Attached is the diff against r14667 and a prepatched windows binary.
- Attachments
-
- newtowngrid_r14667.diff
- diff against trunk r14667
- (3.06 KiB) Downloaded 367 times
-
- newgrids_r14667.zip
- windows binary
- (3.42 MiB) Downloaded 413 times
Last edited by Gremnon on 15 Jan 2009 21:36, edited 3 times in total.
Re: Patch: new town grids (r14667)
And just to show off a bit, a screenshot of each.
- Attachments
-
- The 4x4 grid
- 4x4.png (88.77 KiB) Viewed 1883 times
-
- The 5x5 grid
- 5x5.png (146.1 KiB) Viewed 2026 times
- athanasios
- Tycoon
- Posts: 3138
- Joined: 23 Jun 2005 00:09
- Contact:
Re: Patch: new town grids (r14667)
Now we need more 2x2 buildings.
http://members.fortunecity.com/gamesart
"If no one is a fool I am also a fool." -The TTD maniac.
I prefer to be contacted through PMs. Thanks.
"If no one is a fool I am also a fool." -The TTD maniac.
I prefer to be contacted through PMs. Thanks.
Re: Patch: new town grids (r14667)
Is it possible to make a more realistic grid like the New York grid (240m x 60m)?
-
- Chairman
- Posts: 776
- Joined: 20 Jan 2007 12:08
- Location: Germany
Re: Patch: new town grids (r14667)
Now we need even larger buildings (doing some advertising for FS#1983)athanasios wrote:Now we need more 2x2 buildings.
I dream of a Mars scenario, having 4x4 domes as town buildings.
Indeed something like, 2x3, 2x4 and 3x4 (and maybe 3x5) would be nice.robo wrote:Is it possible to make a more realistic grid like the New York grid (240m x 60m)?
Ahh, you are already considering thatGremnon wrote:and I think it's possible to do something like 3X5, though I'm still looking into that.
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008
Re: Patch: new town grids (r14667)
Yes, already working on it. I've sucessfully added in a 4x8 one, but it doesn't appear to like creating a patch.
What I'm going to attempt to work on (when I have a little more free time) is a slight change to the way the patch setting works, and split into three parts.
The first will act the same as it does currently, choosing random, better roads, etc. Instead of 3X3 or other grids in there, it'll show Geometric Grid.
When that's on, the other two patch settings get read, one defining the X for the grid, the other the Y.
IF I can get it to work, it'll mean people can customise how many in each direction.
What I'm going to attempt to work on (when I have a little more free time) is a slight change to the way the patch setting works, and split into three parts.
The first will act the same as it does currently, choosing random, better roads, etc. Instead of 3X3 or other grids in there, it'll show Geometric Grid.
When that's on, the other two patch settings get read, one defining the X for the grid, the other the Y.
IF I can get it to work, it'll mean people can customise how many in each direction.
-
- Chairman
- Posts: 776
- Joined: 20 Jan 2007 12:08
- Location: Germany
Re: Patch: new town grids (r14667)
Yes, this sounds reasonable.Gremnon wrote:[separate patch settings]
No need to hurryGremnon wrote:(when I have a little more free time)
"The bigger the island of our knowledge, the longer the shore of our ignorance" - John A. Wheeler, Physicist, 1911-2008
Re: Patch: new town grids (r14667)
What would be really neat is if you could have the grid expand as a town develops. It would mean you had to work with specific (and wonky) numbers, but it'd be super-nifty.
What I mean by that:
- Suburbs are built at 2x2
- Inner city is 5x2
- Downtown is 5x5
The major problem (aside from the fact that it might be impossible to code) is its possible effect on bus service. (Tram service doesn't run on roads, so if you only demolish the road, the tram will continue uninterrupted. Busses, to use a bad metaphor, aren't quite in the same boat.)
What I mean by that:
- Suburbs are built at 2x2
- Inner city is 5x2
- Downtown is 5x5
The major problem (aside from the fact that it might be impossible to code) is its possible effect on bus service. (Tram service doesn't run on roads, so if you only demolish the road, the tram will continue uninterrupted. Busses, to use a bad metaphor, aren't quite in the same boat.)
Re: Patch: new town grids (r14667)
It's an interesting idea, but at the moment it's enough trouble adding nonuniform grids such as 2x5 or similar without breaking something else... I did manage to get a 4x8 one, which unfortunatly stopped the 5x5 grid working.
Maybe if/when I can figure out how to make the code support that.
Maybe if/when I can figure out how to make the code support that.
Re: Patch: new town grids (r14667)
what _also_ would be cool, is haveing different "randoms". one city is 2x2, one is 4x4 etc...
Re: Patch: new town grids (r14667)
That I think is handled in existing 'random' option, though having never used that, I can't say for sure.
If it does, and it uses the new ones as well as the old...
hm.... now you've got me curious, time I did some more to this patch.
Edit: As I thought, setting the town road layout to 'random' before starting a new game will do what you're thinking of.
If it does, and it uses the new ones as well as the old...
hm.... now you've got me curious, time I did some more to this patch.
Edit: As I thought, setting the town road layout to 'random' before starting a new game will do what you're thinking of.
Re: Patch: new town grids (r14667)
but doesnt that also include "old" and "improved" ?
Re: Patch: new town grids (r14667)
Unfortunatly so... I'm looking into that too, just random grids would be nice, but at the moment I'm having a little trouble understanding some of the code... C++ isn't something I've actually learned properly, I'm sort of picking it up as I go along.
So it's a bit of a surprise to find not only my first patch works, but works first time... let alone adding all the extra things that could improve it. But I'm working on it.
So it's a bit of a surprise to find not only my first patch works, but works first time... let alone adding all the extra things that could improve it. But I'm working on it.
Re: Patch: new town grids (r14667)
It'd be nice if all towns' roads were on the same grid, so that when they grow into each other, their roads line up and they're not all botched.
- Phil
Re: Patch: new town grids (r14667)
There was a patch some time ago, on Flyspray IIRC, that did that. If that patch still works, I don't know, and how it worked is beyond me at the moment too, but if anyone feels like finding that old patch out and updating it, I'll see if I can resolve and conflicts between it, and my patch
Re: Patch: new town grids (r14667)
One method:
Given you have the x and y coordinate of a tile.
if x%3 == 0 or y%3 == 0
=> build road
Where x%3 gives the remainder from dividing x with 3. So if x is 8 then the reminder becomes 2. (2*3 => 6; 8-6 => 2)
Given you have the x and y coordinate of a tile.
if x%3 == 0 or y%3 == 0
=> build road
Where x%3 gives the remainder from dividing x with 3. So if x is 8 then the reminder becomes 2. (2*3 => 6; 8-6 => 2)
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: Patch: new town grids (r14667)
Great patch idea, Gremnon!
It would be really nice if you can implement Teeg's ideas for different patterns under 1 setting (perhaps named New York layout).
I wish you lots of success coding it.
It would be really nice if you can implement Teeg's ideas for different patterns under 1 setting (perhaps named New York layout).
I wish you lots of success coding it.
NewGRF: Oil Wells in Temperate terrain now can Increase production, Better vehicle names, Use-able default aircraft, Oil Rig for Snowland and Desert, Speed for Suspension bridges.
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Patches (OpenTTD): Improved smooth_economy [in trunk], More (diesel) smoke [in trunk], Realistic_acceleration finetune.
Keep 'em rollin'!
Re: Patch: new town grids (r14667)
Coincidentally, I recently submitted a patch to flyspray that does exactly that, by only placing towns during map generation at the right places.phil88 wrote:It'd be nice if all towns' roads were on the same grid, so that when they grow into each other, their roads line up and they're not all botched.
I also seem to remember a previous patch to this effect, but I was unable to find it (so I coded a new one).Gremnon wrote:There was a patch some time ago, on Flyspray IIRC, that did that.
Re: Patch: new town grids (r14667)
Ah, that's useful... I'll take a glance into it when I finally get some free time (read: sometime in the new year)
Re: Patch: new town grids (r14667)
New version against r15096
The details (Also at the top of the first post, for those who decide to read there first)
What the new version does:
Pre-Set grids are a thing of the past! You can now choose the X and Y values yourself, anywhere from 1 to 10.
1, of course, isn't very useful. I'll remove that in the next version.
Also, the minor problem of towns sometimes building where the grid's road should go has been fixed... mostly. Once in a while, especially when two towns are close by, they'll still build in the way, but that's not often.
Finally, a note to anyone who looks at the patch's code.... yes, there's a line in the english strings file that says not to remove the two lines underneath - if you don't beleve me that it's needed, take them out, and compile - the other languages throw up a load of warnings. I could fix that, but I don't speak any other language to translate the three new strings, so anyone who wants to help with that is welcome to PM me the translations for the other languages.
And now, what you've been waiting for (maybe)... the download.
The details (Also at the top of the first post, for those who decide to read there first)
What the new version does:
Pre-Set grids are a thing of the past! You can now choose the X and Y values yourself, anywhere from 1 to 10.
1, of course, isn't very useful. I'll remove that in the next version.
Also, the minor problem of towns sometimes building where the grid's road should go has been fixed... mostly. Once in a while, especially when two towns are close by, they'll still build in the way, but that's not often.
Finally, a note to anyone who looks at the patch's code.... yes, there's a line in the english strings file that says not to remove the two lines underneath - if you don't beleve me that it's needed, take them out, and compile - the other languages throw up a load of warnings. I could fix that, but I don't speak any other language to translate the three new strings, so anyone who wants to help with that is welcome to PM me the translations for the other languages.
And now, what you've been waiting for (maybe)... the download.
- Attachments
-
- newtowngrids_r15096.patch
- The patch, against r15096
- (9.03 KiB) Downloaded 278 times
Who is online
Users browsing this forum: Bing [Bot] and 4 guests