Alright I've had some time to work on this, and what I ended up doing is spending the time looking at GetTransportedGoodsIncome in economy.cpp, specifically this code:
Code: Select all
int time_factor;
if (days_over_days1 <= 0) {
time_factor = MAX_TIME_FACTOR;
} else if (days_over_days1 <= days2) {
time_factor = MAX_TIME_FACTOR - days_over_days1;
} else {
time_factor = MAX_TIME_FACTOR - 2 * days_over_days1 + days2;
}
if (time_factor < MIN_TIME_FACTOR) time_factor = MIN_TIME_FACTOR;
To help me better understand what was happening here, I created a spreadsheet the models this code. (You'll find the spreadsheet attached to this message.) Basically I first tried to figure out what the time factor would be at different times.
The time factor that this code produces is a horizontal line at 255, for the first few days, then slopes downward in a straight line until it reaches 31, and then becomes a horizontal line again. I tried looking at this line for various cargo types, and its pretty much the same basic shape. So that by itself wasn't very interesting. It wasn't until I included a calculation for estimated distance traveled, and made a graph of that that I found something interesting.
Now these graphs just show the income curve. The actual numbers aren't correct because they don't consider cargo payment rates or inflation, but those aren't important because they are the same over time. Time factor and distance change over time so they are the only values used in creating these graphs. I've also used the value 5.6 tiles per day at 100kph. This allows us to calculate the time factor for a number of days, and the distance for a number of days, Those values are then multiplied to get a profit value. I ran the same calculations for Coal and Passengers to compare because their Day1 and Day2 values are very different.
The top graph shows the current behavior of OTTD. The next graph shows what happens when you set the minimum time factor to 0 as Elvish Magi suggested. The result was that if a cargo took too long to get there, its profit could become zero. However it seemed that as long as the cargo was delivered before Max time factor was reached, a hefty profit could be obtained, especially if the ideal travel time of half the max time factor was reached. So just to experiment a third graph was made with a max time factor of 128. The reason why there are two lines to show the effect that vehicle speed has. The blue line represents 64 Kph, and the pink line 128 kph.

So setting the minimum to zero close the infinite time exploit, and causes the ideal round trip time to be 255 days (wow, the same as the Max time factor) This means that the ideal distance is dependent on the speed of available vehicles. What this means is that there is no point in running a longer route until you have faster vehicles. However, even at 128 KPH (Ginzu) you could run a route ~900 tiles (opposite corners on a 512x512 ) away and make fantastic profits with the current max time factor of 255. The realization is that the profits happen way before the minimum time factor is ever reached. This means that If I want to control huge profits, then the maximum time factor must be reduced as well.
Lets just look at some various route lengths based on a 128 kph ginzu. Assuming 100Kph, = 5.6 tiles per day, then 128 kph = 7.15 tiles per day. If the ideal trip time is half the max time, then the ideal one way is half the max. So if the max time is 255, half that is 127. In 127 days, 910 tiles can be covered.
Max Time 255, Ideal Route 910 tiles. Max Time 127, Ideal route 450 tiles. Max Time 64, Ideal Route 221 Tiles. Max Time 31 days, Ideal route 107 tiles.
So, First the minimum time factor must be changed to zero. Second the maximum time factor must be reduced, however what the ideal value is I am not sure. So I will probably in the next day or so make a patch that exposes these two constants so that they can be tweaked until I can find a value that works well.
I'll post again when I know more.