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 elexis)

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.

https://trac.wildfiregames.com/raw-attachment/ticket/5603/Untitled.png

Attachments (4)

commands.zip (389.0 KB ) - added by elexis 5 years ago.
profile.zip (499.3 KB ) - added by elexis 5 years ago.
Untitled.png (202.0 KB ) - added by elexis 5 years ago.
Capture d’écran 2019-09-22 à 12.43.47.png (151.1 KB ) - added by wraitii 5 years ago.
profiler2 report

Download all attachments as: .zip

Change History (10)

by elexis, 5 years ago

Attachment: commands.zip added

by elexis, 5 years ago

Attachment: profile.zip added

by elexis, 5 years ago

Attachment: Untitled.png added

comment:1 by elexis, 5 years ago

Description: modified (diff)

by wraitii, 5 years ago

profiler2 report

comment:2 by wraitii, 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:3 by elexis, 5 years ago

Keywords: regression added
Milestone: BacklogAlpha 24

refs #5099

Last edited 5 years ago by elexis (previous) (diff)

comment:4 by wraitii, 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...

Last edited 5 years ago by wraitii (previous) (diff)

comment:5 by elexis, 5 years ago

Keywords: regression removed
Milestone: Alpha 24Backlog
Priority: Should HaveMust Have

I see

comment:6 by Freagarach, 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?

Note: See TracTickets for help on using tickets.