Posts: 7,602
Threads: 75
Joined: Jan 2018
Yes, that's correct "earlier city wins a tie" and you are also correct about the capital never founding a religion.
Posts: 6,700
Threads: 44
Joined: Nov 2019
Ok, in a vague hypothetical, lets say 2nd city is at 1 pop and 3rd city is at 3 pop. What are the odds for each city? I can't quite follow the math.
Posts: 5,607
Threads: 47
Joined: Mar 2007
(April 24th, 2020, 23:20)Charriu Wrote: Have you ever wondered how a feature of civ 4 actually worked?
Frequently. Usually while shaking my head and/or ranting at my computer screen.
Very informative thread, Charriu. Thanks!
(July 11th, 2020, 13:45)Mjmd Wrote: Ok, in a vague hypothetical, lets say 2nd city is at 1 pop and 3rd city is at 3 pop. What are the odds for each city? I can't quite follow the math.
If I am following the explanation correctly:
First city gets: 11 + RNG (0-10)
Second city gets: 13 + RNG (0-10)
Ties go to the first city. So it needs an RNG roll at least 2 greater than the second city's to offset the pop size difference. My statistics are too rusty to calculate that probability without looking up some stuff, but maybe someone here will have an exact answer.
Posts: 6,695
Threads: 131
Joined: Mar 2004
I'm not sure from that code if the random range is 1-10, 0-9, or 0-10. The first two are functionally the same if there aren't any religions already present in either. I'll use 1-10.
It's not really math, it's just listing all the possible cases and counting them. Set up a table cross-referencing all the possible results of values of city A (12 to 21) vs city B (14 to 23.) The 10x10 table has 100 entries. You'll find that 28 of them favor city A, 8 are tied, 64 favor city B. Since city A wins ties, the odds are 36/100 vs 64/100, and of course a divisor of 100 is just a percentage.
I did this post and the last one in my head with shortcuts to summarize the possible cases (hint: triangular numbers), but if you want to see it for yourself just lay out that table.
July 11th, 2020, 20:39
(This post was last modified: July 11th, 2020, 20:39 by haphazard1.)
Posts: 5,607
Threads: 47
Joined: Mar 2007
Thanks, T-hawk! I was over-thinking the problem. I am very rusty at that kind of thing.
August 5th, 2020, 13:47
(This post was last modified: September 18th, 2020, 00:28 by Charriu.)
Posts: 7,602
Threads: 75
Joined: Jan 2018
Once again it's time to answer one of Civ4s great mystories. This time:
How is the city determined, in which a Great General should be born?
To answer this question we look into CvPlayer.cpp and in there to setCombatExperience. There we find the following code:
Code: // create great person
CvCity* pBestCity = NULL;
int iBestValue = MAX_INT;
int iLoop;
for (CvCity* pLoopCity = firstCity(&iLoop); pLoopCity != NULL; pLoopCity = nextCity(&iLoop))
{
int iValue = 4 * GC.getGameINLINE().getSorenRandNum(getNumCities(), "Warlord City Selection");
for (int i = 0; i < NUM_YIELD_TYPES; i++)
{
iValue += pLoopCity->findYieldRateRank((YieldTypes)i);
}
iValue += pLoopCity->findPopulationRank();
if (iValue < iBestValue)
{
pBestCity = pLoopCity;
iBestValue = iValue;
}
}
As you can see we are looking for pBestCity, which will be the city in which the GG will be born. Translated into plain english the above code does the following:
- Generate a random number between 0 and your amount of cities, that amount not included
- Multiply that with 4
- Iterate through all 3 yield types (food, hammer, commerce) and add the cities YieldRateRank to the number. This YieldRateRank is just a rating between your cities, with the cities producing the most yield of that type having the rank = 1 and the city with the lowest rank = amount of cities. In case of two cities with the same yields, both cities get the same lower rank for example two second place.
- Add the cities PopulationRank to the number. PopulationRank works just like YieldRank with higher population = lower ranking.
- Now look at the number. The city with the lowest number generates the Great General. Older cities win in a tie.
Summary
So what do we learn from this. The Great Generals city is choosen mostly at random with favors for cities with high yield output and population.
Posts: 486
Threads: 7
Joined: Jan 2013
Something I would be interested in is governor tile preference lol. https://www.realmsbeyond.net/forums/show...p?tid=9679 its a very embarassing experience but I ended up not popping out a warrior on the turn that would protect me from boak/gkc because they walked onto a hammers tile I was working. In the interturn it was reassigned to a different tile that left me a hammer short and the capital totally exposed. Something that would've been solved by logging in after boak/gkc and swapping tiles appropriately, but also something that wasn't anywhere close to my mind.
Posts: 486
Threads: 7
Joined: Jan 2013
(July 10th, 2020, 09:56)Charriu Wrote: 6. We guarantee that this number is at least 1
This will sound stupid, but is there a way for the number to be less than one? Outside of changing these checks, but in the realm with full on worldbuilder cheating.
Posts: 1,948
Threads: 19
Joined: Apr 2019
(August 5th, 2020, 22:03)Borsche Wrote: Something I would be interested in is governor tile preference lol. https://www.realmsbeyond.net/forums/show...p?tid=9679 its a very embarassing experience but I ended up not popping out a warrior on the turn that would protect me from boak/gkc because they walked onto a hammers tile I was working. In the interturn it was reassigned to a different tile that left me a hammer short and the capital totally exposed. Something that would've been solved by logging in after boak/gkc and swapping tiles appropriately, but also something that wasn't anywhere close to my mind.
seconded.
"I know that Kilpatrick is a hell of a damned fool, but I want just that sort of man to command my cavalry on this expedition."
- William Tecumseh Sherman
Posts: 486
Threads: 7
Joined: Jan 2013
(August 5th, 2020, 22:23)GeneralKilCavalry Wrote: (August 5th, 2020, 22:03)Borsche Wrote: Something I would be interested in is governor tile preference lol. https://www.realmsbeyond.net/forums/show...p?tid=9679 its a very embarassing experience but I ended up not popping out a warrior on the turn that would protect me from boak/gkc because they walked onto a hammers tile I was working. In the interturn it was reassigned to a different tile that left me a hammer short and the capital totally exposed. Something that would've been solved by logging in after boak/gkc and swapping tiles appropriately, but also something that wasn't anywhere close to my mind.
seconded.
Looking through your thread again its probably just looking at the max tile yield available with a preference for food (outside of a specific governor preference). I was working a 1f/2h/1c plains forest river silks tile, along with most likely the coastal fish net and a grass hills mine. That 4/0/2 clams net definitely has a higher yield than anything else. I think what would be interesting to see is just if it would prefer a particular tile given even yields (so lets say a grass hill copper tile that has a 1/5/0 yield)
|