Opened 8 years ago

Last modified 3 years ago

#3834 new enhancement

[PATCH]Find a way to shrink or split OOS logs

Reported by: sanderd17 Owned by:
Priority: Should Have Milestone: Backlog
Component: Core engine Keywords: patch
Cc: Patch:

Description (last modified by Stan)

OOS logs are getting too big to work with.

Logs of long games (when there are a big number of units) can't be opened with all text editors anymore, and there's certainly a problem with certain diff tools (like meld).

Some things could be optimised:

  • TechnologyTemplateManager shouldn't serialise any data (it can always load the techs from disk when rejoining). r18100 (-> backref OOS #4239)
  • SerializeVector is very ineffecient; it stores the name of the array with every element, which results f.e. in a lot of lines like. r18121
  • TemplateManager stores the templates rather inefficiently. r18121
  • AIInterface serializes all templates, while it isn't needed at all. r18121
  • AIManager shouldn't serialiaze any data when there are no ais. r18121
  • AuraManager can clean up the applied auras while running (the deletion of objects was omitted in earlier versions because it was bad for performance, but this isn't an issue anymore when using Maps). r18123
  • AIManager serializes the big pathfinder grid. This should be loaded in a Deserialized method (after deserialization of the pathfinder).
  • ObstructionManager a lot of information on the entities that can be derived from other components (like the Position), or from the templates
  • TechnologyManager shouldn't save the autoresearch techs, they can perfectly be calculated on deserializaton (or otherwise, saving the names is enough) r20606

Next to optimising the OOS log, it could also be split. F.e. one log for the SYSTEM_ENTITY (which currently takes up 25% of the entire log), and then f.e. a log per 1000 or 2000 entities

Attachments (3)

smallerOOSlog.diff (5.8 KB ) - added by sanderd17 8 years ago.
smallerOOSlog.2.diff (6.3 KB ) - added by sanderd17 8 years ago.
smallerOOSlog.3.diff (6.3 KB ) - added by sanderd17 8 years ago.

Download all attachments as: .zip

Change History (27)

comment:1 by sanderd17, 8 years ago

In 18100:

Rename TechnologyTemplateManager to DataTemplateManager in order to reflect its new function. Fixes #3909. Disable serialisation of technology templates. Refs #3834

comment:2 by Stan, 8 years ago

Description: modified (diff)

by sanderd17, 8 years ago

Attachment: smallerOOSlog.diff added

comment:3 by sanderd17, 8 years ago

The patch above implements the following changes:

  • It disables serializing if cmpAIInterface.templates, as that was only used as a cache (didn't need serialisation), while it caused a lot of data.
  • A new serializer for repetitive vectors has been made, and use for the LOS and Visibility maps. Basically, instead of noting every value, it notes series of equal values. It would double the space of a random vector, but it seriously reduces the space needed of repetitive vectors (where sometimes 100 subsequent elements are the same).
  • The serialization of the cmpTemplateManager follows a similar structure, which also reduces the size there because people tend to create entities in batches (place 100 trees in Atlas, produce 10 units at once, ...)

Some other things that could be improved:

  • the AI still has some caches that could be removed
  • the AuraManager cache could be removed, and the object could be kept cleaner while the game is running (deleting some keys instead of putting the values back to the default).

Note that the serialization test mode currently doesn't work, but it's also broken in the main game. Which means I can't test this patch completely.

Last edited 8 years ago by sanderd17 (previous) (diff)

comment:4 by sanderd17, 8 years ago

Example of how the LOS array is now encoded:

    #: 1
    los state: 1
    #: 213
    los state: 0
    #: 43
    los state: 3
    #: 214
    los state: 0
    #: 42
    los state: 3
    #: 216
    los state: 0
    #: 40
    los state: 3
    #: 1
    los state: 1
    #: 217
    los state: 0
    #: 37
    los state: 3
    #: 3
    los state: 1
    #: 218
    los state: 0
    #: 35
    los state: 3
    #: 222
    los state: 0
    #: 1
    los state: 1
    #: 33
    los state: 3
    #: 1
    los state: 1
    #: 222
    los state: 0
    #: 3
    los state: 1
    #: 29
    los state: 3
    #: 3
    los state: 1
    #: 222
    los state: 0

by sanderd17, 8 years ago

Attachment: smallerOOSlog.2.diff added

comment:5 by sanderd17, 8 years ago

Description: modified (diff)
Keywords: patch review added
Milestone: BacklogAlpha 21
Summary: Find a way to shrink or split OOS logs[PATCH]Find a way to shrink or split OOS logs

by sanderd17, 8 years ago

Attachment: smallerOOSlog.3.diff added

comment:6 by sanderd17, 8 years ago

In 18121:

Disable serialization of the AI when no AI players are present. Disable serialization of cached AI templates overall. Improve serialization of repetitive vectors and templatenames. Refs #3834

comment:7 by sanderd17, 8 years ago

Description: modified (diff)
Keywords: review removed

comment:8 by sanderd17, 8 years ago

In 18123:

Clean up AuraManager objects while the game is running. Refs #3834

comment:9 by sanderd17, 8 years ago

Description: modified (diff)

comment:10 by elexis, 8 years ago

Milestone: Alpha 21Backlog

Backlogging due to lack of progress.

comment:11 by Itms, 8 years ago

In 18752:

Fix a frequent rejoining OOS. We actually need to serialize the data loaded from the disk, because JS objects in the memory or newly loaded from the disk will not behave the same way.

Fixes #4239, refs #3834.

comment:12 by Itms, 8 years ago

Description: modified (diff)

comment:13 by elexis, 7 years ago

Description: modified (diff)

comment:14 by mimo, 7 years ago

In 19242:

Cleanup of CCmprangeManager

Summary: Following discussions in https://code.wildfiregames.com/D60 the use of u8 to store each boolean has been cleanup up. Now only one u8 is used, thus reducing the size of the struct.

Reviewed By: leper

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

refs #3834

comment:15 by elexis, 6 years ago

In 20606:

Don't serialize the templates of autoresearched technologies.

Refs #3834, #4239
Differential Revision: https://code.wildfiregames.com/D1109
Reviewed By: temple
Comments By: Itms
Proposed By: sanderd17

comment:16 by elexis, 6 years ago

In 20610:

Remove unused serialized cache of technology templates in TechnologyManager.researchedTechs.

Refs #3834, #3909, #4239, #4868, D1108
Differential Revision: https://code.wildfiregames.com/D1130
Reviewed By: mimo

comment:17 by elexis, 6 years ago

Description: modified (diff)

In r20611:

Use Set instead of an Object with unused values in TechnologyManager.researchStarted.

Differential Revision: ​https://code.wildfiregames.com/D1129
Reviewed By: mimo

comment:18 by elexis, 6 years ago

In 20737:

Replace DataTemplateManager simulation component with a globalscript, refs #4868.

Removes the serialization of JSON files, shrinking savegame files and rejoin states sent across the network, refs #3834, #4239, #3909, rP18100.
Removes the AI C++ code to read JSON files from rP13225 since the AI can now use the globalscript.
Allows the AI to read Aura templates and removal of GUIInterface code to improve performance.
Serialization of the JSON objects in other simulation components was removed in r20606 / D1109, r20610 / D1130.

Serialization removal planned by sanderd17
AI part proofread by mimo
Simulation part proofread by bb
Discussed with Itms on irc

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

comment:19 by bb, 6 years ago

In r20797

Stop serializing minimap playercolors

Patch By: temple
Comments By: elexis
Differential Revision: https://code.wildfiregames.com/D1124

Last edited 6 years ago by bb (previous) (diff)

comment:20 by elexis, 6 years ago

In 21014:

Fix AuraManager OOS on rejoin following rP20737 / D1108.

The AuraManager serialized the affects array of the aura JSON files, while the Auras components create new affects arrays upon deserialization.
So the AuraManager of rejoined clients failed to identify and remove the according aura effects of units who received the aura effect before the rejoin.

Fix it by not serializing the array but only the strings inside the array.
It were preferable to rebuild the modification cache and remove the serialization altogether, refs #3834.

rP18100 introduced the same OOS on rejoin, refs #3909, #4239, but it wasn't noticed due to the revert in rP18804.

Differential Revision: https://code.wildfiregames.com/D1201
Reviewed By: bb
Comments By: gameboy
Fixes #4924

comment:21 by elexis, 6 years ago

Description: modified (diff)

comment:22 by Stan, 6 years ago

Description: modified (diff)

comment:23 by elexis, 5 years ago

In r22103 by Stan:

Clean ResourceSupply up.
Add documentation
Reviewed by: @Imarok
Authored by: @Stan

Differential Revision: ​https://code.wildfiregames.com/D1771

Removes the serialization of infinite amount of ResourceSupply.js.

comment:24 by Freagarach, 3 years ago

In 24993:

Do not initialise null values in cmpGarrisonHolder.

Saves some serialisation data (refs #3834).

Ticket: #5979
Differential revision: Phab:D3468
Comments by: @Angen, @Stan

Note: See TracTickets for help on using tickets.