Huge out of range tile gids (2147483796)

98 views
Skip to first unread message

rala...@gmail.com

unread,
Apr 11, 2013, 11:52:46 AM4/11/13
to mape...@googlegroups.com
Hi there,

I've just noticed this problem over the past few weeks -- I have a hunch it's related to rotating tiles, but I haven't reproduced it precisely.

Basically, when I generate an XML .tmx file, some tiles have these gigantic no-way-thats-a-real-tile-gid numbers.  I'm using Tiled 0.90 on Windows and OSX, and they keep creeping in:

<tile gid="0"/>
<tile gid="0"/>
<tile gid="2147483796"/>
<tile gid="0"/>
<tile gid="0"/>

My question is -- are numbers this large actually normal?  And if not, is there a workaround?

Thanks so much!


-Nick

Stefan Beller

unread,
Apr 11, 2013, 11:54:00 AM4/11/13
to mape...@googlegroups.com
Hi,

the upper bits are used for flipping and turning,
see https://github.com/bjorn/tiled/wiki/TMX-Map-Format
as documentation.

Stefan

rala...@gmail.com

unread,
Apr 11, 2013, 12:01:30 PM4/11/13
to mape...@googlegroups.com, stefan...@googlemail.com
Thank you so much!  That makes sense, time to unflip my flips!


-Nick

Thorbjørn Lindeijer

unread,
Apr 11, 2013, 2:07:55 PM4/11/13
to mape...@googlegroups.com
On 04/11/2013 05:52 PM, rala...@gmail.com wrote:
> Hi there,
>
> I've just noticed this problem over the past few weeks -- I have a hunch
> it's related to rotating tiles, but I haven't reproduced it precisely.
>
> Basically, when I generate an XML .tmx file, some tiles have these gigantic
> no-way-thats-a-real-tile-gid numbers.  I'm using Tiled 0.90 on Windows and
> OSX, and they keep creeping in:

Just to be sure I want to note that .tmx are _always_ XML files. Your file just uses an XML format for storing the layer data as well.

I hope you only did this for testing purposes, since the format is the most inefficient of all options, taking lots of storage space and most parsing time. If you want to be able to read the global tile IDs, a better option would be the CSV format.

As for flipping/rotation... it would actually make sense to add an option to Tiled to disable these features for those who don't use them.

Best regards,
Bjørn

rala...@gmail.com

unread,
Apr 11, 2013, 2:59:49 PM4/11/13
to mape...@googlegroups.com
That makes sense... I would actually love it much more if I could visually see which tiles are rotated or flipped.  If I accidentally flip or rotate a symmetric tile, it's impossible to tell without looking at the XML file.

It would sort of be like how people sometimes put hot pink on the unused portions of their tilesheet just incase they accidentally place a "blank" tile.


-Nick


P.S.  I'll stop using XML for layer data (unless we need to debug!)...  

Thorbjørn Lindeijer

unread,
Apr 11, 2013, 3:11:47 PM4/11/13
to mape...@googlegroups.com
On Thu, Apr 11, 2013 at 8:59 PM, <rala...@gmail.com> wrote:
That makes sense... I would actually love it much more if I could visually see which tiles are rotated or flipped.  If I accidentally flip or rotate a symmetric tile, it's impossible to tell without looking at the XML file.

It would sort of be like how people sometimes put hot pink on the unused portions of their tilesheet just incase they accidentally place a "blank" tile.

Well, at least I plan to show these flags in the new Properties dock widget I'm working on. Doesn't give you a good way of finding such cases, though.

Regards,
Bjørn

nick ralabate

unread,
Apr 11, 2013, 9:54:40 PM4/11/13
to mape...@googlegroups.com
Just a quick follow-up: thanks! And I sort of stumbled over the
documentation -- what is anti-diagonal? I sort of see what you mean
in that the axis are flipped, but does it have anything to do with an
anti-diagonal matrix (main hit on google)... e.g. is a 90 degree
rotation the same as multiplying by an anti-diagonal matrix?


-Nick
> --
> --
> Tiled Map Editor mailing list
> mape...@googlegroups.com
> http://groups.google.com/group/mapeditor
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "Tiled Map Editor" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/mapeditor/nL8kkajnShY/unsubscribe?hl=en.
> To unsubscribe from this group and all its topics, send an email to
> mapeditor+...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
Shh!
http://secret-library.com/

Thorbjørn Lindeijer

unread,
Apr 12, 2013, 4:27:35 AM4/12/13
to mape...@googlegroups.com
On Fri, Apr 12, 2013 at 3:54 AM, nick ralabate <rala...@gmail.com> wrote:
>
> Just a quick follow-up: thanks! And I sort of stumbled over the
> documentation -- what is anti-diagonal? I sort of see what you mean
> in that the axis are flipped, but does it have anything to do with an
> anti-diagonal matrix (main hit on google)... e.g. is a 90 degree
> rotation the same as multiplying by an anti-diagonal matrix?

Actually it has little to do with an anti-diagonal matrix. It's an
anti-diagonal flip because the flipping happens in that direction (so
top-right and bottom-left corners are swapped) as opposed to
horizontal or vertical flipping.

You can use a matrix to do the anti-diagonal flip, using shearing to
swap the x and y axis. This is how Tiled does it, in fact:

https://github.com/bjorn/tiled/blob/master/src/libtiled/maprenderer.cpp#L111

In effect, an anti-diagonal flip is equivalent to either of the following:

Rotate 90 clockwise + Horizontal flip
Rotate 90 counter-clockwise + Vertical flip

Regards,
Bjørn
Reply all
Reply to author
Forward
0 new messages