Patch: improved station ratings (NEW version 1.1)

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
Tekky
Route Supervisor
Route Supervisor
Posts: 420
Joined: 19 Dec 2006 04:24

Patch: improved station ratings (NEW version 1.1)

Post by Tekky »

In this patch, I have significantly modified the behavior of station ratings, in the following way:

In the standard OpenTTD program, the station ratings are influenced by
  1. the maximum speed of the last train,
  2. the age of the last train,
  3. the time since the last train visited,
  4. the amount of cargo waiting at the station,
  5. whether a statue has been built or not.
Follow this link for more detailed information.

My patch changes this behavior so that the station rating depends to 90% on the relationship between cargo waiting at the station and cargo delivered per month. The remaining 10% is determined by whether you have built a statue or not. The maximum speed and age of the last train is no longer taken into account, and the time since the last train's visit is also no longer directly taken into account, only indirectly by the fact that additional cargo is waiting to be picked up, which affects your rating negatively if the stockpile gets too large.

However, although my new rating system is similar to the current OpenTTD rating system in that both are based on the amount of cargo waiting to be picked up in a station, my new rating system works very differently: As long as you don't let the cargo stockpile at the station get any larger than one month of production output, you will suffer no rating penalty at all. In contrast, the current OpenTTD rating system already gives you a rating penalty for having a stockpile of only 100 units, which forces you to always have at least one train in the station with a "full load" order, in order to keep a high rating.

The main advantage of my new rating system is that it is enough if you visit a station from time to time and don't let the stockpile get too large. My patch accomplishes this by keeping track of the total production output of a station, so that stations with more production may also have a larger stockpile before suffering a penalty. The current OpenTTD station rating system does NOT take the production of a station into account, it only has fixed size limits for the stockpile.

My patch is not limited to station ratings, though: In the current town rating system, active stations which have been visited in the last 50 days give you a +12 monthly town rating bonus and stations which haven't been visited in the last 50 days give you a -15 town rating penalty. My patch changes the previously mentioned 50 days to 3 months, so it is sufficient to visit a station every 3 months to get a town rating bonus instead of a penalty.

The main disadvantage, however, is that it is very easy to get a station rating of 90% (100% with statue), which means there will be no real competition in multiplayer games when fighting over an industry.

This patch does not change the savegame format, so that my version should be able to load standard OpenTTD savegames and the standard version of OpenTTD should also be able to read savegames produced by my version. However, as a precaution, I do recommend that you make a backup of your savegames before overwriting them with my version of the game.

I decided not to make a patch option for my patch (at least for now) because that would break the savegame compatibility mentioned above.

Also, I would like to point out that I have not tested this patch in multiplayer and, if I understand the multiplayer mechanism correctly, it will cause desyncs in multiplayer. In order to make it multiplayer compatible, I would have to change the savegame format, which would break savegame compatibility with trunk.

I'd appreciate any feedback you have on my new station rating system.

ChangeLog:
r13992/r13994: original version 1.0
r14126: version 1.1 with the following changes:
  1. Removed vicious circle present in version 1.0 in which a production decrease reduced the permitted size of a stockpile, which caused the now overflowing stockpile to reduce station rating, which reduced production even further, causing the vicious circle to start over again, eventually causing the station rating to drop to 0%. Now the permitted size of a stockpile with which you can still get a station rating of 100% will be reduced per month by a maximum of 10 units (which is very slow!), so this vicious circle is now broken.
  2. The permitted size of a stockpile that still allows for a 100% station rating is now not only dependent on the amount of cargo produced by industry, but it also takes into account the amount of cargo transferred by "transfer" orders to the station. This means that stations that receive a lot of cargo with "transfer" orders and do not receive production directly from industries, may now have a stockpile as large as if they were receiving this cargo directly from industry.
  3. The station rating is now not only determined by the size of the stockpile. If a station is neglected for more than 3 months, the station rating will start to drop, even if the station's stockpile is empty.
  4. Reduced the number of months a station may be inactive, before it causes a negative town rating, to 3 months. In version 1.0, I had unintentionally set this value to 7 months because the OpenTTD wiki contained false information. Compared to trunk, this is still an increase, as OpenTTD trunk sets this value to 50 days.
You can download my patch as a diff file (created from r14126) using the link below. For the users of Windows 2000/XP/Vista who have no compiler, I have provided a compiled Win32 binary on Rapidshare.
Attachments
station_ratings_r14126.diff
svn diff
(3.93 KiB) Downloaded 150 times
Last edited by Tekky on 23 Aug 2008 13:02, edited 9 times in total.
User avatar
CommanderZ
Tycoon
Tycoon
Posts: 1872
Joined: 07 Apr 2008 18:29
Location: Czech Republic
Contact:

Re: Patch: improved station ratings

Post by CommanderZ »

The main disadvantage, however, is that it is very easy to get a station rating of 90% (100% with statue), which means there will be no real competition in multiplayer games when fighting over an industry.
This is too bad, in vanilla it is quite hard to get over 80% (and it should be so, 100% shouldn't be achievable). You must change this somehow, because it renders the patch pretty useless.

The premise is good though, I agree some factors trunk takes into accounts are slighty "over the top".
Tekky
Route Supervisor
Route Supervisor
Posts: 420
Joined: 19 Dec 2006 04:24

Re: Patch: improved station ratings

Post by Tekky »

In what way should it be harder to get a good station rating?

The unpatched OpenTTD forces you to always have a train waiting in the station with a "full load" order, in order to get a good rating. My patch does not require this, which I think is an improvement.

Also, the unpatched OpenTTD requires you to use brand new trains and trains with a fast max speed, but it doesn't care about the actual avarage speed of the train. My patch does not take any of this into account, which I think is better.

I agree that this makes it maybe a bit too easy to reach 100% station rating, but I see no better solution.
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

Re: Patch: improved station ratings

Post by Eddi »

i don't really agree with the premise of this patch... why should it be so easy to get a 100% rating at a station? you need to have a small window left that leaves the "optimisation nerds" space to fiddle and squeeze that last bit of rating out of the system, so they have a % more than the competitors. it should be very easy to get a medicore rating of 50 or 75% with a regular service, anything above that should require some really good effort for the gain.

my problem with the rating system is that it does not properly adjust to low transportation amounts. like if you have a network that can transport 10% of an industry's theoretical limit, the industry starts out with 70% production, the cargo piles up to like 2000 items before the rating significantly drops. after that the production drops to like 30%, where 2/3 of the produced cargo is thrown away before the vehicle arrives again.

you are never able to reduce on that stockpile, because it is the only thing that balances the production to a transportable level. the problem is, this will heavily disturb any network that is based on transfers [especially cargo destinations], because any transfer piles will render your cargo worthless. and especially in the ultra-early [newgrf] game phases, like horse carriages or 19th century trains are never able to keep up the level of transportation needed to get 70% of an industry's (or town's) production delivered.

this totally prevents a "sparse" playstyle, where you build up a network of tiny branch lines, and successively increase capacity of lines to build up a sustainable economy, until you can get modern high efficiency networks that can really squeeze the full potential out of the economy. the system forces you to build highly conjested main lines as soon as you start to service an industry, which is impossible for low capacity vehicles.

conclusion: if you want to fiddle with station ratings, design a system that can keep a rating at 10% without building up a huge stockpile. so base the rating on frequency of service [interval between the last and its previous vehicle] and average capacity of the vehicles scheduled to load at this station [might get in trouble with non-nonstop orders, but the cargo destinations have that same problem]
Youri219
Traffic Manager
Traffic Manager
Posts: 191
Joined: 28 Apr 2007 11:53

Re: Patch: improved station ratings

Post by Youri219 »

You can make it depend on several things:

- The time needed to pick up cargo from a station (including any transfer stations if this is possible) up to (50%)
- Town rating (20%)
- Vehicle age is probably a good thing, a new vehicle does give more confidence, but should be a bit more forgiving than 2 year (10%, maybe (max age - current age)/max age * 10%)
- Statue (10%)

This makes it hard enough to get to 100%, without strange factors like vehicle speed.
Tekky
Route Supervisor
Route Supervisor
Posts: 420
Joined: 19 Dec 2006 04:24

Re: Patch: improved station ratings

Post by Tekky »

Youri219 wrote:You can make it depend on several things:
- The time needed to pick up cargo from a station (including any transfer stations if this is possible) up to (50%)
The main point of my patch was to not make it necessary to always have a train in the station with a "full load" order. I think it is pointless to have such a requirement, because always having a train in a station waiting for a full load does not necessarily cause the cargo to be delivered any sooner. You should get just as good a rating by servicing a station on a regular basis, even without a "full load" order.

Youri219 wrote:Town rating (20%)
I think that town rating should be influenced by station rating, i.e. a well-serviced station will make the authorities happy. But I don't think that the opposite should also be true, that town rating should influence station rating.

Youri219 wrote:Vehicle age is probably a good thing, a new vehicle does give more confidence, but should be a bit more forgiving than 2 year (10%, maybe (max age - current age)/max age * 10%)
That means that in order to get a good rating, you must micromanage your vehicles by destroying them prematurely and buying new ones? I'm not in favor of this.
User avatar
CommanderZ
Tycoon
Tycoon
Posts: 1872
Joined: 07 Apr 2008 18:29
Location: Czech Republic
Contact:

Re: Patch: improved station ratings

Post by CommanderZ »

The main point of my patch was to not make it necessary to always have a train in the station with a "full load" order. I think it is pointless to have such a requirement, because always having a train in a station waiting for a full load does not necessarily cause the cargo to be delivered any sooner. You should get just as good a rating by servicing a station on a regular basis, even without a "full load" order.
You could base it on the time when cargo leaves, not when it is loaded...or even better, it could depend on regularity of service.
User avatar
minime
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 18 Jan 2004 10:02
Skype: dan.masek
Location: Prague, Czech Republic
Contact:

Re: Patch: improved station ratings

Post by minime »

How does this patch take into account callback 145?
Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. --Albert Einstein
Image Image Image
Tekky
Route Supervisor
Route Supervisor
Posts: 420
Joined: 19 Dec 2006 04:24

Re: Patch: improved station ratings

Post by Tekky »

minime wrote:How does this patch take into account callback 145?
Does OpenTTD implement this callback at all? I don't recall having seen any code which implements this callback. Therefore, I believe that OpenTTD ignores this callback, both with and without my patch.
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

Re: Patch: improved station ratings

Post by Eddi »

minime wrote:How does this patch take into account callback 145?
as i mentioned in [url=irc://irc.oftc.net/openttd]#openttd[/url], i think a patch like this should expose more variables to this callback [like i suggested: time between two subsequent visits, capacity of vehicles visiting with a load order]. then the modifications could be provided via newgrf.
Tekky
Route Supervisor
Route Supervisor
Posts: 420
Joined: 19 Dec 2006 04:24

Re: Patch: improved station ratings

Post by Tekky »

I am not familiar with the structure of NewGRFs. Is it possible to change the number of exposed variables to a callback without changing the NewGRF specification?
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Patch: improved station ratings

Post by DaleStan »

Tekky wrote:
minime wrote:How does this patch take into account callback 145?
Does OpenTTD implement this callback at all?
Then "How would this patch interact with callback 145?" Anything that prevents CB145 from being implemented is exceedingly unlikely to be even considered for inclusion in trunk.
Tekky wrote:Is it possible to change the number of exposed variables to a callback without changing the NewGRF specification?
No. Exposing variables to NewGRFs requires documenting how they are exposed, which constitutes changing the specification. Also, concealing variables that are currently exposed is absolutely forbidden. You may only add new variables.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Tekky
Route Supervisor
Route Supervisor
Posts: 420
Joined: 19 Dec 2006 04:24

Re: Patch: improved station ratings

Post by Tekky »

DaleStan wrote:Anything that prevents CB145 from being implemented is exceedingly unlikely to be even considered for inclusion in trunk
Had it been my intention to include this patch into trunk, I would have certainly not deliberately designed it to be multiplayer-incompatible. This patch is just a little experiment, so I found it more meaningful to preserve savegame compatibility with trunk instead of being multiplayer compatible.

Eddi wrote:my problem with the rating system is that it does not properly adjust to low transportation amounts. like if you have a network that can transport 10% of an industry's theoretical limit, the industry starts out with 70% production, the cargo piles up to like 2000 items before the rating significantly drops. after that the production drops to like 30%, where 2/3 of the produced cargo is thrown away before the vehicle arrives again.
Version 1.0 of my patch had a vicious circle bug in which a production decrease reduced the permitted size of a stockpile, which caused the now overflowing stockpile to reduce station rating, which reduced production even further, causing the vicious circle to start over again, eventually causing the station rating to drop to 0%. Now the permitted size of a stockpile with which you can still get a station rating of 100% will be reduced per month by a maximum of 10 units (which is very slow!), so this vicious circle is now broken.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Bing [Bot] and 34 guests