As a French person I feel like it's my duty to explain strikes to you. - AdrienIer

Create an account  

 
[spoilers] Pindicator and Regoarrarr - Bismark of Ethiopia

regoarrarr Wrote:What we need to do is figure out the odds of different resources appearing on different tiles to check the odds that our plains tile is horse / copper / something else / nothing. It's got to be somewhere in the map generator, right? I mean we always see certain bonuses always appearing on certain tiles, right? Like gold is always on plains or desert hills, or gems always on grass or grass hills.

The algorithm for resource placement seems to be roughly:
1. Decide on a number of resources (bonuses) of a given kind to place.
2. Repeatedly choose a random tile, and if that tile's terrain allows the given resource, place a resource there.

The function deciding the number of resources to place is this one:

Code:
int CvMapGenerator::calculateNumBonusesToAdd(BonusTypes eBonusType)
{
       CvBonusInfo& pBonusInfo = GC.getBonusInfo(eBonusType);

       // Calculate iBonusCount, the amount of this bonus to be placed:

       int iRand1 = GC.getGameINLINE().getMapRandNum(pBonusInfo.getRandAppearance1(), "calculateNumBonusesToAdd-1");
       int iRand2 = GC.getGameINLINE().getMapRandNum(pBonusInfo.getRandAppearance2(), "calculateNumBonusesToAdd-2");
       int iRand3 = GC.getGameINLINE().getMapRandNum(pBonusInfo.getRandAppearance3(), "calculateNumBonusesToAdd-3");
       int iRand4 = GC.getGameINLINE().getMapRandNum(pBonusInfo.getRandAppearance4(), "calculateNumBonusesToAdd-4");
       int iBaseCount = pBonusInfo.getConstAppearance() + iRand1 + iRand2 + iRand3 + iRand4;

       bool bIgnoreLatitude = GC.getGameINLINE().pythonIsBonusIgnoreLatitudes();

       // Calculate iNumPossible, the number of plots that are eligible to have this bonus:

       int iLandTiles = 0;
       if (pBonusInfo.getTilesPer() > 0)
       {
               int iNumPossible = 0;
               for (int iI = 0; iI < GC.getMapINLINE().numPlotsINLINE(); iI++)
               {
                       CvPlot* pPlot = GC.getMapINLINE().plotByIndexINLINE(iI);
                       if (pPlot->canHaveBonus(eBonusType, bIgnoreLatitude))
                       {
                               iNumPossible++;
                       }
               }
               iLandTiles += (iNumPossible / pBonusInfo.getTilesPer());
       }

       int iPlayers = (GC.getGameINLINE().countCivPlayersAlive() * pBonusInfo.getPercentPerPlayer()) / 100;
       int iBonusCount = (iBaseCount * (iLandTiles + iPlayers)) / 100;
       iBonusCount = std::max(1, iBonusCount);
       return iBonusCount;
}
The most relevant values fetched from the Civ4BonusInfos.xml file are:

Horse (placeable on flatland grassland, plains and tundra):
<iConstAppearance>100</iConstAppearance>
<Rands>
<iRandApp1>10</iRandApp1>
<iRandApp2>10</iRandApp2>
<iRandApp3>0</iRandApp3>
<iRandApp4>0</iRandApp4>
</Rands>
<iPlayer>100</iPlayer>
<iTilesPer>256</iTilesPer>

Copper (placeable on grass, desert, tundra, plains, snow):
<iConstAppearance>100</iConstAppearance>
<Rands>
<iRandApp1>10</iRandApp1>
<iRandApp2>10</iRandApp2>
<iRandApp3>0</iRandApp3>
<iRandApp4>0</iRandApp4>
</Rands>
<iPlayer>50</iPlayer>
<iTilesPer>128</iTilesPer>

Iron (also placeable on grass, desert, tundra, plains, snow):
<iConstAppearance>100</iConstAppearance>
<Rands>
<iRandApp1>10</iRandApp1>
<iRandApp2>10</iRandApp2>
<iRandApp3>0</iRandApp3>
<iRandApp4>0</iRandApp4>
</Rands>
<iPlayer>100</iPlayer>
<iTilesPer>128</iTilesPer>

If you can figure out the likely terrain composition of the world, you can probably calculate the odds of having copper, horse and iron on that tile. Good luck! lol
I have to run.
Reply

As an immediate observation, iron is more likely than copper, at least. What is more likely of horse/iron and copper depends on the total land area, the number of players, the number of hills, and the number of snow and desert tiles.
I have to run.
Reply

Right. As novice alluded to, he and I (and Seven) spent a bit of time hypothetically talking about resource allocation. Obviously neither of them could comment on our particular tile (if they even know what it is or is not).

So it decides start positions based mostly on how much land it thinks will be "yours" with little to no consideration of the quality of your BFC (which makes sense, since it will later improve it).

Then it "improves" the start, by putting in rivers (check!), forests (check!) and at least 3 hills (check!), as well as getting us up to "4" resources (Seafood = 2/3 resource).

One important note is that the strategic resources can not be added in that process (because bNormalize in Civ4BonusInfos.xml is 0 for those resources). Also, those resources can not "normally" be on a river, since bNoRiverSide is set to 0. The only way they can be is if the river is added as part of the start improver (which appears to be the case for us)

So it seems likely that if this is a strategic resource, it was there in the first place. I think Novice is right about the composition of things
Reply

SevenSpirits Wrote:Plus moving onto a forest is a more expensive cost on quick!

Seriously, Normal speed chops are more than 50% more efficient in workers turns than Quick speed chops; it's pretty silly.

Would it be more even if quick speed chopped in 2water turns? Or would that just imbalance it in the other direction?
Suffer Game Sicko
Dodo Tier Player
Reply

pindicator Wrote:Would it be more even if quick speed chopped in 2water turns? Or would that just imbalance it in the other direction?

The 3 turn cost on quick might not have been intended, it was just implemented as a sloppy multiplication by 0.67, rounding up. So 3*0.67 = 2.01 = 3.

I think it would be fair to say that changing it to 2 turns now would be unbalancing, though. smile
I have to run.
Reply

novice Wrote:I think it would be fair to say that changing it to 2 turns now would be unbalancing, though. smile

How so? It would still be less powerful than it is on normal speed.
Reply

SevenSpirits Wrote:How so? It would still be less powerful than it is on normal speed.

OK, imbalancing is the wrong word I guess. Established MP truths would have to be revised though.
I have to run.
Reply

Darrelljs just let me know that he is ded-lurking Krill, so that's good. -1 for our chief competition lol

On the other hand, we have 21 posts in our thread from the triumvirate of Kyan, novice, and SevenSpirits thumbsup
Reply

Between anticipating the start of this game and the technical difficulties over at 7, I'm just itching to play a turn cry

I think it's been 3 days ; this must be withdrawal setting in.
Suffer Game Sicko
Dodo Tier Player
Reply

novice Wrote:The 3 turn cost on quick might not have been intended, it was just implemented as a sloppy multiplication by 0.67, rounding up. So 3*0.67 = 2.01 = 3.

I think it would be fair to say that changing it to 2 turns now would be unbalancing, though. smile

FFH drops it down to 2 turns and I 8h on quick speed (don't quite me on this).
Reply



Forum Jump: