[patch] Vehicle efficiency and cargo-tiles transported

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
User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

[patch] Vehicle efficiency and cargo-tiles transported

Post by jfs »

Since first playing with Cargodist and transfer credits enabled, the false negative profits on slow vehicles in end legs have been a huge problem for me. Especially since they affect your performance rating, making the "Min. profit" element near-impossible to achieve.
So what other measures of "is this vehicle useful" could one make? How about, actual cargo amount over distance transported, compared to the potential cargo amount over distance it could have transported?
Coal train with expected efficiency ratings
Coal train with expected efficiency ratings
openttd_2018-02-11_13-07-45.png (160.03 KiB) Viewed 4995 times
This patch adds an "Efficiency" statistic to all vehicles. The statistic is calculated based on "delivered cargo-tiles past year" divided by "potential cargo-tiles past year".

The two statistics are derived as follows:
- Delivered cargo-tiles is updated whenever the vehicle unloads cargo at a station, regardless of whether it's a transfer or a final delivery. The count of cargo-units unloaded is multiplied by the (Manhattan) distance between the pick-up station and the unload station, to get a cargo-tiles value.
- Potential cargo-tiles is updated both while a vehicle is traveling, and also while it's sitting idle at a station not active loading/unloading cargo. It multiplies total cargo capacity of a vehicle with distance actually traveled, or in the case of idling at a station the potential distance traveled.

These calculations lead to the following effects:
- Vehicles always running full will have (approximately) 100% efficiency rating.
- Goods vehicles only transporting cargo in one direction, and returning empty, will have efficiency around 50%.
- Vehicles running on "scenic" routes, that take more turns back and forth than necessary, will have lower efficiency, because delivered distance is as the bird flies, while potential distance is actual traveled distance.
- Having too many vehicles servicing a route will mean either running empty, or waiting for full load without receiving cargo, and will lower efficiency drastically.

As implemented right now, the calculation may be overly cruel, and probably needs tweaking.
Efficiency rating in performance rating and vehicle list
Efficiency rating in performance rating and vehicle list
openttd_2018-02-11_13-33-57.png (45.42 KiB) Viewed 530 times
The efficiency rating is also available in the vehicle list, and you can sort by it.

And, perhaps the part of this patch with the most potential for controversy: The performance rating is now calculated based not on worst vehicle profit, but on worst vehicle efficiency.
However I've prepared for making it a game setting, whether to use one or the other ;)


As for the patch code itself, this is my first time hacking on OpenTTD, so there may be things that should be done differently. Please critique my code.
openttd-cargotiles1a.patch
Patch for svn r27967
(29.68 KiB) Downloaded 135 times
Last edited by jfs on 12 Feb 2018 21:16, edited 1 time in total.
User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: Vehicle efficiency and cargo-tiles transported

Post by jfs »

Improved with settings for selecting new or original performance rating calculation (default to original), as well as a one to tune idle-loading penalty is applied (effectively a difficulty setting).

Here is a Windows build
Attachments
openttd-cargotiles2.patch
Patch revision 2 (based on svn r27067)
(36.82 KiB) Downloaded 121 times
User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: [patch] Vehicle efficiency and cargo-tiles transported

Post by jfs »

Dusted this off a bit and put on GitHub: https://github.com/nielsmh/OpenTTD/tree/cargotiles

I'd appreciate some feedback on this patch, from a gameplay perspective. Is it actually interesting to others? Useful?
Deicide
Engineer
Engineer
Posts: 19
Joined: 17 May 2011 16:02

Re: [patch] Vehicle efficiency and cargo-tiles transported

Post by Deicide »

Everything seems fine, except I would love an option to select the minimal efficiency for performance rating calculation: it will allow the player to choose the level of route optimization to strive for to achieve maximum rating. I like to build the routes that are circuitous, since I find them appealing to look at, and I'd rather not be told by the game to build super straight roads, especially in mountainous terrain with lots of cities and industries.
User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: [patch] Vehicle efficiency and cargo-tiles transported

Post by jfs »

Thanks a lot for trying it out and giving your thoughts.

My interpretation of the Performance Rating is that it's a metric for how the company would fare as a publicly traded corporation, i.e. under the scrutiny of shareholders wanting to maximize personal profit. In that view, having vehicles running sub-optimal routes or spending much time running empty is a pure negative waste of resources. I think a better approach to your play style would be finding some way to model a "customer satisfaction" metric that can be included in the performance rating calculation.
Deicide
Engineer
Engineer
Posts: 19
Joined: 17 May 2011 16:02

Re: [patch] Vehicle efficiency and cargo-tiles transported

Post by Deicide »

For me TTD - is a game, not a simulation, therefore I look at every aspect of the game as a game designer. For me performance rating is a game mechanic that rewards the player with a pat on the head for doing something that should feel rewarding. I don't feel rewarded for making excessively optimal routes, since there is only 1 way to make a perfect thing, but there are countless ways to be sub-optimal. My suggestion allows the game to know, what is rewarding for the particular player, since we all have different desires.
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1354
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Re: [patch] Vehicle efficiency and cargo-tiles transported

Post by MagicBuzz »

Deicide > I Don't like at all your point of view.

jfs isn't speaking about rewarding, but train performance.

The goal of the game is to build an efficient transportation network.
As a result, I feel natural that the game provides some indicators to help us in this direction.

At last, you say "OTTD is a game, not a simultation".

Well… not really wrong, but actually not right neither.

Regarding the "About" section of official OTTD site :
About
OpenTTD is an open source simulation game based upon the popular Microprose game "Transport Tycoon Deluxe", written by Chris Sawyer. It attempts to mimic the original game as closely as possible while extending it with new features.
As a simultation game, OTTD is a simultation, and any tool making it more realistic is welcome.
User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: [patch] Vehicle efficiency and cargo-tiles transported

Post by jfs »

Let me just explain where my view of the performance rating comes from: Before publishing Transport Tycoon, Microprose had published Sid Meier's Railroad Tycoon (and Deluxe), in which your company is explicitly a publicly traded corporation. At the end of each fiscal year you get various performance rating numbers, but perhaps the most important one is the opinion of the shareholders, "concerned", "ecstatic", several more. Your goal in Sid Meier's game of Railroad Tycoon, as set by the game mechanics, is not to build a railroading company the way you prefer, but the way that makes the simulated shareholders happy. I can't know what kind of publishing agreements Chris Sawyer had with Microprose, if the "Tycoon" name they gave his game meant they also asked to make it similar in some aspects, but it sounds likely to me that they would want success in either game to be measured in similar ways.

Despite the unrealistic powers a transportation company in TT holds, I think it still makes the most sense to think of the companies as publicly traded entities that have shareholders, whom you want to please. In that regard, most of the parts of the performance rating do give an indication of how well the company would be regarded as an object of investment: Good cash flow, has a large portfolio of services, all services are making money, less volatile by servicing many markets (cargo types), etc.

Customer satisfaction isn't really regarded as a metric anywhere, except as the station rating, which only serves as a metric of how popular your service is relative to alternatives. It might be possible to make an alternative rule set where your company isn't graded as much on the financial viability as by the quality of the service provided to customers, but it isn't something I plan on doing in this patch, at least not right away. It could be an interesting challenge some time in the future, but I imagine it would require some NewGRF support to e.g. grade vehicles by comfort level.


On the other hand, if your reason for building "scenic" routes through mountainous terrain is that it's how they ought to look based on prototypical railway design, because anything else wouldn't be technically/financially viable in reality, the variable you should be tuning isn't what cargo-miles efficiency rating is considered "good", but whether the game mechanics (costs etc.) makes simply tunneling through the mountain a worse choice than taking the long way around. My view of simulation games is that they shouldn't reward the player for playing realistically, but rather should punish the player for trying to do unrealistic things. The reward comes from having success after implementing a difficult plan, which was nonetheless the best choice. The real challenge here, for game designers/modders, is to make something that doesn't just turn out un-fun.
SimYouLater
Chief Executive
Chief Executive
Posts: 675
Joined: 03 Apr 2016 20:19

Re: [patch] Vehicle efficiency and cargo-tiles transported

Post by SimYouLater »

MagicBuzz wrote:The goal of the game is to build an efficient transportation network.
Lots of people treat trains as a highway network and try to make efficient junctions, but there are also a lot of people who build realistic networks that are inefficient compared to the "megatrain" play style. If OpenTTD is a simulation game, both play styles should be viable.
Licenses for my work...
You automatically have my permission to re-license graphics or code by me if needed for use in any project that is not GPL v2, on the condition that if you release any derivatives of my graphics they're automatically considered as ALSO GPL v2 (code may remain unreleased, but please do provide it) and carry this provision in GPL v2 uses.
Please ask someone in-the-know to be sure that the graphics are done by me. Especially TTD-Scale, long story.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 8 guests