Puman wrote:All mods together must share a total space of 2048x2048 pixels (this is mentioned in the games debug log). The sprites.png of all mods are packed into this limited space, when the space runs out the next mods will get rather random graphics.
Playing around with large sprites.png files I noticed the
maximum amount you can safely load is two images of 1024x1024 (which is also the maximum size allowed for a sprites.png as mentioned on page 1).
If you add a third sprites file, it will start to overwrite the first one, starting in topleft corner. Examples:
Here is a snip from debug.txt when loading three sprites with sizes 1024x1024, 1024x1024, 512x512:
Code: Select all
Loading user sprite images for path: /mods_Combi_2/data/sprites.png
Loading user sprite images for path: /mods_Combi_1/data/sprites.png
Loading user sprite images for path: /mods_Combi_3/data/sprites.png
~
PackRectangles(2048, 2048) packing 3 rectangles
Packing:
WorldRenderer::LoadUserSpriteImages Compositing image /mods_Combi_1/data/sprites.png to 2048, 1024
WorldRenderer::LoadUserSpriteImages Compositing image /mods_Combi_2/data/sprites.png to 3072, 1024
WorldRenderer::LoadUserSpriteImages Compositing image /mods_Combi_3/data/sprites.png to 2048, 1536
Created FrameBuffer of size 64 x 64 in 1ms
Object spritebank composite took 3212ms
Warning: Loading a very high res image (2688x128)
Warning: mipmaps requested for non-power-of-two image (2688x128), will break on OpenGL ES
Notice the (x/y positions?) where WorldRenderer puts these together.
When in game this will result in the Combi_3 sprites.png (512x512) overwriting the top left corner of the first sprites.png (Combi_1) canvas.
To have something to compare, here is a snip from debug.txt when loading three sprites with sizes 1024x1024, 1024x1024, 256x256:
Code: Select all
Loading user sprite images for path: /mods_Combi_2/data/sprites.png
Loading user sprite images for path: /mods_Combi_1/data/sprites.png
Loading user sprite images for path: /mods_Combi_3/data/sprites.png
~
PackRectangles(2048, 2048) packing 3 rectangles
Packing:
WorldRenderer::LoadUserSpriteImages Compositing image /mods_Combi_1/data/sprites.png to 2048, 1024
WorldRenderer::LoadUserSpriteImages Compositing image /mods_Combi_2/data/sprites.png to 3072, 1024
WorldRenderer::LoadUserSpriteImages Compositing image /mods_Combi_3/data/sprites.png to 2048, 1792
Created FrameBuffer of size 64 x 64 in 0ms
Object spritebank composite took 3336ms
Warning: Loading a very high res image (2688x128)
Warning: mipmaps requested for non-power-of-two image (2688x128), will break on OpenGL ES
And again, in this example the sprites canvas from Combi_3 will overwrite top left 256x256 part of the first sprites.png canvas (Combi_1).
In the games mods menu these mods were sorted in this order:
Combi_2
Combi_1
Combi_3
(but not loaded that way by worldrenderer?)
I'm not sure if it was intended to have space for 'only' two 1024x1024px sprite for modding available. It seems a rather small area, and in fact is way smaller than the example drawing from ts. If the max size would be 2048x2048 then I should have been able to properly load 4 images of 1024x1024...yet a third one of a few pixels already starts to overwrite things
You can test this yourself by loading these testmods (make sure you have all other mods disabled or saved into a different modmap)
https://www.sendspace.com/file/3o8q9b