advanced town handling

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

gigajum
Route Supervisor
Route Supervisor
Posts: 511
Joined: 08 Mar 2006 08:33
Location: Germany

advanced town handling

Post by gigajum »

As i read the suggestion list on boomingranny's site, i thought some of them are easy and fast done, others not :(.

So i took his idea "Modify the cost to clear a town tile/reserve a tile" and coded it. I used the following formulas:
"house demolish value = current house demolish value * city population / 20;" to demolish houses
and
"current price * nearest city population / 200;" for buying land tiles. I thought over adding a distance from town center value, to get land prices like in real life. Maybe i still implement this.

It should have no bugs. If you found one please report it here :).
If anyone has more suggestions concerning town behaviour/handling let me know :).
Attachments
advanced_town_handling_r4562.diff
patch file against r4562
(5.72 KiB) Downloaded 387 times
Jango
Traffic Manager
Traffic Manager
Posts: 189
Joined: 28 Aug 2004 12:13

Re: advanced town handling

Post by Jango »

gigajum wrote:As i read the suggestion list on boomingranny's site, i thought some of them are easy and fast done, others not :(.
could you post a link to the site?
gigajum
Route Supervisor
Route Supervisor
Posts: 511
Joined: 08 Mar 2006 08:33
Location: Germany

Post by gigajum »

Jango
Traffic Manager
Traffic Manager
Posts: 189
Joined: 28 Aug 2004 12:13

Post by Jango »

ta
User avatar
BoominGranny
Engineer
Engineer
Posts: 85
Joined: 18 Apr 2006 02:16
Location: Wellington, New Zealand
Contact:

Post by BoominGranny »

Wow gigajum, im honoured :) Can't wait to try it - i only made that site yesterday!
gigajum wrote: I thought over adding a distance from town center value, to get land prices like in real life.
I thought of having that before ending on the simpler formula on my site-infact my original formua was (something like):

current house demolish value * city population/40 * (16/(distance from centre city tile+8))

take the attached picture as an example

HOUSE A:
is 0 squares from the towns centre (since it is at the towns centre)
original cost is $2980
current house demolish value * city population/40 * (16/(distance from centre city tile+8))
2980 * 783/40 * (16/(0+8))
$116,667

HOUSE B:
is 2 squares from town centre, originally $1916
1916 * 783/40 * (16/(2+8))
$60,009.12

HOUSE C:
is 3 squares from centre, originally $1006
1006 * 783/40 * (16/(3+8))
$28,643.56

HOUSE D:
is 4 squares, originally 1134
1134 * 783/40 * (16/(4+8))
$29,597.4

HOUSE E:
6 squares, originally 1010
1010 * 783/40 *(16/(6+8))
$28243.93

this would also mean, in a huge city (say 18377 pop)
if you had a house that costs 998 to clear, and is 32 squares from the centre.
Lets call this house H:
998 * 18377/40 * (30/(32+15))
$292663.5

so if you compare:

currently in game, with simple formula , with distance formula:
house a:2980, 116667, 116667
house b:1916, 75011, 60009
house c:1006, 39384, 28643
house d:1134, 44396, 29597
house e:1010, 39541, 28243

house H: 998, 917012, 292663

I think that would work even better :)
Attachments
picture.PNG
picture.PNG (30.36 KiB) Viewed 11316 times
gigajum
Route Supervisor
Route Supervisor
Posts: 511
Joined: 08 Mar 2006 08:33
Location: Germany

Post by gigajum »

BoominGranny wrote:I think that would work even better :)
yeah me too. :)

But I only thought about land prices when buying a tile not by demolishing it. Maybe you should buy all land you own the tile.
User avatar
BoominGranny
Engineer
Engineer
Posts: 85
Joined: 18 Apr 2006 02:16
Location: Wellington, New Zealand
Contact:

Post by BoominGranny »

formula should have read: current house demolish value * city population/40 * (30/(distance from centre city tile+15))

(this just means the effect of distance isn't as large)

for reserving the squares it would work well with something like:
current price * nearest city population / 300 * (30/(distance from centre city tile+15))
but the max distance from centre city would have to be 30 (ie if it was over 30 presume 30) otherwise you would end up with really cheap prices if you were really far away from the city. unless of course thats what you wanted.
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

Why 15? What does this number mean?
I think you meant TILE_SIZE, which is 16.

Also, the next magic number 40 - it could depend on the difficulity settings, construction prices.
User avatar
BoominGranny
Engineer
Engineer
Posts: 85
Joined: 18 Apr 2006 02:16
Location: Wellington, New Zealand
Contact:

Post by BoominGranny »

30/(distance from centre city tile+15)
this sorts out the multiplier depending on how far away from the city it is
ie.

the 15 is there because its half of 30:
distance from city (tiles:) result:
0 2
5 1.5
10 1.2
15 1
20 0.86
30 0.67
60 0.4

in other words - as the distance from the centre of a city increases, the price of the tile decreases...
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

30 (and naturally the 15) need to be dependent on city's spread. Later in-game places 60 tiles away should be as valuable as places 2 tiles away from the town center (because both are in the center, in fact)
User avatar
BoominGranny
Engineer
Engineer
Posts: 85
Joined: 18 Apr 2006 02:16
Location: Wellington, New Zealand
Contact:

Post by BoominGranny »

when i expanded a city to 60,000 pop it was about 30 tileswide - and if it did get to 60 tiles wide chances are is pop (which is also used as a multiplier) will counteract the fact that the squares are so far away...


ie. -if a city was pop 300,000 and the square in question was 60 squares from the centre:
1000 * 300000/40 * (30/(60+15))
cost - $3,000,000

so its still a huge cost even though it is so far away from the citys centre!

ps. gigajum - a suggestion. You may want to rename this patch once you finally have some spare time (i understand you are working on the percentile loading thing) maybe Advanced Town Handeling could Become "Realistic Costing for house Buildosing/Tile Reservation" or something like that. :-) i love what you've done so far, keep up the nice work!
gigajum
Route Supervisor
Route Supervisor
Posts: 511
Joined: 08 Mar 2006 08:33
Location: Germany

Post by gigajum »

BoominGranny wrote: ps. gigajum - a suggestion. You may want to rename this patch once you finally have some spare time (i understand you are working on the percentile loading thing) maybe Advanced Town Handeling could Become "Realistic Costing for house Buildosing/Tile Reservation" or something like that. :-) i love what you've done so far, keep up the nice work!
i not only thought about those two features, maybe there are some other things i can add here in this patch. So the name "Realistic Costing for house Buildosing/Tile Reservation" becomes useless. I wanted a name that can be used if more things were added. Maybe the bridge upgrade patch is such a thing. Or change the style of building roads.

If you have a better name for it now i hear. :)
Last edited by gigajum on 29 Apr 2006 08:31, edited 2 times in total.
User avatar
PouncingAnt
Transport Coordinator
Transport Coordinator
Posts: 357
Joined: 09 Nov 2004 22:33

Post by PouncingAnt »

Am I to understand, that as a consequence of this patch, that buying land around an expanding town will allow you to later sell that land for more than you paid?
NB: the below challenges are still open for submission, so feel free to perform necromancy on them!
Try the PouncingAnt National Monopoly Challenge
Or even better, the PouncingAnt National Monopoly Challenge 2
Or better still, the PouncingAnt National Monopoly Challenge 3
Or, the PouncingAnt National Monopoly Challenge 4

Or try my scenario instead!

-(A lazy) OpenTTD Japanese Translator-
-(A lazy) PNGcodec user-
"You get what you pay for, so pay attention!"

Patches:
Company Station Stats
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

Umm... yes. You're right. I haven't thought about that, but that's completly right. That's a very good idea.

And now let me introduce one more idea.
Tile without a (town owned, to prevent cheats) road nearby, should be worth less, while tile with a (town owned) road at its side should be worth double.

This way, town won't be stupid enough to pay a lot for a completly not useful areas. With my idea, IMO it would be more realistic that town will pay less for such a tile, as it won't use it anyway.
gigajum
Route Supervisor
Route Supervisor
Posts: 511
Joined: 08 Mar 2006 08:33
Location: Germany

Post by gigajum »

PouncingAnt wrote:Am I to understand, that as a consequence of this patch, that buying land around an expanding town will allow you to later sell that land for more than you paid?
No, that was never the idea and does not work.
I thought about buying all land on which you build something. So towns are at the beginning extremly expensive regions to build. This increases the difficult level and trys to keep it during a game i think. Since after 20-30 years of playing you have so much money that you can erase almost every city.
MeusH wrote: And now let me introduce one more idea.
Tile without a (town owned, to prevent cheats) road nearby, should be worth less, while tile with a (town owned) road at its side should be worth double.

This way, town won't be stupid enough to pay a lot for a completly not useful areas. With my idea, IMO it would be more realistic that town will pay less for such a tile, as it won't use it anyway.
The idea is not bad, if i understand it correct. But currently you only have to pay more when buy that land. If you only build a rail track on it the it is the same price as before. So i need to add buying the land if you build something on it. i will have a look at it, if i'm pissed of with the loading thing code or if i need some other code to look at :)

But at the moment i'm busy with real life and the continue of nzhook's patch with percentile + priority + exact loading options. I thought it has be done. Then a friend came today, i showed him the patch and it didn't work :( probably i only forget something small to check.

Edit:
Wuah. Ok forget about buying the land first before placing a track on it. To implement that i have not the time and nerves.
User avatar
PouncingAnt
Transport Coordinator
Transport Coordinator
Posts: 357
Joined: 09 Nov 2004 22:33

Post by PouncingAnt »

gigajum wrote:
PouncingAnt wrote:Am I to understand, that as a consequence of this patch, that buying land around an expanding town will allow you to later sell that land for more than you paid?
No, that was never the idea and does not work.
I thought about buying all land on which you build something. So towns are at the beginning extremly expensive regions to build. This increases the difficult level and trys to keep it during a game i think. Since after 20-30 years of playing you have so much money that you can erase almost every city.
MeusH wrote: And now let me introduce one more idea.
Tile without a (town owned, to prevent cheats) road nearby, should be worth less, while tile with a (town owned) road at its side should be worth double.

This way, town won't be stupid enough to pay a lot for a completly not useful areas. With my idea, IMO it would be more realistic that town will pay less for such a tile, as it won't use it anyway.
The idea is not bad, if i understand it correct. But currently you only have to pay more when buy that land. If you only build a rail track on it the it is the same price as before. So i need to add buying the land if you build something on it. i will have a look at it, if i'm pissed of with the loading thing code or if i need some other code to look at :)

But at the moment i'm busy with real life and the continue of nzhook's patch with percentile + priority + exact loading options. I thought it has be done. Then a friend came today, i showed him the patch and it didn't work :( probably i only forget something small to check.

Edit:
Wuah. Ok forget about buying the land first before placing a track on it. To implement that i have not the time and nerves.
Well of course that was not the idea, but what with the way people were talking about reserving squares as opposed to just talking about building, you can see where my train of thought was derailed, as it were.

Thanks on clearing that up though
NB: the below challenges are still open for submission, so feel free to perform necromancy on them!
Try the PouncingAnt National Monopoly Challenge
Or even better, the PouncingAnt National Monopoly Challenge 2
Or better still, the PouncingAnt National Monopoly Challenge 3
Or, the PouncingAnt National Monopoly Challenge 4

Or try my scenario instead!

-(A lazy) OpenTTD Japanese Translator-
-(A lazy) PNGcodec user-
"You get what you pay for, so pay attention!"

Patches:
Company Station Stats
gigajum
Route Supervisor
Route Supervisor
Posts: 511
Joined: 08 Mar 2006 08:33
Location: Germany

Post by gigajum »

So the land prices are in.

With towns under 1200 citizen you won't notice more cost, but with more then 1200 it becomes quite expensive some times.

Dunno if it's bugfree, i hope so. If you find one, post it :)
Attachments
advanced_town_handling_r4896.diff
(11.9 KiB) Downloaded 359 times
Shorty
Engineer
Engineer
Posts: 114
Joined: 18 Jul 2006 15:43

Post by Shorty »

my thought was this: if implementable, you should only have to buy the land once: ie, if you build a piece of railway track, and later wish to change the route, when you demolish that tile you should continue to hold ownership of it.

ive had cities expand so fast that you cant actually build something in them: the moment you bulldoze a house, the city places another there, and thats 11 million down the drain.
"And if i close my mind in fear, Please pry it open
And if my face becomes sincere, beware!
And if i start to come undone, Stitch me together
And if you see me strut, Remind me of what left this outlaw torn..."
-Metallica Lyrics
Electric Rails for all Tilesets
~A Talented Fool~
gigajum
Route Supervisor
Route Supervisor
Posts: 511
Joined: 08 Mar 2006 08:33
Location: Germany

Post by gigajum »

Shorty wrote:my thought was this: if implementable, you should only have to buy the land once: ie, if you build a piece of railway track, and later wish to change the route, when you demolish that tile you should continue to hold ownership of it.

ive had cities expand so fast that you cant actually build something in them: the moment you bulldoze a house, the city places another there, and thats 11 million down the drain.
Should not be had to implement, since it was my idea to do it that way. We'll see when im done with that :)
Shorty
Engineer
Engineer
Posts: 114
Joined: 18 Jul 2006 15:43

Post by Shorty »

excellent :D

with this feature, you could essentially combine the dynamite and buy land functions. clik-drag functionality on buy land would be pretty cool.
"And if i close my mind in fear, Please pry it open
And if my face becomes sincere, beware!
And if i start to come undone, Stitch me together
And if you see me strut, Remind me of what left this outlaw torn..."
-Metallica Lyrics
Electric Rails for all Tilesets
~A Talented Fool~
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 14 guests