Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! 2.6/7 » The Academy » Displayed defense values
Displayed defense values Tue, 27 July 2004 23:58 Go to next message
LEit is currently offline 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.



- LEit

Report message to a moderator

Re: Displayed defense values Wed, 28 July 2004 10:52 Go to previous messageGo to next message
LEit is currently offline LEit

 
Lt. Commander

Messages: 879
Registered: April 2003
Location: CT
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'



- LEit

Report message to a moderator

Re: Displayed defense values Thu, 29 July 2004 07:02 Go to previous messageGo to next message
Kotk

 
Commander

Messages: 1227
Registered: May 2003
Oh, that formatting error is btw quite common with Stars!. Nod

It seems that the developers kept most of the data in integers (for improving data size and calculation quickness) and made special calculations when displaying is needed. Unfortunatelly they misformatted the result.

See for example how traveling distances are displayed:
Displayed 64.20 ly means 64.2 ly.
Displayed 64.2 ly means 64.02 ly.

Report message to a moderator

Re: Displayed defense values Fri, 10 March 2006 07:12 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
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 Evil or Very Mad (or its Jeff-style equivalent) stored somewhere where it could be fixed? Sherlock



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: Displayed defense values Fri, 10 March 2006 08:16 Go to previous messageGo to next message
PricklyPea is currently offline PricklyPea

 
Lieutenant

Messages: 534
Registered: February 2005
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 Evil or Very Mad (or its Jeff-style equivalent) stored somewhere where it could be fixed? Sherlock



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).

Report message to a moderator

Re: Displayed defense values Sat, 11 March 2006 04:43 Go to previous message
m.a@stars is currently offline 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 Evil or Very Mad (or its Jeff-style equivalent) stored somewhere where it could be fixed? Sherlock



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. Cool

Even if it's nontrivial, it might be worth fixing that distance display problem. It crops up everywhere and tends to get annoying. Evil or Very Mad Does someone know if the Jeffs actually used printf-style formatting? Sherlock


[Updated on: Sun, 12 March 2006 04:47]




So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Previous Topic: table of tech values at different levels?
Next Topic: Minerals - mining and depletion
Goto Forum:
  


Current Time: Sun May 05 20:08:44 EDT 2024