Ok, I think I'm onto something. Mind you, I've thought that before and been wrong, but let's not worry about that.
So I was trying to fit various basic functions to what is available in the way of data points, which aint much. We only have data points for 0%, 2%, 4% and 6% grades, but nothing for 1%, 3%, 5%, 7%, or anything higher than that. This means any attempt to extract a mathematical basis for performance on grades is going to have to be a bit of a guesstimate, but I've found something that fits nicely and is very simple. This means it's likely to be how they actually did it. It should be close enough that even if the actual algorithm is a bit different, it won't matter for the grades any sane person will be dealing with.
So keeping things simple while I nail down the basics, this is still for pulling power of 1, free weight of 0, locomotive weight of 0, and one cargo car of 34 tons. The speeds are:
0% grade: 48 mph
2% grade: 29 mph
4% grade: 16 mph
6% grade: 7 mph
If we forget about fitting a continuous function between those four points and adopt a different approach, it starts to make sense. We know from real life rail that there's a sudden jump in required power for a given speed when you go from 0% to 1% grade. The required power to maintain the same speed goes from 100% to 350% (
see lotsa numbers here). So it makes sense that the RT3 dudes would have had a sudden (discontinuous) drop in speed from 0% to 1% grade. If they were being totally realistic they would have had the speed on 1% grade drop to only 28% of the speed on the flat, but they didn't. That was probably far too severe for a playable and enjoyable game.
What they appear to have done is drop the speed to 71.43%, which may seem a daft number to pick but is simple when you look at it another way (it's 1/1.4). Going from that point, if you then use a divisor of 1.2 for the step up to 2% grade you'll get a speed of 48/(1.4 x 1.2) = 28.6 mph. If you take 1.3 for the next divisor, and 1.4 after that, and 1.5 after that, etc, it all fits.
1% grade: 48/1.4 = 34.3 mph
2% grade: 48/(1.4 x 1.2) = 28.6 mph, which rounds off to 29
3% grade: 48/(1.4 x 1.2 x 1.3) = 22.0 mph
4% grade: 48/(1.4 x 1.2 x 1.3 x 1.4) = 15.7 mph, which rounds off to 16
5% grade: 48/(1.4 x 1.2 x 1.3 x 1.4 x 1.5) = 10.5 mph
6% grade: 48/(1.4 x 1.2 x 1.3 x 1.4 x 1.5 x 1.6) = 6.5 mph, which rounds off to 7
So presumably for higher grades you get:
7% grade: 48/(1.4 x 1.2 x 1.3 x 1.4 x 1.5 x 1.6 x 1.7) = 3.8 mph
8% grade: 48/(1.4 x 1.2 x 1.3 x 1.4 x 1.5 x 1.6 x 1.7 x 1.8) = 2.1 mph
9% grade: 48/(1.4 x 1.2 x 1.3 x 1.4 x 1.5 x 1.6 x 1.7 x 1.8 x 1.9) = 1.1 mph
10% grade: 48/(1.4 x 1.2 x 1.3 x 1.4 x 1.5 x 1.6 x 1.7 x 1.8 x 1.9 x 2.0) = 0.6 mph
To bung it into a formula: Starting point on 1% grade is (flat terrain speed/1.4). For each additional percent of grade from there you simply divide your previous grade's speed by (1+(grade%/10)).
Ok, so that appears to be how it goes for one car and zero loco weight. Next thing is to start adding loco weight and see what happens. To keep things simple I added loco weight in multiples of car weight, so went 0, 34, 68, 102. That means total train weight goes 100%, 200%, 300%, 400%.
So total train weight of 100% gives:
0% grade: 48 mph
2% grade: 29 mph
4% grade: 16 mph
6% grade: 7 mph
Total train weight of 200% gives:
0% grade: 48 mph
2% grade: 18 mph
4% grade: 5 mph
6% grade: 1 mph
Total train weight of 300% gives:
0% grade: 48 mph
2% grade: 11 mph
4% grade: 2 mph
6% grade: 1 mph
Total train weight of 400% gives:
0% grade: 48 mph
2% grade: 7 mph
4% grade: 1 mph
6% grade: 1 mph
For the 2% grade the proportional speeds as weight increases are a consistent 5/8 for each 100% increase in train weight, while for the 4% grade they're a consistent 5/16, and for the 6% grade they're 5/32. There are no data points for 1% grade so an assumption has to be made there. If you assume that the divisor with increasing grade fits a basic power curve y = 1.4 + k(x-1)^2, and put the origin at x=1, y = 1.4 and set k to 1/5, then all of a sudden the weird fractions fit.
At 1% grade the speed change would be 1/1.4 for every 100% increase in total train weight. This just happens to fit with the 1/1.4 fraction they appear to have used for speed on 1% grade compared to speed on flat terrain, so it looks like this was one of their favourite fractions.
At 2% grade the speed change would be 1/(1.4 +0.2(2-1)^2) for every 100% increase in total train weight. This shortens down to 1/1.6 for a 2% grade, which fits the available data nicely (same as the 5/8 found earlier).
At 3% grade the speed change would be 1/(1.4 +0.2(3-1)^2) for every 100% increase in total train weight. This shortens down to 1/2.4 for a 3% grade.
At 4% grade the speed change would be 1/(1.4 +0.2(4-1)^2) for every 100% increase in total train weight. This shortens down to 1/3.2 for a 4% grade, which fits the available data nicely (same as the 5/16 found earlier).
At 5% grade the speed change would be 1/(1.4 +0.2(5-1)^2) for every 100% increase in total train weight. This shortens down to 1/4.6 for a 5% grade.
At 6% grade the speed change would be 1/(1.4 +0.2(6-1)^2) for every 100% increase in total train weight. This shortens down to 1/6.4 for a 6% grade, which fits the available data nicely (same as the 5/32 found earlier).
This is all looking close enough for me.
![cheers (0!!0)](./images/smilies/cheers.gif)