#5200 closed defect (fixed)
AIInterface freezes the game for 8 seconds on gamestart
Reported by: | elexis | Owned by: | |
---|---|---|---|
Priority: | Must Have | Milestone: | Alpha 23 |
Component: | UI & Simulation | Keywords: | |
Cc: | Patch: | Phab:D1559 |
Description
There is an about 8 second freeze on the loading screen before the mapgen starts.
It occurs when simulation/helpers/Setup.js
initializes the diplomacy with SetTeam
. That broadcasts MT_DiplomacyChanged
which triggers Auras.prototype.Clean()
.
According to temple, AIInterface.prototype.OnTemplateModification
consumes most of the time for processing that.
See Phab:P127 for some statistics in seconds. It's only teambonuses that change the template costs and it is slow (500ms per call) without any entities on the map.
WARNING: Auras.OnDiplomacyChanged ["teambonuses/brit_player_teambonus"] 0.667 WARNING: Auras.OnDiplomacyChanged ["teambonuses/iber_player_teambonus"] 0.697 WARNING: Auras.OnDiplomacyChanged ["teambonuses/sele_player_teambonus"] 0.792 WARNING: Auras.OnDiplomacyChanged ["teambonuses/maur_player_teambonus"] 0.917
{ "type": "global", "affects": ["CitizenSoldier Javelin"], "affectedPlayers": ["ExclusiveMutualAlly"], "modifications": [ { "value": "Cost/Resources/food", "multiply": 0.8 }, { "value": "Cost/Resources/wood", "multiply": 0.8 }, { "value": "Cost/Resources/metal", "multiply": 0.8 }, { "value": "Cost/Resources/stone", "multiply": 0.8 } ], "auraName": "Saripeko", "auraDescription": "Reduces the cost for citizen-soldier skirmishers with 20% for allies of Iberian players" }
If this is new in Alpha 23, then it could be one of the reasons why players dropped more often in this release D1513.
Change History (10)
comment:1 by , 6 years ago
comment:2 by , 6 years ago
It would seem so https://github.com/0ad/0ad/search?q=AIInterface&unscoped_q=AIInterface
comment:3 by , 6 years ago
Patch: | → Phab:D1559 |
---|
Actually AIInterface is disabled! But it's disabled after SetTeam
, so if we just move it to before that then there's no freeze on gamestart.
Games with Petra will still have the freeze (worse with more players on the same team), so that function should be looked at.
comment:4 by , 6 years ago
Milestone: | Backlog → Alpha 23 |
---|---|
Priority: | Nice to Have → Should Have |
comment:7 by , 6 years ago
Priority: | Should Have → Must Have |
---|---|
Resolution: | → fixed |
Status: | new → closed |
is.
(And I'm still unsure which review standards wraitii has. Verification and error analysis don't seem to be part of it.)
There are some larger freezes after mapgen finished, #3700 describes some of them, for instance ParseEntities
can be really slow (20s). For rejoiners it seems unneeded altogether, see #5202. But there are other undocumented freezes after that too. Something to take a look at.
comment:8 by , 6 years ago
I had left the ticket open because there's more things to do, but as far as a23 goes it's done.
comment:9 by , 6 years ago
Trying to not construct the AIInterface (AIProxy?) component in the ComponentManager rather than disabling it later.
It's worse in a23 because of r21785, but I don't know that there's a bug in that commit. It's still unacceptably slow in a22 with lots of players on one team.
The AIInterface function takes all of the time, so we could look into making that faster. (Is the AIInterface component only used for Petra, meaning it could be disabled in games without Petra?)