Displayed defense values |
Tue, 27 July 2004 23:58 |
|
LEit | | Lt. Commander | Messages: 879
Registered: April 2003 Location: CT | |
|
Orca and I have figured out how Stars! does defense values.
There are two displays of defense value, one for the owner, and one for other people scanning the world.
At energy tech 1, defenses have a value of 1%
en 5, 2%
en 10, 2.4%
en 16, 3%
en 23, 3.8%
Take that value (v) the number of defenses (n) and use this to get the 'true' value:
true = 1-(1-v)^n
if n is 1, then subtract .01
if n is 2 and en tech is 16, then subtract .01
To get the displayed value for the owner, if the digit right after the decimal is a 0, drop it. IOW 31.05 true displays as 31.5.
To get the displayed value for other players:
min(93, int((true-1.5)/6)*6+9)
To go from displayed value (dv) to a range of actual values:
if dv is 9, then the true range is 1 to 7.5
if dv is 93, then the true range is 85.5 to 97.92
otherwise the true range is dv-7.5 to dv-1.5
Note: we have not tested if these are correct for bombing, packets, and/or invasions. I would guess that the true value is what is used.
- LEitReport message to a moderator
|
|
|
|
|
|
|
Re: Displayed defense values |
Sat, 11 March 2006 04:43 |
|
m.a@stars | | Commander | Messages: 2765
Registered: October 2004 Location: Third star to the left | |
|
PricklyPea wrote on Fri, 10 March 2006 14:16 |
m.a@stars wrote on Fri, 10 March 2006 07:12 |
LEit wrote on Wed, 28 July 2004 16:52 | For those interested, it seems that the defense value is stored as two ints, one before and one after the decimal place.
Then the display is formatted with printf("%d.%d%%", it should probably be formatted with printf("%d.%02d%%", which would pad the second int with the missing '0'
|
Is perhaps that formatting string (or its Jeff-style equivalent) stored somewhere where it could be fixed?
|
It will be, although the additional characters required may make it difficult. If you look at the crabby mod, I modify the string used in the window title to include the mod id number (C2).
|
Cool, that.
Even if it's nontrivial, it might be worth fixing that distance display problem. It crops up everywhere and tends to get annoying. Does someone know if the Jeffs actually used printf-style formatting?
[Updated on: Sun, 12 March 2006 04:47]
So many Stars, so few Missiles!
In space no one can hear you scheme! Report message to a moderator
|
|
|