Abandoned Roads feature revived

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

Post Reply
marcole
Engineer
Engineer
Posts: 7
Joined: 30 Jun 2015 18:07

Abandoned Roads feature revived

Post by marcole »

Hi everyone,

I used to play OpenTTD and also TTDPatch some time ago and recently came to the conclusion I really miss this feature in OpenTTD.
Also I would like the list of partial advantages of TTDPatch over OpenTTD to be diminishing over time ;-)
So I tried to dig into the code and this is the outcome.

Here is my revival of Abandoned Roads feature inspired by work of noone77 (http://www.tt-forums.net/viewtopic.php?t=19891) and originally created by Csaba Varga (http://www.tt-wiki.net/wiki/AbandonedRoads).
I haven't found anything similar or more up-to-date so I decided to give it a try.

I have expanded the functionality a little with following 4 modes (+ off mode).
1 = roads lose owner after set time of inactivity (no passing road vehicles)
2 = nearby towns take over the roads if owner is lost
3 = companies take over the unowned roads if using them
4 = roads without maintenance start to decay over time
You can see some of the settings in the attached screenshot.

Feature was expanded to also cover road bridges and drive through road stops.
The tramways are handled differently because of lack of storage but also work to some extent.
(They have double lifetime, towns don't influence them and they don't decay at all)

My idea is to share the patch with you to learn if it could be seen as a useful feature.
Also I would like to have it well tested although I have done pretty thorough testing myself.
For now it is one larger patch to apply more easily.
I am planning of course to divide it into several smaller patches later.
Not everything included is absolutely necessary and the code revision will be easier with smaller patches.

Thanks and keep up the good work.

Marek
Attachments
abandoned_roads.patch
Abandoned roads patch for the current trunk r27324
(47.3 KiB) Downloaded 64 times
Abandoned roads feature settings
Abandoned roads feature settings
abandoned_roads_settings.png (16.89 KiB) Viewed 3704 times
User avatar
kamnet
Moderator
Moderator
Posts: 8588
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: Abandoned Roads feature revived

Post by kamnet »

How does this affect infrastructure cost and maintenance? If I build a bunch of roads, and stop using them, will my costs be decreased?

Also, what if I have an established road route, but another player blocks it while trying to grief, and my vehicle is forced to take an alternate route over roads I didn't build. Does this player now saddle me with new infrastructure debt that I didn't create or want?
marcole
Engineer
Engineer
Posts: 7
Joined: 30 Jun 2015 18:07

Re: Abandoned Roads feature revived

Post by marcole »

Your maintenance costs will be updated accordingly so you will see your infrastructure count decrease when losing roads.

In case of other player blocking your road route I guess there is no big difference to the current state.
If he is able to block you then, he is able to also do it now.
Your vehicles may start using different roads if available but that is actually desirable if you want your cargo delivered.
Side effect here is that you will even be relieved of the burden of maintaining roads which you cannot use anymore (after some time).
And the new roads will become yours only if they are not used for some time by the building company and thus don't have an owner.

Of course this all depends on the actual setting you are using (e.g. this is in default mode).
User avatar
kamnet
Moderator
Moderator
Posts: 8588
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: Abandoned Roads feature revived

Post by kamnet »

Seems to me that the latter situation is a very undesirable outcome that can be abused for griefing. You can be blocked from accessing the infrastructure that you built, and instead of freely passing on somebody else's built roads you'll be forced to take on the infrastructure costs of those roads as well. Infrastructure doesn't become cheaper the more you own it, and it could very well sink a company's profits if a player is unaware that they're being griefed in this manner. Even worse is if somebody can start another company and intentionally build a ton of useless roads and then abandons or bankrupts their company so that your vehicles will get snarled in it.

Is there an option to disable automatic road ownership of another player's abandoned roads?
marcole
Engineer
Engineer
Posts: 7
Joined: 30 Jun 2015 18:07

Re: Abandoned Roads feature revived

Post by marcole »

Yes, there is. You can use mode up to 2 from the list above.
Each following mode adds functionality on top of the previous ones.
At least that's the current state of the patch.
User avatar
Pyoro
Tycoon
Tycoon
Posts: 2558
Joined: 17 Oct 2008 12:17
Location: Virgo Supercluster

Re: Abandoned Roads feature revived

Post by Pyoro »

Mmhm. Any chance there'll be a mode that let's towns take over roads that are, I don't know, maybe next to town-houses? I'm thinking of this as a sort-of setting combination with the "towns don't build roads" setting; which obviously means the player will have to build those, too. But from a realism aspect (not that it's particularly realistic in the first place ;) ) it never made much sense that you'd have to maintain them, even if you do use them for buses or whatever ...

In any case great patch ;)
marcole
Engineer
Engineer
Posts: 7
Joined: 30 Jun 2015 18:07

Re: Abandoned Roads feature revived

Post by marcole »

Actually that is quite good idea and shouldn't be hard to do.
Question is if it should be separate mode or just an additional way of towns taking over roads.

And if you mean that towns would take over the roads immediately without waiting for them to be abandoned, there was such feature mode in the original implementation although I didn't include it because it seemed a bit inconsistent to me.
Nevertheless it also could be done, e.g. as a separate option to switch between aggressive and patient town behaviour... ;-)
User avatar
Pyoro
Tycoon
Tycoon
Posts: 2558
Joined: 17 Oct 2008 12:17
Location: Virgo Supercluster

Re: Abandoned Roads feature revived

Post by Pyoro »

Yeah, I'm thinking of the "aggressive" take-over, TTDpatch style, if I remember this correctly. Immediate or delayed isn't what concerns me, it's just that in busy cities the town would never take over any roads if traffic "resets" the counter. Basically I think that streets that are clearly inside a town (which is why I think a good indicator would be a town building next to them...) should be owned by the towns, regardless of who built them or uses them.

All other concerns aside, that prevents "generic car" AIs from taking over the road networks inside cities at least. The government can pay for those, it's ridiculous enough I have to maintain inter-city routes. ;)
marcole
Engineer
Engineer
Posts: 7
Joined: 30 Jun 2015 18:07

Re: Abandoned Roads feature revived

Post by marcole »

I can see your point, it makes sense although it would need to be thought over thoroughly (e.g. delay possibility).
Actually, TTDPatch had this as an option only, I usually was using the basic mode, as far as I remember.

Thanks for your insights, I will think about it :-)

As for the AIs taking over roads in towns, it is not possible because as the patch is implemented, the towns always take precedence when abandoned road loses/changes owner.
Thus only the original building company is able to retain the ownership as long as the road is being used by them.
As soon as it is abandoned, the town walks in.
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

Re: Abandoned Roads feature revived

Post by Eddi »

Pyoro wrote:streets that are clearly inside a town (which is why I think a good indicator would be a town building next to them...)
a slight problem with that logic is that 4-way-crossings will never have houses besides them, and will become isolated tiles with an odd owner. (also applies to other situations where something blocks the construction of a house)
User avatar
Pyoro
Tycoon
Tycoon
Posts: 2558
Joined: 17 Oct 2008 12:17
Location: Virgo Supercluster

Re: Abandoned Roads feature revived

Post by Pyoro »

True. I suppose technically a road piece that "surrounded" by town owned road tiles could automatically be converted as a special case, but as you say there's still probably other cases where the same would happen - like building a bus stop on both sides of a road piece etc.
I suppose two towns growing into each other would also potentially be problematic. Something to think about if if we have Town-A-House|Road|Town-B-House ... who gets the road? ;)
And then everything gets complicated and convoluted... ^^

Doubt there's a perfect solution. Just seemed like the "easiest" way from my non-programming perspective at first glance ^^;

²marcole
Ah, thanks for the clarification. And thanks for your willingness to think about this ;)
marcole
Engineer
Engineer
Posts: 7
Joined: 30 Jun 2015 18:07

Re: Abandoned Roads feature revived

Post by marcole »

As I see it all these complications should be able to be resolved as long as we can agree on the mechanics.
The roads with houses nearby but not adjacent are likely to be in the town radius anyway so the town will eventually claim them.
We may even check all 8 surrounding tiles for houses if need be.

And when the towns grow into each other it usually has quite strange outcome in case of ownership.
But the roads should be already preassigned and you don't have to worry about which town it actually is.
Basically the local town authority decides.

In fact all the town ownership thing is a bit inconsistent.
The town is able to own roads, bridges, houses and road under drive-through stations.
But the only ones that actually hold the specific town information are plain roads.

Bridges can be "owned" by two different towns (one on each end) if suitable bridge is built.
That doesn't make much sense and also has implications for construction actions like removing the bridge.

And the drive-through stations actually remove the town ownership information from town owned roads when built.
So if the road is owned by one town (expanded into different town's local authority) by building the drive-through station the road switches the owner to the other one...
marcole
Engineer
Engineer
Posts: 7
Joined: 30 Jun 2015 18:07

Re: Abandoned Roads feature revived

Post by marcole »

Finally I managed to divide the patch into smaller pieces (maybe too small, but I tried my best ;-))
Also I have found and corrected several bugs although those were not at all serious.

And thanks to Pyoro's suggestions I have expanded the feature with two ideas.

1) There is now a separate option to allow "immediate" takeover of roads by nearby towns, regardless of the main setting.
This switches on sort of aggressive town behaviour when it doesn't wait for the road to be abandoned by former company owner.
It actually doesn't happen immediately, but during the next tile check, which happens in 32 days at latest.

2) The tile check for town influence has been altered to consider also roads near town houses or too many other town owned tiles.
It is incorporated into the code so the town always considers this and not only its zone radius.
The tile count is 3 for non-house tiles (roads, bridges) while one town house is enough.

I'm thinking of further work on distinguishing between various towns but for now it doesn't matter.
And the primary goal should be achieved from my point of view.

Marek
Attachments
abandoned_roads.7z
Abandoned roads patch queue
(12.23 KiB) Downloaded 65 times
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 31 guests