Well, it's mostly hidden in the EXE, but the random numbers are generated by the DLL. The number of RNG calls from the EXE strongly suggests that the algorithm is something like this (pseudocode):Ohhh nice! Multiple people, including myself, have asked how the game chooses random leaders. I've never known if the game chooses by civilization first and then rolls again to determine the leader, OR if all leaders are weighted equally. If the first option, then leaders from multi-leader civilizations (Washington, Catherine, etc.) would be under-represented compared to single-leader civilizations (Pacal, etc.). If the second option, then multi-leader civilizations would be in play more commonly than single-leader civilizations. I've never been bothered by how the game does it, but I've always wanted to know how that works.
Spoiler :
for each player P that no civ has been assigned to manually:
bestResult=-1
bestCiv=none
for each civ C that isn't taken yet:
for each player P that no leader has been assigned to manually:bestCiv=none
for each civ C that isn't taken yet:
randNum = RNG.get(10000) // i.e. between 0 and 9999
if randNum > bestResult:
assign bestCiv to Pif randNum > bestResult:
bestResult = randNum
bestCiv = C
bestCiv = C
bestResult=-1
bestLeader=none
for each leader L matching the civ of P:
bestLeader=none
for each leader L matching the civ of P:
randNum = RNG.get(10000)
if randNum > bestResult:
assign bestLeader to Pif randNum > bestResult:
bestResult = randNum
bestLeader = L
bestLeader = L
There'd be a higher number of RNG calls if a random number were generated for every leader. This algorithm also integrates manual selection (of just the civ, or of both leader and civ) with random selection in a plausibly straightforward way. If the only options were to give (a) every civ equal probability or (b) every leader, then I think (a) would be preferable because leaders of the same civ usually have pretty similar AI behavior. But a middleground seems best.Yes, it should. Otherwise, to be consistent, I'd have to leave a gap in the graphs whenever the player falls behind the view-demographics threshold for a few turns; wouldn't want that. I agree with what you wrote in July – that scores shouldn't be treated as secret once they've been on public display. I've disabled part of the change by default only because I don't want players to get confused by incomplete score graphs.That sounds like a cool option, so I'll have to give it a shot playing with that option. Does the pre-contact score show up, once you gain enoughto see all demographics?
Thanks for the encouragement. I wouldn't depend on it being fixed just yet. I haven't tested it much, and some sounds may still not be covered. In particular, it looks like a sound played when "your units are under attack" could possibly stack up. I could probably implement a general safeguard against loud sounds by keeping track of ids of sounds that have started playing recently – but let's see if the current effort is sufficient.You've single-handedly fixed a quality-of-life bug which has plagued this game since the beginning. That's something to be especially proud of, I'd say. Now, I don't have to worry about waking my neighbors when engaging in late-night Civ wars.![]()
Ashoka: I got used to seeing the new spelling (new in the context of the Civ 4 UI) faster than I expected.