I have been trying to learn how to build and import maps using Monogame.Extended and stumbled into an interesting problem. I am importing it as an XML file, and everything went fine. Then I made some minor adjustments, added a couple of more tiles and got the following error:
System.InvalidOperationException: Det finns ett fel i XML-dokumentet (2930, 10). —> System.OverflowException: Värdet var antingen för stort eller för litet för Int32.
Wierdly in swedish, but translated it says that the value at 2930, 10 is too high. Looking at the values below the value at 2930 doesn’t make sense at all, the highest ID in my tileset is 695. Any thoughts on why these outliers might be created?
so I found a clue, the outliers are created because I flipped the tiles with “Shift + X”, so I guess now the question is how the hell do you turn them back into normal values…?
It seems Tiled adds a high value as the “gidID” for a tile, indicating that they are flipped either
horizontally (adds hex 0x80000000)
vertically (adds hex 0x40000000) or
diagonally (adds hex 0x20000000)
So 2147484247 (value stored as gid above) is 2147483648 (hex 0x80000000) + 599 (correct tileset ID).
So just by subtracting the added hex value I can get my tile set IDs and find out how the tiles should be filpped when I laterdraw them. However TiledMapImporter fails before I get the chance to do so, so does anyone know if there is any support for handling the import with these high numbers?