Page 3 of 3

RE: upgrading your army: how?

Posted: Fri Jul 29, 2005 11:35 am
by ericbabe
ORIGINAL: Joram
It is not working as described. The real data is more or less* 3 times the sum of the squares of the barracks, plus the sum of the squares of the cultural developements, all divided by 100.

So it's easier to compare ...

Erics formula is equivalent to (2*SSB + SSC)/100

While Mari is saying it's (3*SSB + SSC)/100

[:)]


I admit I've never hand calculated the sums of the squares of my barracks/culture. The code seems to follow 2*SSB:

float TGame::Info_Calc_No_Upgrades(PLAYER_HANDLE hPlayer)
{
int mil = 0;
int PlayerDev[NoPlayersWithTreaties];
zap(PlayerDev);
Info_CountDevelopmentSquaresForPlayers(PlayerDev, TCity::Martial_Dev);
mil += PlayerDev[hPlayer];
Info_CountDevelopmentSquaresForPlayers(PlayerDev, TCity::Cultural_Dev);
mil += PlayerDev[hPlayer]/2;

return (float) mil/50.0f;
}

The above is the method that is called when calculating the number in the Upgrade Report from the Econ Advisor.

and

void TGame::Info_CountDevelopmentSquaresForPlayers(int* pPlayerDev, int dev)
{
assert(dev<TCity::eoDev);

TPieceLoop Loop(PTProvMap);
GAMEPIECE pPiece;
for (Loop.Reset(); Loop.Continue(); Loop.Next())
{
pPiece = (GAMEPIECE) Loop;
if (pPiece->IsACity() && pPiece->GetPlayerId()<NoPlayersWithTreaties)
{
pPlayerDev[pPiece->GetPlayerId()] +=
pPiece->GetCityDevelopment(dev)*pPiece->GetCityDevelopment(dev);
}
}
}

RE: upgrading your army: how?

Posted: Fri Jul 29, 2005 11:36 am
by ian77
ORIGINAL: ericbabe
ORIGINAL: Mynok
I have a used-once 12-cup coffee maker sitting idle in my attic. Send my your address and its yours. Put it right in the basement next to the water cooler and 20 pound bag of java beans.

[:)] LOL -- I think I need an I.V.

I have a used once catheter needle and tube, along with an old milk bottle....Send my your address and its yours. Put it right in the basement next to the water cooler and 20 pound bag of java beans.
[:D]

RE: upgrading your army: how?

Posted: Sat Jul 30, 2005 2:50 am
by marirosa
I think i know what is happening. The key is

Code: Select all

mil+=PlayerDev[hPlayer]/2
As mil is an integer, if you divide an odd number, the result is truncated. For example, if you have a level 3 culture, the result of the function is 9, divided by 2 is 4.5, but as mil is integer, it only adds 4.

This can explain the inacuracies in my results and makes me wonder.... 3*SSB is exactly the same as SSB/50 + (SSB/2)/50 so it seems the call to

Code: Select all

 Info_CountDevelopmentSquaresForPlayers(PlayerDev, TCity::Cultural_Dev);
 mil+=PlayerDev[hPlayer]/2
 

do not reset the value of PlayerDev[hPlayer], so instead of counting the squares of culture, it ADDS the squares of culture to the squares of barracks.

RE: upgrading your army: how?

Posted: Fri Aug 05, 2005 12:42 am
by Joram
As mil is an integer, if you divide an odd number, the result is truncated. For example, if you have a level 3 culture, the result of the function is 9, divided by 2 is 4.5, but as mil is integer, it only adds 4.

Ahh, makes sense. I missed that it was an integer. Indeed, you won't get the fraction if you divide into the integer!