Skip to content

Concepts: The Advanced Content Change Algorithm

Maximilian Dorn edited this page Sep 29, 2021 · 3 revisions

The Advanced Content Change Algorithm

The Advanced Content Change Algorithm is another optimization algorithm. This optimization will work for most cases, but its big downside is its memory usage: MapScreens with the algorithm enabled will use double the memory than normal maps.

How it works

The algorithm works by storing a copy of the current graphics buffers after updating. The next time you call the MapScreen#update() method it will compare the current state of the graphics buffers to the copy and only send the ClientsideMaps whose graphics buffers have changed to the player(s). After sending the algorithm will overwrite its copy of the graphics buffer with a new one and thus the cycle continues.

Enabling the algorithm

The algorithm is disabled by default because of the relatively high memory usage. You can enable it by calling MapScreen#enableAdvancedContentChangeAlgorithm() and disable it by calling MapScreen#disableAdvancedContentChangeAlgorithm(). To actually utilize it you need to call the MapScreen#update() method with the DirtyHandlingPolicy.IGNORE enum constant.

Memory usage

Check out the memory usage page.