Opened 7 years ago

Closed 6 years ago

#4713 closed defect (fixed)

[PATCH] Footprint "Sunken ship" lag

Reported by: elexis Owned by:
Priority: Release Blocker Milestone: Alpha 23
Component: UI & Simulation Keywords:
Cc: Patch: Phab:D850

Description

The footprint component tries many places to ungarrison units if an entity was destroyed that garrisoned them.

Before r16636 and r16643, the freeze so long that players even reached a network timeout.

As of Alpha 22 this is still very noticeable.

The maps Danubius and Polar Sea spawn units and avoid the TriggerHelper spawn function because they also use the Footprint component which is very laggy if used (and not needed for these maps as on Danubius the entities garrison immediately after spawn and on Polar Sea, the wolves can spawn everywhere the trigger point was set, even in the same place).

Since "sunken ship freeze" still takes more than 2-3 seconds it is the foremost noticeable lag-experience in some games (Danubius only one example where many garrisoned ships sink), it must be optimized further.

Attachments (5)

sunken_ship_lagspikes.jpg (204.2 KB ) - added by elexis 7 years ago.
a22_danubius_replay_profile_data.7z (1.8 MB ) - added by elexis 7 years ago.
An example a22 danubius replay with many "sunken ship" freeze including the profile data generated from running the non-visual replay.
volcanic_lagspikes.jpg (178.9 KB ) - added by elexis 7 years ago.
volcanic lagspikes.7z (649.6 KB ) - added by elexis 7 years ago.
volcanic lag.png (135.2 KB ) - added by temple 7 years ago.

Change History (19)

by elexis, 7 years ago

Attachment: sunken_ship_lagspikes.jpg added

by elexis, 7 years ago

An example a22 danubius replay with many "sunken ship" freeze including the profile data generated from running the non-visual replay.

comment:1 by elexis, 7 years ago

To back it up with data, I've profiled this a22 danubius game where the "sunken ship" lagspikes occur frequently:

https://trac.wildfiregames.com/raw-attachment/ticket/4713/sunken_ship_lagspikes.jpg

The dark green line at the top is the total simtime per turn. Just below in light green there is PickSpawnPoint and TestUnitShape (called from PickSpawnPoint).

See wiki:EngineProfiling#Creatinggraphs on how to do the profiling.

Notice we have to apply the patch in Phab:D778 to have that part profiled!

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

comment:2 by elexis, 7 years ago

It's PickSpawnPointBothPass, not PickSpawnPoint.

comment:3 by elexis, 7 years ago

In 19973:

Profile Footprint calls that can easily consume 90% of the simtime on a turn ("sunken ship lag").

Differential Revision: https://code.wildfiregames.com/D778
Refs #4713
Reviewed By: Vladislav

comment:4 by temple, 7 years ago

Danubius is pretty much unplayable with a large number of players.

Poking around a bit, there's this comment in CCmpObstructionManager.cpp:

// TODO: should use the subdivision stuff here, if performance is non-negligible

If it's testing against everything on the map rather than just the nearby stuff, that's obviously going to slow things down a lot. (My first time looking through the code, so I might be talking nonsense.)

Edit: Yeah, seems like that's it. I'll upload a patch tomorrow, maybe try the profiling stuff too.

Last edited 7 years ago by temple (previous) (diff)

comment:5 by elexis, 7 years ago

Milestone: BacklogAlpha 23
Patch: Phab:D850
Summary: Footprint "Sunken ship" lag[PATCH] Footprint "Sunken ship" lag

comment:6 by elexis, 7 years ago

Priority: Must HaveRelease Blocker

Performace improvement is gigantic when playing with sinking ships and the patch isn't complex.

comment:7 by elexis, 7 years ago

Another pathfinding related lagspike: Phab:D926

by elexis, 7 years ago

Attachment: volcanic_lagspikes.jpg added

by elexis, 7 years ago

Attachment: volcanic lagspikes.7z added

comment:8 by elexis, 7 years ago

1) The profiling of the alpha 22 volcanic_lagspikes replay above shows some serious lagspikes on the map volcanic lands (i.e. a land map), caused by more TestUnitShape called from PickSpawnPointBothPass.

2) A big freeze was noticed in the visual replay just before 13:48, turn 1656, i.e. at 82 in the graph. But the graph doesn't show any lagspike there and I didn't find any ungarrisoned or spawned unit in the visual replay at that time. However I had about 50 units near the map border there.

comment:9 by temple, 7 years ago

In case you didn't realize it, (2) is the lag described in Phab:D926. On turn 1651 and 1652 you move to z = 1536, the edge of the map.

comment:10 by temple, 7 years ago

Also, the graph is from the danubius replay! I was wondering why PickSpawnPointBothPass would show up since I thought it was only used with dying ships.

by temple, 7 years ago

Attachment: volcanic lag.png added

comment:11 by temple, 7 years ago

There was another command to go to the edge of the map at turn 5625 = 281 on the graph. That's a little before the smaller spike at 286, but I'm guessing it's related.

comment:12 by elexis, 7 years ago

Ah, that's why it didn't show up in the graphs. I suspected it's the other bug, but didn't investiage. Good that we now know that both patches have basically release blocker priority.

comment:13 by temple, 7 years ago

Oh, I missed the others: on turn 5720, 5721, 5722 = 286 (so that explains the smaller spike), and 5863 = 293.

comment:14 by temple, 6 years ago

Resolution: fixed
Status: newclosed

In r20438:

Use the rangeManager's subdivisions in the obstruction manager shape tests. Completes an existing TODO. This is a large speedup in some cases for those test functions, particularly the "sunken ship lag" issue.

Reviewed By: elexis, mimo, bb, wraitii Accepted By: bb, wraitii

Differential Revision: https://code.wildfiregames.com/D850

Note: See TracTickets for help on using tickets.