YAIM - (Yet Another) Infrastructure Maintenance Patch (V3.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

Michi_cc
OpenTTD Developer
OpenTTD Developer
Posts: 619
Joined: 14 Jun 2004 23:27
Location: Berlin, Germany
Contact:

Re: YAIM - (Yet Another) Infrastructure Maintenance Patch (V

Post by Michi_cc »

Andrew350 wrote:...untraceable money cheat? :P
No, a bug that was just fixed in r23593. Thanks for the report.

-- Michael Lutz
dandan
Route Supervisor
Route Supervisor
Posts: 414
Joined: 17 Feb 2008 23:01

Re: YAIM - (Yet Another) Infrastructure Maintenance Patch (V

Post by dandan »

I'm just trying to implement support for maintenance costs in the Japan Set. Maybe I'm a bit late for feedback on this feature as it has already been included in trunk, and this has already been pointed out by Kogut, but still: I find it very strange how that nonlinear scaling is applied to each different rail type separately. This means that players can save a lot of money by simply distributing their rails cleverly over many different rail types. This does not make a lot of sense to me.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: YAIM - (Yet Another) Infrastructure Maintenance Patch (V

Post by planetmaker »

dandan wrote:This means that players can save a lot of money by simply distributing their rails cleverly over many different rail types.
It does that, yes. But it is imho a good incentive to make use of different track types and to consider whether also the oldest and only infrequently used branch line really needs an upgrade to ICE or TGV level tracks while there's only a single 80km/h coal train travelling.
dandan
Route Supervisor
Route Supervisor
Posts: 414
Joined: 17 Feb 2008 23:01

Re: YAIM - (Yet Another) Infrastructure Maintenance Patch (V

Post by dandan »

planetmaker wrote: It does that, yes. But it is imho a good incentive to make use of different track types and to consider whether also the oldest and only infrequently used branch line really needs an upgrade to ICE or TGV level tracks while there's only a single 80km/h coal train travelling.
I don't agree with that argument. Maintenance costs should offer such an incentive, yes. But IMO that incentive should be exactly the fact that ICE tracks should be much more expensive to maintain (and to build).

As it is now, it all depends on the rest of your network in a very intransparent way. Upgrading that little coal line of yours to ICE tracks might in fact *save* you money if you have a lot of that track type and not so many ICE lines yet.

Also, a few track types (at least in the Japan Set) are intended purely for eye-candy with no difference for gameplay. With maintenance costs on, this is now, strictly speaking, impossible.
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: YAIM - (Yet Another) Infrastructure Maintenance Patch (V

Post by Eddi »

imho the scaling should be over all railtypes combined. the incentive to not upgrade to high speed track should be purely by making it more expensive.
Simn
Engineer
Engineer
Posts: 15
Joined: 05 Jan 2012 19:43

Re: YAIM - (Yet Another) Infrastructure Maintenance Patch (V

Post by Simn »

I have a suggestion to make. First, allow me to state that I am aware of realism being an acceptable sacrifice in order to improve gameplay. However, in economy simulation games you're on really thin ice. I cannot see the rationale behind the cost increase this patch introduced. I fear it might even alienate new players.

Let's look at what maintenance costs actually are:
Maintenance cost = material cost + personnel cost

Material cost is what TTD implements with a linear increase of cost in relation to the amount needed. You could even argue that it's less than linear, because in economy the purchase of a high amount results in a lower per-unit price.

Personnel cost is what you probably meant to implement, but never declared it as such. Consider this: Infrastructure has an amount of required personnel, which are grouped by their type (railroad maintenance, road maintenance, station workers etc.). The longer your railroad network, the more personnel you need. Now imagine these personnel groups as labor unions and you might already see where I'm going with this.

The bigger a labor union and the higher your profit, the more likely they are to demand a raise, say, every year. I wouldn't go as far as implementing a negotiation/strike system like in Theme Park, it's sufficient to be notified that "Labor union 'Railroad Maintenance' demanded 10% raise". This will cause you to avoid a single big labor union and prefer several smaller ones, as they are less powerful and will demand less/lower raises. With proper balancing, the cost curve will look linear with increasing steps in between, which is just what you need to balance this game.

I post this here instead of the suggestions forum because I think your implementation is already pretty close to this suggestion. It just lacks some terminology changes and a different handling of the cost factor. What do you think?
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: YAIM - (Yet Another) Infrastructure Maintenance Patch (V

Post by Eddi »

Simn wrote:I cannot see the rationale behind the cost increase this patch introduced.
the intention of this patch as a whole is to simulate the combined material and personal effort for maintenance of infrastructure. the intention of the non-linear scaling in particular is to simulate the management overhead. the bigger your company, the higher the amount of money you have to spend on management personal and technology (e.g. signalling, scheduling, ...) in relation to the money you have to spend on doing actual work (driving, repairing, ...)

e.g: say for simplicity you have 1 person in charge for 1 tile of rail, and for any 2 persons you need one manager to coordinate the work of these people.
  • for 1 tile you only need 1 worker (=1)
  • for 2 tiles you need 2 workers, and 1 manager (=3)
  • for 4 tiles you need 4 workers, 2 managers, and 1 manager-manager (=7)
  • for 8 tiles you need 8 workers, 4 managers, 2 manager-managers and one manager-manager-manager (=15)
  • ...
you see that you now need 2n-1 people for working n tiles. this is only a linear factor in number of personel, but each level of managers has a higher wage than the level below them, which makes the personel cost non-linear.

the effect of "labour unions" etc. is roughly covered with inflation, which is an entirely different topic.
Simn
Engineer
Engineer
Posts: 15
Joined: 05 Jan 2012 19:43

Re: YAIM - (Yet Another) Infrastructure Maintenance Patch (V

Post by Simn »

Eddi wrote:
Simn wrote:I cannot see the rationale behind the cost increase this patch introduced.
the intention of this patch as a whole is to simulate the combined material and personal effort for maintenance of infrastructure. the intention of the non-linear scaling in particular is to simulate the management overhead. the bigger your company, the higher the amount of money you have to spend on management personal and technology (e.g. signalling, scheduling, ...) in relation to the money you have to spend on doing actual work (driving, repairing, ...)

e.g: say for simplicity you have 1 person in charge for 1 tile of rail, and for any 2 persons you need one manager to coordinate the work of these people.
  • for 1 tile you only need 1 worker (=1)
  • for 2 tiles you need 2 workers, and 1 manager (=3)
  • for 4 tiles you need 4 workers, 2 managers, and 1 manager-manager (=7)
  • for 8 tiles you need 8 workers, 4 managers, 2 manager-managers and one manager-manager-manager (=15)
  • ...
you see that you now need 2n-1 people for working n tiles. this is only a linear factor in number of personel, but each level of managers has a higher wage than the level below them, which makes the personel cost non-linear.
Although I can see your point, this interpretation leads to hundreds of management layers in a reasonable sized company and as such hardly serves as a realistic rationale. Again, I'm not suggesting realism above all else, but this might be one of the cases where a more realistic approach might be appropriate.
the effect of "labour unions" etc. is roughly covered with inflation, which is an entirely different topic.
There are many differences. For starters, inflation does not react to your profit and/or network sizes. In a way it actually promotes early infrastructure spamming because it is applied to construction costs as well, so better build that long railway now while your money is still worth something. This is pretty much the opposite of what you're trying to achieve, although it is obviously diminished by maintenance costs.

My idea of labor unions directly reacts to a company's profit and network sizes, which, unless I completely missed the point to begin with, is exactly what this is all about. It promotes usage of the different transportation methods in a transparent way, i.e. a monolithic train company will have serious maintenance costs due to their mighty train labor union, and thus be less profitable than a balanced one.

Note that I am not suggesting the implementation of actual personnel numerical values, they much rather derive directly from the size of the infrastructure, which is already grouped into what I would interpret as labor union.
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: YAIM - (Yet Another) Infrastructure Maintenance Patch (V

Post by Eddi »

Simn wrote:
Eddi wrote: e.g: say for simplicity you have 1 person in charge for 1 tile of rail, and for any 2 persons you need one manager to coordinate the work of these people.
Although I can see your point, this interpretation leads to hundreds of management layers in a reasonable sized company and as such hardly serves as a realistic rationale.
well, the 2:1 ratio was just serving as an easy example here, but for any k:1 ratio you choose, the number of layers in the hierarchy will be log(n)/log(k), which is asymptotically the same.

and of course it's a heavily simplified view of a company.
Michi_cc
OpenTTD Developer
OpenTTD Developer
Posts: 619
Joined: 14 Jun 2004 23:27
Location: Berlin, Germany
Contact:

Re: YAIM - (Yet Another) Infrastructure Maintenance Patch (V

Post by Michi_cc »

Eddi wrote:imho the scaling should be over all railtypes combined. the incentive to not upgrade to high speed track should be purely by making it more expensive.
Changed/implemented in r23931.

-- Michael Lutz
dandan
Route Supervisor
Route Supervisor
Posts: 414
Joined: 17 Feb 2008 23:01

Re: YAIM - (Yet Another) Infrastructure Maintenance Patch (V

Post by dandan »

Thanks Michi! This is much appreciated.
User avatar
vtk
Engineer
Engineer
Posts: 46
Joined: 10 Apr 2012 21:27
Location: Columbus
Contact:

Re: YAIM - (Yet Another) Infrastructure Maintenance Patch (V

Post by vtk »

First of all I have to confess I have no idea which version of this patch I've been playing with, but it's one that's included in ChillCore's patch pack as of a few months ago. I also know he says to report bugs to him and not original patch devs, but this is more of a complaint/suggestion post than a bug report.

My experience overall with Infrastructure Maintenance has been that it's either too much, or nothing at all (off). There should be an in-game way to tweak the amount of infrastructure costs, like Off, Low, Medium, High, Insane. Insane would be the level I've already experienced.

I like to play with very large maps, with few industries and small towns with great distances between them. I come from the American Midwest and I don't like trying to cram my infrastructure between industries and towns that grow like weeds. I think one of the bigger problems I've had is this "non-linear" behavior becoming too big a factor too early in my games. When I start to get a decent-sized rail network going, I find that my profit margins are tiny. I'll add a line that should be quite profitable on its own, and my company profits actually go down. It's not scaled well for my gameplay style, and it's not fun.

Oh, and once I tried starting an airline in a 1930s desert/tropical climate. I had two small airports, and the maintenance cost was outrageous. It was equivalent to the initial construction cost, every two months. That can't be realistic.
Image
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: YAIM - (Yet Another) Infrastructure Maintenance Patch (V

Post by Eddi »

you can control this by the running costs difficulty setting, and if that doesn't suffice, you can use a base cost newgrf as well...
User avatar
vtk
Engineer
Engineer
Posts: 46
Joined: 10 Apr 2012 21:27
Location: Columbus
Contact:

Re: YAIM - (Yet Another) Infrastructure Maintenance Patch (V

Post by vtk »

It's tied to "running costs"? That's good to know.

I still think the curve is too steep for big networks. After analyzing the previously-outlined management model, I conclude that it should still be asymptotically linear. Let's assume for a moment that each manager has 5 employees (either other managers, or actual track maintainers) directly subservient to him. Let's also assume that each manager is paid 25% more than employees in the level below. That means each management level is paid 5/4 as much as the level below per head, but is only 1/5 as numerous; therefore the total cost of each level of management is 1/4 that of the level below it. Even in an arbitrarily large organization with countless levels of management, the total cost of all management levels is a converging sum which will not exceed 1/3 the total cost of those employees directly responsible for the hands-on work of infrastructure maintenance.

So a more realistic network size -> maintenance cost curve will be non-linear, but it will only gently curve upwards at first, and its slope will never exceed some fixed value which is only a little bit greater than the initial slope.

-----

Also, I think the way track pieces are counted, as described above, unfairly overcounts diagonal track -- especially two or more adjacent parallel diagonal tracks. Here's a simple way to treat diagonal track more fairly, while still incurring more cost for most switches and diamonds: for each tile, add one for each ortho piece, plus one-half for each diagonal piece; round up to an integer, and square that number.
Image
Michi_cc
OpenTTD Developer
OpenTTD Developer
Posts: 619
Joined: 14 Jun 2004 23:27
Location: Berlin, Germany
Contact:

Re: YAIM - (Yet Another) Infrastructure Maintenance Patch (V

Post by Michi_cc »

vtk wrote:Also, I think the way track pieces are counted, as described above, unfairly overcounts diagonal track -- especially two or more adjacent parallel diagonal tracks.
It doesn't. Number of tracks is only squared on junction tiles, not on parallel tracks (Internally in OTTD these are straight tracks BTW, not diagonal. Nomenclature is generally based on the screen surface, not the imaginary tilted world surface.)
vtk wrote:I still think the curve is too steep for big networks.
Don't get hung up on management overhead or any other explanation. Realising arbitrary curve forms isn't possible as we're limited to integer maths for cross-platform network compatibility. You can do x^1, x^1.5, x^2, but anything in between is very hard.

You also have to consider that the default costs can only be primarily balanced for the default vehicles. Some NewGRFs have vehicle running costs several orders of magnitude greater, which will of course not work too well with the default costs. These NewGRFs should consider modifying the maintenance base costs. Airport maintenance is high on purpose as I wanted to make the tactic of building an air route from map corner to corner and never worry again about money impossible.

That doesn't mean all costs are already perfect. I'm willing to change costs, for example if you can show me a game pointing out why you think costs are too high/low/just right.

-- Michael Lutz
User avatar
vtk
Engineer
Engineer
Posts: 46
Joined: 10 Apr 2012 21:27
Location: Columbus
Contact:

Re: YAIM - (Yet Another) Infrastructure Maintenance Patch (V

Post by vtk »

Michi_cc wrote:
vtk wrote:I still think the curve is too steep for big networks.
Don't get hung up on management overhead or any other explanation. Realising arbitrary curve forms isn't possible as we're limited to integer maths for cross-platform network compatibility. You can do x^1, x^1.5, x^2, but anything in between is very hard.
Like I said, it should be asymptotically linear. That means a power curve like x^1.5 is already too much. But I have thought of a relatively simple formula that has the gentle curve and limited slope like I described, and shouldn't be computationally expensive:

C = M * (N + F * (B * B / (N + B) - B))
C is the monthly maintenance cost of the network
N is the number of pieces in the network whose cost is to be calculated
M is a scaling factor which is a constant, probably varying with difficulty settings as appropriate
B is a constant representing the number of pieces in a "big" network, possibly varying with difficulty settings and/or map size
F is an easy-entry factor, a constant which should probably be between .1 and .5, and may vary with difficulty settings as appropriate.

This curve starts out looking like C = M * N * (1 - F), but bends up slightly to asymptotically approach C = M * (N - F * B), which is 1 / (1 - F) as steep as how it starts.

With a little bit of modification, I think this formula can be made to behave nicely in pure integer operations.
Image
damerell
Traffic Manager
Traffic Manager
Posts: 190
Joined: 22 Feb 2008 23:09

Re: YAIM - (Yet Another) Infrastructure Maintenance Patch (V

Post by damerell »

vtk wrote:Even in an arbitrarily large organization with countless levels of management, the total cost of all management levels is a converging sum which will not exceed 1/3 the total cost of those employees directly responsible for the hands-on work of infrastructure maintenance.
I infer you have never worked in a large corporate.
Robbedem
Engineer
Engineer
Posts: 111
Joined: 14 Jan 2013 18:08

Re: YAIM - (Yet Another) Infrastructure Maintenance Patch (V

Post by Robbedem »

vtk wrote:Like I said, it should be asymptotically linear. That means a power curve like x^1.5 is already too much. But I have thought of a relatively simple formula that has the gentle curve and limited slope like I described, and shouldn't be computationally expensive:

C = M * (N + F * (B * B / (N + B) - B))
C is the monthly maintenance cost of the network
N is the number of pieces in the network whose cost is to be calculated
M is a scaling factor which is a constant, probably varying with difficulty settings as appropriate
B is a constant representing the number of pieces in a "big" network, possibly varying with difficulty settings and/or map size
F is an easy-entry factor, a constant which should probably be between .1 and .5, and may vary with difficulty settings as appropriate.

This curve starts out looking like C = M * N * (1 - F), but bends up slightly to asymptotically approach C = M * (N - F * B), which is 1 / (1 - F) as steep as how it starts.

With a little bit of modification, I think this formula can be made to behave nicely in pure integer operations.
Why not use a much simpler version like this?

C = M*N*Cmax/ (B + N)

C = monthly base maintenance cost per piece (no inflation, that must be added later)
Cmax = the maximum base maintenance cost possible per piece (should be rather large, but still playable)
N = the number of pieces in the network
M = scaling factor for difficulty setting
B = constant depending on Cmax, map size, player preference for high or low cost increase,...
(B should propably be between 1 and 1000, but thats my opinion)
User avatar
vtk
Engineer
Engineer
Posts: 46
Joined: 10 Apr 2012 21:27
Location: Columbus
Contact:

Re: YAIM - (Yet Another) Infrastructure Maintenance Patch (V

Post by vtk »

damerell wrote:
vtk wrote:Even in an arbitrarily large organization with countless levels of management, the total cost of all management levels is a converging sum which will not exceed 1/3 the total cost of those employees directly responsible for the hands-on work of infrastructure maintenance.
I infer you have never worked in a large corporate.
I do, but my boss is only paid slightly bette than I. And I have no idea how much the regional and division managers are paid.

But my statement you quoted is mathematically derived from certain assumptions which I made in the same post, which I believe to be reasonable. Those assumptions can be tweaked a bit, and as long as each boss's salary is less than the total salaries of his direct subordinates, it's still a converging sum with asymptotically linear costs. When that boss-pay threshold is reached, the asymptotic behavior becomes N*log(N). I'm not sure what it does when bosses' pay becomes higher than the total of direct subordinates, but were I an accountant for such a company, I'd raise some red flags.
Image
charityalbumman
Engineer
Engineer
Posts: 63
Joined: 06 Apr 2012 10:06
Location: UK
Contact:

Re: YAIM - (Yet Another) Infrastructure Maintenance Patch (V

Post by charityalbumman »

Where and what are the "infrastructure costs" displayed on the main Finances window?

Or is infrastructure costs separate? I'm confused as I'm trying to work out if my Trams (only road vehicle I have in 1928) are making profit or not.

If separate can I have some details in how the calculations are achieved as my head is not in a good state (concentration due to depression) please :)
Annual Financial Report for 1928:

Train Income = +£283,962
Road income = +£54,273
-----------------------------------
Total income = £338,235
-----------------------------------
Train Running Costs = -£127,733 (only just built new ones)
Road Running Costs = -£31,986

Property Maintenance Costs = -£77,320
Loan Interest = -£5,289
-----------------------------------------------------
Total: -£242,328

Construction = -£1,458
New Vehicles = -£215,676
Other = -£348
------------------------------------------------------
Total: -£217,482
------------------------------------------------------
Total: -£121,575
My Infrastructure costs per year are:

Railway = -£19,284 (1,354)
Signals = -£2,340 (52)

Tramway = -£31,104 (1,418)

Station Tiles = -£26,028 (208)

TOTAL = -£78,756
Thanks for any help, Pete 8)
"Tea, coffee, meal and takeoff are all optional. Landing is mandatory!"
Click here to visit my Blog, Flight Sim and Train Sim web sites!
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 11 guests