diff --git a/Tilemaps.md b/Tilemaps.md index 45635a7..bb3c983 100644 --- a/Tilemaps.md +++ b/Tilemaps.md @@ -392,9 +392,23 @@ A fourth round (#348) made a painted cell cost what is around it, not the whole Measured with the same map: one painted cell costs the scene's item list 3.5 ms on 60x60 and 4.0 ms on 120x120, against 3.4 ms without painting (headless, before 16.8 and 54.6 ms). A brush stroke on -the map doubled to 120x120 runs at 42 fps instead of 28, p95 of a frame 52 instead of 92 ms. What -still grows with the map is the mesh: a painted cell builds the geometry of every tile on that layer -again, since the layer's tiles come as a new list and are grouped by tile afresh. +the map doubled to 120x120 runs at 42 fps instead of 28, p95 of a frame 52 instead of 92 ms. + +A fifth round (#424) took out the meshes: a painted cell built the geometry of every tile on that +layer again, since the layer's tiles came as a new list and were grouped by tile afresh. + +- A patched list of tiles says what it came from and which entries went and came + (`tilesPatch`). A cell around the painted ones that is drawn the same keeps its entry, and a + patch that changes nothing drawn hands back the very same list. +- `groupByTile` and `layerRows` patch the groups of the list before (`patchedGroups`). A group no + changed entry falls into is the very same array, so its mesh is not built again. On a layer + sorted by Y that goes for each row and for the groups in it. +- A tile new to the layer still works the whole layer out again, as before. + +Measured with the same stroke: meshes built per frame 21.9 to 0.94 on 60x60 and 40.7 to 1.22 on +120x120, 49 to 51 fps and 42 to 46 fps. Painting now costs both sizes the same, about 10 fps below +the same view without painting. What is left between the two sizes is drawing the larger map, which +the view without painting shows as well. A frame still costs what it touches: an object standing **inside** many outlined cells is tested against each of them, so an outline of a hundred corners around every cell of a lake is dearer than