Patch: Town Restructuring r11088

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

wleader
Engineer
Engineer
Posts: 123
Joined: 18 May 2007 09:04

Patch: Town Restructuring r11088

Post by wleader »

So I was thinking about what I might work on next, and here is what I have come up with. Right now if you want to do any serious construction in a town, then you need to have a couple of stations already there with a good rating with the town. If your plans are really ambitious, this alone might not be enough. Bribes may become important. So I wondered if there was a way around this. Normally, when eminent domain is used to buy out a land owner, they get some cash and most likely re-build somewhere else. In game, the building is just gone if you bulldoze it.

What I was thinking is that instead, if the player tries to buy a tile that has a town structure on it, instead of failing, the structure could be relocated. More correctly, it would still be destroyed, the town would just grow a new one on a different tile. The trade off would be an substantially increased money cost for the player, but a reduced rating cost.

I do see that there is a potential for abuse, especially in multilayer games, where a malicious player would buy everything around another players station. but this isn't any worse than what griefers already have. It is possible to repeatedly create companies and wipe out a town. At least with this tool, the size of the town doesn't shrink, just the shape of it.

UPDATE Sept. 12, 2007

Here is the first draft of the patch. Here is how it works. If the patch is enabled, and you use the Purchase Land tool on a tile that has a town building or road, the tile will be cleared and purchased automatically. However the money cost will be ten times greater than normal. The rating cost to your company in the town will be one fifth the normal cost. If the tile was a building and not a road, the town will grow a new building to replace it. Estimating cost with the shift key works too. If money is tight, the original behavior should continue to work by demolishing first then buying the tile.

I'm not going to call this good code, so suggestions and feedback for improvement are welcome.
Attachments
Town_restructuring_v1_r11088.patch
A patch to allow purchasing town land at an increased money cost and reduced rating cost. Version 1 (Built with Trunk r11088)
(14.16 KiB) Downloaded 92 times
Last edited by wleader on 12 Sep 2007 00:50, edited 1 time in total.
richk67
Tycoon
Tycoon
Posts: 2363
Joined: 05 Jun 2003 16:21
Location: Up North
Contact:

Re: My next patch - Restructuring

Post by richk67 »

Sounds really quite good. I would like this.
OTTD NewGRF_ports. Add an airport design via newgrf.Superceded by Yexo's NewGrf Airports 2
Want to organise your trains? Try Routemarkers.
--- ==== --- === --- === ---
Firework Photography
User avatar
flake
Engineer
Engineer
Posts: 66
Joined: 28 Apr 2004 10:07
Location: Salzburg
Contact:

Re: My next patch - Restructuring

Post by flake »

In my opinion a very good idea.
I would use it all the time.
*<(:-}
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: My next patch - Restructuring

Post by DJ Nekkid »

it would be just awsome! completely and totally awsome. and imho trunkworthy :)

just make sure you code it in a good and bugfree way.

and perhaps make a 2nd patch-part where you include a "cannot be done if a company have a station with catchmentarea here"-thingy :)

but most ppl would have a use of this all the time, this way we can "inject" a station in the middle of a city...
Member of the
ImageImage
User avatar
NukeBuster
Traffic Manager
Traffic Manager
Posts: 222
Joined: 04 Jan 2006 18:16
Location: Alphen aan den Rijn, The Netherlands
Contact:

Re: My next patch - Restructuring

Post by NukeBuster »

Very nice Idea, I sometimes wipe out almost the whole city when expanding track or a station.
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
User avatar
Lupin III
Engineer
Engineer
Posts: 66
Joined: 11 Jul 2007 16:36

Re: My next patch - Restructuring

Post by Lupin III »

Definitly not a waste of time! It's really annoying if you have all the money of the world, but can only remove five buildings and then have to wait another year until the rating is high enough again to go for the next five. Even only expanding an existing train station can take forever.
wickedgenius
Engineer
Engineer
Posts: 71
Joined: 06 Sep 2007 16:36
Location: Peterborough, United Kingdom

Re: My next patch - Restructuring

Post by wickedgenius »

Hey,

Nice idea.

Just a thought though: what happens if you buy a town owned road will this be moved, make the road yours or will the road need to be demolished first :?:
User avatar
PouncingAnt
Transport Coordinator
Transport Coordinator
Posts: 357
Joined: 09 Nov 2004 22:33

Re: My next patch - Restructuring

Post by PouncingAnt »

I also like this idea. Though I still think there should be at least some rating penalties for doing this. Personally I think it adds to the game to limit the restructuring in towns.
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
SyncViews
Engineer
Engineer
Posts: 38
Joined: 13 May 2007 12:31
Location: UK

Re: My next patch - Restructuring

Post by SyncViews »

..., but a reduced rating cost.
Reduced doesn't mean none.

Sounds like a great idea.
You all seem to have missed that placeing trees increases your rateing so people can destroy towns in minutes anyway.
Tom0004
Chairman
Chairman
Posts: 822
Joined: 01 Jul 2007 22:33
Location: Manchester, UK

Re: My next patch - Restructuring

Post by Tom0004 »

or you have failed to realise we know this, and also know of a quicker way.

called the magic bulldoser. would be done in a instance !!
User avatar
athanasios
Tycoon
Tycoon
Posts: 3138
Joined: 23 Jun 2005 00:09
Contact:

Re: My next patch - Restructuring

Post by athanasios »

I am very happy that after waiting a couple of years :shock: finally someone decided to code this!
To avoid misuse of it, I suggest that the cost of such an action should be much more than that of demolishing the building. This is reasonable: To purchase the building and persuade the owner to move to a different, less attractive area of the city, he needs some incentive, so does the unwilling to cooperate or sometimes greedy city council. :wink: Double cost at least.
0004tom wrote:... magic bulldoser...
That's considered cheating. We need a "legal" way or in other words a balanced way: You get what you pay for.

Unmovables (monuments, industries(except raw)) can be transferred to another place this way.
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.
chrissicom
Route Supervisor
Route Supervisor
Posts: 415
Joined: 07 Oct 2004 10:05

Re: My next patch - Restructuring

Post by chrissicom »

I agree with athanasios opinion on this, that's also why I made demolishing houses in towns extremely expensive with town construction cost patch. I really dislike it when in multiplayer games people demolish half of a town to build an airport. I am fine when they do it but then they should also pay properly to do so :lol: :P
wleader
Engineer
Engineer
Posts: 123
Joined: 18 May 2007 09:04

Re: My next patch - Restructuring

Post by wleader »

chrissicom wrote:... I made demolishing houses in towns extremely expensive with town construction cost patch.
I've not looked at the town construction cost patch, but I'd be interested to know how these two patches would interact.
chrissicom
Route Supervisor
Route Supervisor
Posts: 415
Joined: 07 Oct 2004 10:05

Re: Patch: Town Restructuring r11088

Post by chrissicom »

Love the way this patch works and will test it now seperately as well as with the town construction cost patch :)
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: Town Restructuring r11088

Post by Roujin »

actually, i don't like the general idea of this patch very much - sorry for the negative voice - but i'm about to try the patch now, maybe i can be convinced by how it works.
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
wleader
Engineer
Engineer
Posts: 123
Joined: 18 May 2007 09:04

Re: Patch: Town Restructuring r11088

Post by wleader »

Well Roujin, I think the hard part here is going to be balancing the prices. The code as it is now, is a lot more effective, but still cheaper than bribing the local authority. I'm thinking that perhaps I have lowered the rating cost to much, and raised the money cost too little. I also just realized that I haven't tested this at all with a network game. Hopefully Chriscomm will like it enough to put it into ChrisIN, and then it might get some real testing. I'm still hoping for some feedback on my coding style. I probably ought to add some comments to some of the changes I ended up making. For example, I ended up changing the prototype of the clear tile command to use a uint32 instead of a byte for the flags variable. This was to allow passing more information in the flags, but it caused me to change what would have been unrelated files like station_cmd.cpp.
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Patch: Town Restructuring r11088

Post by Roujin »

After looking at it, i changed my mind a bit. Actually it's really nice, but as you mentioned, far too powerful at the moment...

some comments:

1) When you reallocate something, the town builds something somewhere - there's no guarantee that it actually fits what you bought, right? For example you reallocate a huge skyscraper, and the town builds some small flats in the outskirts? hmm :/

2) At the moment , this makes erasing a whole town quite easy, since you can still "reallocate" if the town finds no place to rebuild. so just "reallocate" all the roads or alternatively buy all land around existing roads the town has, then "reallocate" one building after another. Since you lose rating only very slowly, you can easily erase a medium sized town... it won't reallocate its buildings because it has no space to do so.


If you exploit what i wrote in 2), this becomes just a second bulldozer, more expensive than the normal one, but with less rating loss.


Would it be possible to have the town somehow check if it can build somewhere, before allowing you to reallocate? It's probably not easy, but it would solve this issue...
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
wleader
Engineer
Engineer
Posts: 123
Joined: 18 May 2007 09:04

Re: Patch: Town Restructuring r11088

Post by wleader »

Roujin wrote:... example you reallocate a huge skyscraper, and the town builds some small flats in the outskirts? ...
This is because I had two choices about how to do things. I could either just call GrowTown which makes its own decisions about what to build, or I could make a major change and try to re-grow exactly what was replaced by finding the building spec, and use that when constructing. For the first draft I went with the simpler method. Another thought I had was to call GrowTown until the population returned to the original value, but that didn't work so well since the population of a building doesn't count while its under construction. Unfortunately I don't see a way to correct this without a lot of work.
Roujin wrote: ... you can still "reallocate" if the town finds no place to rebuild.
Actually since I made a change to GrowTown to correctly return True when a house is built, I can check the result before clearing the tile. If a Grow doesn't happen, then the purchase land fails. This exploit would likely be easier to correct then the first one you mentioned.
wleader
Engineer
Engineer
Posts: 123
Joined: 18 May 2007 09:04

Re: Patch: Town Restructuring r11088

Post by wleader »

I've been looking into the code trying to find ways to prevent buying land if the town can't grow, Unfortunately due to the way the grow town code works currently, I won 't be able to fix either of the issues without a serious re-write of larger portions of town_cmd.cpp. Additionally it would require making the town growth code predictable. Since it currently uses random a good bit, making it predictable would require removal of the randomness, which I don't think I can do. So unfortunately the current draft of the patch is probably going to be the best I can offer for now. Perhaps as my C++ skills and familiarity with the OTTD code grows I can look again at this.
fabca2
Transport Coordinator
Transport Coordinator
Posts: 312
Joined: 14 Apr 2004 15:18
Location: Fr

Re: Patch: Town Restructuring r11088

Post by fabca2 »

suggestion,
it would be great to limit reallocation by 10% of city space.
in this way you avoid the wide buldoze explained by Roujin.
10% is not too small, the spirit of this patch is to inject stations on BIG cities.

Also, it would be great to pay yearly fees on every tile you get (unconstructed)
That mean if you buy a large area of the city (not more than 10%) you have to pay to keep it unconstructed forever...
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 9 guests