Verified:

Scorba Game profile

Member
666

Nov 20th 2012, 14:54:17

I've been using the formula
Networth=Troops*0.5+Jets*0.6+Turrets*0.6+Tanks*2+Spies*1+Tech*2+Land*45+Buildings*35+Money/20000+Food/1000+Missles*2500+Pop/6+Oil/100
MILITARY units are ROUND(x,0); ALL ELSE are TRUNC(x,0)

Sometimes the networth you get using this formula is 1 higher than the networth the spyop of a country shows.

There was nothing on the market or out on PS to cause any unusual rounding.

Xinhuan Game profile

Member
3728

Nov 20th 2012, 16:32:31

Why does it matter if its off by 1...

Scorba Game profile

Member
666

Nov 20th 2012, 16:51:33

Because it's wrong, and if they can't explain why it's off, there may be other issues involved that are less obvious.

Xinhuan Game profile

Member
3728

Nov 20th 2012, 17:03:06

Maybe some of those ROUND()s should be TRUNC()s. Simple explanation.

Or just simple computer 32-bit floating point errors. 32-bit floats are only accurate to 6 significant digits, so if you have billions of cash, it can be off by 1 when you do division if the 64-bit integer cash is converted into a 32-bit float before the division happens. (Solution, use 64-bit doubles)

For example, 11,234,567,890 dollars is converted to 1.123457+e10 and you lose 7890 dollars in the NW calculation.

I'll only be concerned if the formula is off by more than 2.

(The above is just conjecture, the code is more likely to be done in integer division, which is why there are TRUNC()s - the fractional parts are always dropped in integer division so the answer is always an integer).

Edited By: Xinhuan on Nov 20th 2012, 17:05:22
See Original Post

Scorba Game profile

Member
666

Nov 20th 2012, 17:11:33

Nothing over 2bil and all rounds and truncs were done based on the earth formula given in the first post.

Rockman Game profile

Member
3388

Nov 20th 2012, 17:13:28

Originally posted by Xinhuan:
Why does it matter if its off by 1...


Because there's no issues with the game which are more urgent or important than this issue. This is what qzjul should spend his time fixing.

LittleItaly Game profile

Game Moderator
Alliance, FFA, & Cooperation
2221

Nov 20th 2012, 17:17:57

Whys it matter if its off by 1? Because this is a math game maybe?

LOL wtf question...
LittleItaly
SOL Vet
-Discord: LittleItaly#2905
-IRC: irc.scourge.se #sol
-Apply today @ http://sol.ghqnet.com for Alliance

Xinhuan Game profile

Member
3728

Nov 21st 2012, 0:19:03

Because I've provided an extremely plausible reason why it is off by 1 due to truncation or rounding?

Again, I'll only be worried if you can find a country that is off by 2 or more.

Pang Game profile

Administrator
Game Development
5736

Nov 21st 2012, 5:10:15

it should just call the nw function... hmmm...
-=Pang=-
Earth Empires Staff
pangaea [at] earthempires [dot] com

Boxcar - Earth Empires Clan & Alliance Hosting
http://www.boxcarhosting.com

Scorba Game profile

Member
666

Nov 21st 2012, 16:54:12

Perhaps some of the units are added together before being rounded that isn't explained in the formula. There really could be any number of things implemented that would cause things to get slightly off. It's far from the biggest issue out there, but is still a concern if no one can explain it.