TiledMapImporter fails, too high values

Hi,

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?

BR,
Robert

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…?

That number 2147484247 is interesting because it is generally the maximum value of an int.

Maybe Tiled uses that number to symbolise something. They have a similar community to us, may be worth asking there too.

So I found some information here:

It seems Tiled adds a high value as the “gidID” for a tile, indicating that they are flipped either

  1. horizontally (adds hex 0x80000000)
  2. vertically (adds hex 0x40000000) or
  3. 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?

The original article says 0x20000000.

yea correct. I copied + pasted and forgot to change it, thanks. edited original post.

Seems like they should be interpreted as unsigned ints.

I had a look and gid’s are all ints in MG.Extended, that should be fixed.
@coby You can open an issue for this in their GitHub repo https://github.com/craftworkgames/MonoGame.Extended/issues

okay i’ll do that, thanks!

Of course I just reread the first post and it is an OverflowException. I thought he was saying 10 was too high.

This confused me, you can’t even see 2930, do you mean 2980? I thought there was a value of 10 at line 2930 we couldn’t see.

I have opened an issue for you over on MG Extended.

ye sorry it was the same high number at 2930 as at 2980, I accidently cut it out.

okay cool, thanks.

I’ve updated the github issue with relevant details.