News:

Simutrans Tools
Know our tools that can help you to create add-ons, install and customize Simutrans.

Road liability QoL improvements

Started by DrSuperGood, January 06, 2018, 04:04:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DrSuperGood

There are currently 2 road liabilities in Simutrans Extended.
1. Monthly maintenance. Same as standard and very predictable.
2. Renewal. New to extended. Depends how much road is used. Not easily predicted.

Currently the UI gives information for both, but as a user it is hard to use these to make estimations of the effective monthly liability for a road.

A good example is the server game currently. It is 1765 and cobblestone roads have just been introduced which are statistically vastly superior to unsurfaced roads. Since in 1765 there are no vehicles that require the superior stats of cobblestone roads (pakset bug?) it all comes down to effective liability. Cobblestone roads have more maintenance liability per month but also higher durability so need to be renewed less often compared with unsurfaced roads. So this leaves the user asking the question, what way averages less liability?

Well the answer to that specific question is unsurfaced road, clearly cobblestone roads are bugged as they are introduced before anything requires them and both kinds of liabilities are larger. However would it not be useful for users to get this kind of information from the UI?

When selecting a tile of road using the magnifying glass tool the following metrics would be useful...
Estimated renewal: The estimated renewal date, computed by extrapolating the rate of durability loss from the time of last renewal until now. Unknown for freshly renewed ways. Gives the user some idea when the way will be renewed, even if not accurate.

Average monthly damage: The average durability loss per month between last renewal and now. Unknown for freshly renewed ways. Gives the user some idea of how much traffic a way is receiving. If a way is receiving a lot of traffic then it might be worth changing to a higher maintenance but tougher or cheaper to renew type of way.

Estimated monthly liability: The monthly maintenance cost plus the averaged monthly renewal cost computed using some of the above metrics. This gives the player an estimation of how much a way is actually costing them to maintain per month, even if some of it is only due a long time in the future. This factors in way damage so one would see that more heavily used ways have higher estimated monthly liabilities than less used ones due to requiring more renewals. Possibly also unknown for freshly renewed ways.

Ideally the estimations should only use last months usage statistics, or even usage statistics for the last hour or so in order to be more accurate and remove periods of unknown after each renewal. However this would require saving extra metrics per way tile unlike the above which can likely be done with existing saved data. Any estimation is better than none so I think going with the above is fair.

Also for the way purchase UI it would be nice if renewal costs could be shown. Where as cobblestone road has a similar per KM cost to unsurfaced road, its renewal cost is over 3 times larger per km (pakset bug?). I would suggest listing the cost per km some what like...
Current -> Cobblestone road, 164.96c (4.96c) / km, 35km/h, 3t, 1,316.0000 durability
Suggestion -> Cobblestone road, 164.96c/km + 4.96c/km/month + 64.96c/km/renew,  35km/h, 3t, 1,316 durability
As this is a translated formatted string it might temporarily mess up some localizations.

jamespetts

Thank you for the suggestions. I should note that the information requested would be much more than a real 18th/19th or even early 20th century transport concern would ever have had available to it.

As to the statistics, all of them would require the storage of more data per tile of way, since currently, the only relevant statistics are (1) the number of convoys passing in the last month (as with Standard); and (2) the current condition (a single integer). To compute wear per month, one would also have to know either the condition last month or the way wear factor of all of the convoys passing in the last month. This would require, at the very least, one more integer per tile of way. I am a little concerned about the possible memory consumption impact of this, as there are an awful lot of way tiles in a large game, and we are already approaching 4Gb of memory on the Bridgewater-Brunel server.

In relation to the toolstrip, I wonder whether this might make it too long? I should be grateful for others' views on that.

As to the costs of various roads, I should note that costs have not been balanced yet, so non-optimal costs are not so much bugs as things not yet completed.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

I like the ideas, but I so far I can think, only one of the suggestions is doable only in the GUI, namely the prediction on when the road is degraded, where you only need to know the current condition as well as when the road was last renewed. It would be quite imprecise, and it would probably best be measured in years.

DrSuperGood

QuoteAs to the statistics, all of them would require the storage of more data per tile of way, since currently, the only relevant statistics are (1) the number of convoys passing in the last month (as with Standard); and (2) the current condition (a single integer). To compute wear per month, one would also have to know either the condition last month or the way wear factor of all of the convoys passing in the last month. This would require, at the very least, one more integer per tile of way. I am a little concerned about the possible memory consumption impact of this, as there are an awful lot of way tiles in a large game, and we are already approaching 4Gb of memory on the Bridgewater-Brunel server.
Every tile already stores the date it was last renewed. Combined with current durability and that one knows what original durability was (from the tile type) all the above metrics can be derived for UI use only without having to store anything extra.

If one wants more accurate predictions, then yes other data would need to be stored. The problem with the above approach is with continuously extending averages, like what Simutrans Standard town growth suffered from before it was changed to use immediate metrics. That said it is still better than no estimation at all.

jamespetts

Yes, I see that doing it that way (as Ves suggested, I believe) would be relatively straightforward, albeit inaccurate. But given that the inaccuracy only affects a GUI display which would be clearly stated to be an estimate, this would not be too bad.

One could derive the probable date of renewal and average monthly wear from the existing data, I think without too much work.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

Im working on this improvement, and there are some questions/issues I want to clarify:

At what degrationpercentage is the way automatically upgraded, and is it a set number in simuconf.tab? Where can I find it.
When starting a new map and look at the prebuilt roads by the game, the estimated renewal date will look quite odd. Since the road is set to be built at a date that predates the "game creation" date, but the condition is at 100%, it can appear that some of those roads will last for several 100 years initially.
Could this be fixed in the way that when ways are generated by the game on map creation, it also sets the degration of the road accordingly to its age? As ways degrade over time automatically, it should be easy to do this I guess?

jamespetts

Quote from: Ves on February 08, 2018, 09:46:29 PM
Im working on this improvement, and there are some questions/issues I want to clarify:

At what degrationpercentage is the way automatically upgraded, and is it a set number in simuconf.tab? Where can I find it.

Here:


# This is the fraction of the way's total wear capacity below which
# the way will count as degraded and be automatically renewed or,
# if the player has insufficient money or auto-renewal has been
# disabled for the way in question, will enter a degraded state
# in which the speed limit will be reduced. (At a state of 0,
# the way will become totally impassable).
# Default: 7 (approx. 14%).

way_degradation_fraction = 7


Quote
When starting a new map and look at the prebuilt roads by the game, the estimated renewal date will look quite odd. Since the road is set to be built at a date that predates the "game creation" date, but the condition is at 100%, it can appear that some of those roads will last for several 100 years initially.
Could this be fixed in the way that when ways are generated by the game on map creation, it also sets the degration of the road accordingly to its age? As ways degrade over time automatically, it should be easy to do this I guess?

I am not sure that I quite follow this - you refer to the "age of the road", but, of course, on map creation, the road is completely new; did you mean something non-obvious here...?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

When you create a new map, the roads on the map are not new, they are reported as being 10-20 years old or so.
Thanks, I will look at that!

jamespetts

Quote from: Ves on February 08, 2018, 10:41:51 PM
When you create a new map, the roads on the map are not new, they are reported as being 10-20 years old or so.

Where is this information reported? When I create a new map, the roads are marked as "Built: January 1750" (assuming that the map starts in January 1750).
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

Are you sure? On my savegame starting year 1914, I have roads built as early as 1832! It appears that the closer to the city hall the roads are located, the older they are.

edit
I can tell you the renew date for those roads is beyond the year 5300!! :o

jamespetts

Quote from: Ves on February 08, 2018, 11:07:27 PM
Are you sure? On my savegame starting year 1914, I have roads built as early as 1832! It appears that the closer to the city hall the roads are located, the older they are.

edit
I can tell you the renew date for those roads is beyond the year 5300!! :o

Interesting - for roads in towns (but only in towns) and with map generation later than the earliest year for map creation (i.e. 1750), the build date will be a build date based on the presumed age of the town (based on the town generation algorithm). This seems too inconsistent to use for all roads, however.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

But would you like to change the condition of the road based on its age on map creation?

Otherwise, I could "solve" it by having a text replace the year when it exceeds, say 50 years. That is still very far off in the future, but any dates that predicts so far would anyway be very imprecise. Speaking of imprecise, the renewal date fluctuates a bit between months as a month progress. This is due to it not knowing when in the month the road was built, as wel as it doesnt take into account how far we are into the current month. I am trying to circumnavigate this by having a multiplier that keeps track of how far we are in the month, and adding that to the calculation.

jamespetts

Quote from: Ves on February 09, 2018, 11:48:13 PM
But would you like to change the condition of the road based on its age on map creation?

I do not think that this would be desirable, as there is no consistency in ageing on map creation, as set out above.

QuoteOtherwise, I could "solve" it by having a text replace the year when it exceeds, say 50 years. That is still very far off in the future, but any dates that predicts so far would anyway be very imprecise.

I think that it is better left as it is, as this is potentially confusing.

QuoteSpeaking of imprecise, the renewal date fluctuates a bit between months as a month progress. This is due to it not knowing when in the month the road was built, as wel as it doesnt take into account how far we are into the current month. I am trying to circumnavigate this by having a multiplier that keeps track of how far we are in the month, and adding that to the calculation.

Presumably, this does not require storing extra data per tile of road?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

Well, it doesn't matter wether the age of the way is consistent on map creation. Eventual way degration should just be consistent with how old a particular waytile is. Already ways wear also only by age, so it seems easy to just multiply the age of the road with wear/time.

No, nothing is stored anywhere. Everything is calculated when the window is open.

What do you mean is better left as is?
Should I walk away from the feature entirely?

jamespetts

Quote from: Ves on February 10, 2018, 12:46:55 PM
Well, it doesn't matter wether the age of the way is consistent on map creation. Eventual way degration should just be consistent with how old a particular waytile is. Already ways wear also only by age, so it seems easy to just multiply the age of the road with wear/time.

No, nothing is stored anywhere. Everything is calculated when the window is open.

What do you mean is better left as is?
Should I walk away from the feature entirely?

No, I mean that it is better not to interfere with the way that age is displayed; if you were referring to the new feature when you referred to adding text if a way is over a certain age, then I misunderstood: my apologies.

What might be better is for the feature that you are writing to check whether a way tile is older than the map creation date (which is stored), and then calculate the age of the way for the purpose of this feature on the basis that the build time is the later of the build time recorded in the way and the map creation date.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ves

#15
Ah ok, so we can pull the game month that the map was created? That's great I will use that instead! :-)

edit:
Hmm, looking in simworld.h where I have grabbed most of the other stuff, I could only find things like get_steps() // (Number of steps elapsed since the map was generated), which seems a bit overkill if I where to translate that to years and then compare the values. Do you know of another place where the starting year is registered?

edit2:
The current implementation is online now, but without detecting the very old roads: https://github.com/VictorErik/Simutrans-Experimental-Ves/tree/small-gui-fixes
You are permitted to upload the dat-file :)

jamespetts

Splendid, thank you for your work on this.

I do not know exactly where it is stored, since I have not looked into this; but I know that it must be stored, since this datum is used whenever a server transmits an announce packet to the listing server, as this datum is always shown on the online server listing. You might be able to find how this is computed and re-use the code by looking at the network announce code.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.