Home » Stars! 2.6/7 » The Academy » perfected Fuel Usage Formula
perfected Fuel Usage Formula 
Thu, 20 January 2005 12:48 

m.a@stars   Commander  Messages: 2765
Registered: October 2004 Location: Third star to the left  

Hi all,
I wonder if this is the place to post some info about what I've been up this Xmas.
In the course of accreting some useful ingame tool for ship moving, I stumbled upon the notorious inaccuracy of the published fuel usage math. So I spent some idle afternoons doing a full set of tests to get at the root causes.
I nailed the fuel formula down to almost the last wrinkle. I got it working inside my "trip tool" for a few weeks now. The tool itself is still far from completion, but I think if someone wants to check/test/demolish my fuel math, there's no reason to wait.
Here it goes:
The math itself is amazingly simple and accurate, and also explains the discrepancies in Stars! own fuel usage guesstimator. It has worked flawlessly for a thousand tests under AutoHost's Stars! 2.6jRC4.
I even put it in a JavaScript/html wrapper for all to use/improve, but I don't trust Usenet to carry it faithfully.
In short, it works like this:
1. Round the distance up, except if the new distance is farther than speed*speed, in which case it is rounded down.
2. Apply IFE to engine efficiency, and round the result up, too.
3. UsedFuel1 = mass * distance * efficiency / 2000, rounded down.
4. UsedFuel = UsedFuel1 / 10, rounded up.
Number 1 was the easier, and its exception is a source of major discrepancies in all previously published fuel usage formulas, including Stars! own fuel display.
Number 2 was the trickier, even if obvious in hindsight, source of inaccuracy.
Number 3 and 4 are just the theoretical calculation, done in two steps to follow a minor discrepancy in final results, which seem to only take the 1st decimal place into account.
I believe the actual fuel math used in Stars! to be the adaptation of the theoretical fuel formula to integer math, to render a frequently used function as fast as possible.
Stars! own fuel guesstimator seems to use the same formula, by feeding to it an "idealized" distance that is not consistent with actual fuel usage in a wide variety of cases, as follows:
1. Find the number of "whole" hops the trip will need, assuming each one travels exactly Warp*Warp ly (zero if Distance is less than Warp*Warp).
2. Find FuelEstimate1 using numHops*Warp*Warp as the distance.
3. Find FuelEstimate2 using DistancenumHops*Warp*Warp as the distance.
4. Add both FuelEstimates to get the almostright fuel guesstimation.
I've also found a few more minor/harmless bugs while testing this, all seemingly due to integer math shortcomings.
I hope people find this useful.
Comments, suggestions, welcome.
[Updated on: Thu, 20 January 2005 12:52]
So many Stars, so few Missiles!
In space no one can hear you scheme! Report message to a moderator



Goto Forum:
Current Time: Fri Apr 19 12:07:51 EDT 2024
