Hahaha, Oh. My. Cthulhu. I figured out why I was getting such a severe version of this problem with my IDH. (And also why with DoWAI, using the same race for all AIs - like all Chaos - tended to give the most predictable "patterns" of strats.)
OK, first you have to know that the RNG used in DC and I think SS too is horribad. It's prone to awful regularities; if you feed it a similar seed, it's going to give you a similar output. Do this:
for counter = 1,100 do
math.randomseed(counter)
print(tostring(math.random(100)))
end
You're going to get a string of 1s and near the end 2s.
Good random number generators shouldn't behave like that.
BUT, even a bad RNG like this one is going to show much-desired divergence if each seed is iterated a number of times.
This is my IDH's squadlimits:
SquadLimits =
{
standard =
{
inquisition_squad_archivist = 0,
inquisition_squad_servitor_maintenance = 3,
inquisition_squad_bodyguard = 1,
inquisition_squad_shock_troops = 4,
inquisition_squad_scholars = 1,
inquisition_squad_death_cultist = 2,
inquisition_squad_grey_knights = 3,
inquisition_squad_grey_knights_terminator = 1,
inquisition_squad_grey_knight_hero = 1,
inquisition_squad_inquisitor_lord = 1,
inquisition_squad_rhino = 4,
inquisition_squad_chimera_transport = 5,
inquisition_squad_dreadnought_assault = 2,
inquisition_squad_dreadnought_support = 3,
inquisition_squad_land_raider = 1,
inquisition_squad_land_raider_crusader = 1,
}
},
Notice something unusual? No "math.random ( 2,3 )" type stuff like you have in all the other races.
Why does this affect anything? Because apparently a race's StrategyInfo gets imported after the randomiser seeding in cpu_manager, but before BuildBaseStrategy. So normally, StrategyInfo uses the random number generator a bunch of times due to calculating squad limits, and then by the time the AI is in BuildBaseStrategy and choosing a strategy, the RNG has been iterated a bunch of times and will give divergent results as long as the seeds are somewhat meaningfully different (as provided by my os.clock solution). But if the strategy choice is the first usage of the RNG after the seeding, then you'll see complete crap like what I've been getting.
This is beyond stupid.
This is also why using the same race for multiple AI games led to most predictable patterns - because different races call math.random different numbers of times in their squadlimits definitions.
Well, I don't feel like adding fake random squadlimits to my IDH tweaks, the race doesn't really need them. But if iterating is what the rng needs, iterating is what it'll get:
--Markus Ramikins fix for the fake randomness
local miliseconds = math.mod(os.clock()*1000,1000)
math.randomseed(miliseconds)
--iterate the RNG to get better random values
for counter = 1,10 do
dummy = math.random(2)
end
That was surreal.
EDIT: before Thudo's "dowai on the brain" syndrome kicks in
I'd like to make it clear I was not laughing at dowai, but at the in-built RNG, which isn't dowai's fault, and at the accident of how dowai design unintentionally alleviated and concealed the problem.
Edited by Markus Ramikin, 18 December 2011 - 07:44 AM.