Drakehinst
Recruit
Hi everyone,
Based on the work from Bizzfarts (Banner Creator Web Tool and BannerPaste mod), I've been working on creating an image import mod (for those unfamiliar with the BannerPaste mod, it enables you to copy and paste your banner's code in the in-game banner editor screen).
My mod parses single pixels of an image into square icons of 1x1 and the closest RGB color from the palette Bannerlord implements to generate a banner code (for now I used an external python script to generate the banner code).
However I encountered an issue with the maximum number of icons allowed in a banner: the game doesn't seem to accept more than 400 icons (background icon included). Using a 20x20 pixels image therefore leads to losing the bottom-right corner pixel, as you can see on this image (individual square icons were scaled up from 1x1 to a larger size for better visualization):
I tracked down the issue until the TaleWorlds.Core.Banner.cs and TaleWorlds.MountAndBlade.View.BannerVisual.cs source files:
PS:
Based on the work from Bizzfarts (Banner Creator Web Tool and BannerPaste mod), I've been working on creating an image import mod (for those unfamiliar with the BannerPaste mod, it enables you to copy and paste your banner's code in the in-game banner editor screen).
My mod parses single pixels of an image into square icons of 1x1 and the closest RGB color from the palette Bannerlord implements to generate a banner code (for now I used an external python script to generate the banner code).
However I encountered an issue with the maximum number of icons allowed in a banner: the game doesn't seem to accept more than 400 icons (background icon included). Using a 20x20 pixels image therefore leads to losing the bottom-right corner pixel, as you can see on this image (individual square icons were scaled up from 1x1 to a larger size for better visualization):
I tracked down the issue until the TaleWorlds.Core.Banner.cs and TaleWorlds.MountAndBlade.View.BannerVisual.cs source files:
- The clipboard is read entirely, never truncated, and the Banner.BannerDataList contains the right number of items.
- When logging data from the BannerEditorView_OnTick class of the BannerPaste mod, the MetaMesh returned by Banner(clipboardText).ConvertToMultiMesh() contains 401 meshes, which is as expected if all 400 icons plus the 1 icon for the background are preserved.
PS:
- Some will wonder whether the game could handle thousands of icons, e.g. if you were to import a 512x512 pixels image. I believe by looking at the source code that the game is rasterizing the "vector" banner, and therefore uses an optimized version everywhere else than on the banner editor screen. Can anyone confirm?
- If this is the case, then there might be a way to bypass the vector-to-raster conversion entirely and instead convert the image directly into the right format.
Last edited: