View Single Post
Old 03-27-13, 08:22 AM   #1575
Vanilla
Lieutenant
 
Join Date: Nov 2006
Location: St. Petersburg, Russia
Posts: 264
Downloads: 72
Uploads: 0
SHO

Ok, here is the analysis:

Let's first derive the formula implied in the code:

speed = 30.99133 x cube_root[ (7432.328 / 559500) x (XMM2 + ordered_speed x XMM1) x (ordered_speed x XMM1)^2 ]

or:

speed = 30.99133 x 0.23683266 x cube_root[ (XMM2 + ordered_speed x XMM1) x (ordered_speed x XMM1)^2 ]

We can try to simplify it further but if we just insert this formula into excel/calc we will get to the following values (we drop the negative values since we cannot see what what is done with those from the code excerpt given):
Code:
0             0,00000
0,1          4,38442
0,2          7,55932
0,3          10,58301
0,4          13,54768
0,5          16,48260
0,6          19,40030
0,7          22,30711
0,8          25,20658
0,9          28,10086
1             30,99133
Now we can see that the speed goes way higher than expected max 12 knots. There should be some mechanism that limits either the speed or the orders. My guess that the game actually limits the order by 0,4 this gives 13,6 knots -- close to the max speed.
The other thing to see is that the combination of constants 3.913995 (xmm1) and 7432.328/559500 works so that the max speed at order 1.0 will be equal to the constant given later in the code (30.99133) if we change this number to, say, 20, the speed at 1.0 setting will be also 20 with speeds at other settings changing accordingly (@TDW this can be the answer to your question), at 0.4 setting the speed will be 8.7 knots.
What is puzzling is XMM2 which changes almost nothing. If we set it to 0 the max speed (30.99) will change only by 2 knots to 28 and the speed at 0.4 will be 11.49. Why this xmm2 variable is needed at all?

To put some logic into the formula here is my thinking:
  • 1/3 power (cube root) is used to make the curve that match reduced efficiency at greater power.
  • The 3.913995 number is the conversion coefficient for either PS or RPMs to knots. That is, for example 'we get 3.913995 knots per each 100 RPMs increase if we assume 100% efficiency.
  • The 30.99133 is theoretically possible max speed the sub can achieve. (Though it is puzzling why it is so huge? Surface speed with all the upgrades? Still too much).
  • xmm2 is a puzzle
  • The 7432.328 and 559500 are there just to balance the equation.
Vanilla is offline   Reply With Quote