Opened 5 years ago
Last modified 3 years ago
#5603 new defect
Petra Diplomacy changes trigger terrible lag spikes
Reported by: | elexis | Owned by: | |
---|---|---|---|
Priority: | Must Have | Milestone: | Backlog |
Component: | AI | Keywords: | |
Cc: | Patch: |
Description (last modified by )
In this match with r22951, the game froze when any of us changed the diplomatic stance to a Petra player.
It should be the lagspikes seen in the according profiler1 graph, but it is not clear where the lag originates.
Attachments (4)
Change History (10)
by , 5 years ago
Attachment: | commands.zip added |
---|
by , 5 years ago
Attachment: | profile.zip added |
---|
by , 5 years ago
Attachment: | Untitled.png added |
---|
comment:1 by , 5 years ago
Description: | modified (diff) |
---|
by , 5 years ago
Attachment: | Capture d’écran 2019-09-22 à 12.43.47.png added |
---|
comment:2 by , 5 years ago
This indeed seems caused by global aura modification of templates, probably because of team bonuses. Need to investigate more into why now.
comment:4 by , 5 years ago
This is basically the same issue as #5200.
On any template modification we go through all templates (1200 of them) and iterate through the template to update the value, then send that to the AI. It creates a semi-ridiculous amount of temporary objects and is simply slow (~10ms each-call on my machine). Many value changes are to components like Cost that we can't easily optimise out since those do affect all templates.
I can't think of a solution at the moment. We could simply pass the modifications change to the AI, and then let the AI cache (or not) values, but that might be unacceptably slow on its own.
The only long-term solution I can think of is to make the AIs run in the same JS context as the simulation so we can re-use the simulation cache.
Edit -> an alternative would be to make the AI not really care about techs and hope for the best...
comment:5 by , 5 years ago
Keywords: | regression removed |
---|---|
Milestone: | Alpha 24 → Backlog |
Priority: | Should Have → Must Have |
I see
comment:6 by , 3 years ago
Me and my sibling experience this also a lot, but we must say that the effect is more pronounced the further we are in a game. We thought maybe PetraAI parses or resets the gamestate or something?
profiler2 report