Opened 6 years ago
Closed 6 years ago
#4907 closed defect (fixed)
AIManager must initialize RNG with the AISeed immediately
Reported by: | elexis | Owned by: | elexis |
---|---|---|---|
Priority: | Must Have | Milestone: | Alpha 23 |
Component: | AI | Keywords: | |
Cc: | Patch: | Phab:D1178 |
Description
As noticed by mimo in Phab:D1159, the AIManager does not initialize the RNG of the AI Manager with the AISeed
determined in the gamesetup soon enough.
It executes cmpAIManager.AddPlayer
in InitGame.js
prior to cmpAIManager.SetRNGSeed
, so the Config
function in config.js
of the bot may not use any randomization functions if it wants to stay in sync.
It's the case since the introduction of the AISeed in r15973.
Change History (5)
comment:3 by , 6 years ago
Milestone: | Backlog → Alpha 23 |
---|
comment:4 by , 6 years ago
Patch: | → Phab:D1178 |
---|
A C++ analog to the other Seed seems safer: Phab:D1178
Note:
See TracTickets
for help on using tickets.
Moving the line a bit upwards might already fix the issue:
It might be better to not give that freedom to break the RNG in JS but init it in C++ first.
However by design the AI is supposed to run in a custom thread and cannot easily access the ComponentManager that stores the initial gamesettings that contain the Seed.
(Also these
cmpPlayer
calls ought to be insimulation/helper/Player.js
, but on the other hand currently need to be called beforeRunGamestateInit
as far as I see. If that is true, the AI doesn't support changing playersettings after the init which might be supported non-AI playersettings after init.)