Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

TiledMap bug #29

Closed
floatdrop opened this issue May 11, 2013 · 10 comments
Closed

TiledMap bug #29

floatdrop opened this issue May 11, 2013 · 10 comments

Comments

@floatdrop
Copy link

Hey @englercj! I found one strange thing about TiledMap importer:
screenshot from 2013-05-11 10 48 30

You can see it by cloning and running this branch: https://github.com/floatdrop/Aux/tree/grapefruit

@englercj
Copy link
Member

Were you running Chrome, and did this happen as you moved around?

There is a known issue in Chrome where it is optimizing out some of the texture changes for Sprites (which is how the Layer culling is done). See the discussion @GoodBoyDigital and I had in GoodBoyDigital/pixi.js#48

@floatdrop
Copy link
Author

Yes, this is Chrome and no, I just loaded TileMap to stage by calling loadWorld. Btw when I resizing window all tiles goes to hell.

@englercj
Copy link
Member

Resizing doesn't work properly yet, I'm working on it.

@floatdrop
Copy link
Author

Same results in opera 12.15 and firefox.
screenshot from 2013-05-12 17 04 02

@englercj
Copy link
Member

Send me your tmx and tileset and I will see if I can figure it out

@floatdrop
Copy link
Author

Here it is

@englercj
Copy link
Member

Looks like there may be a bug in the TiledEditor or a mistake in your map, here is the data line for the water that is glitching:

"data":[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 529, 530, 597, 598, 597, 598, 530, 3221227472, 3221227472, 530, 599, 597, 530, 597, 599, ......

As you can see there is a random number of 3221227472 in there which corrosponds to the "holes" in my render. If you select some other water and draw over these areas with something else, then it works fine.

Maybe this is left over from some other tileset? Maybe the TiledEditor is exporting these improperly? Maybe the importer you used has a bug?

@floatdrop
Copy link
Author

Woah @englercj, my bad.

@photonstorm
Copy link

I know what causes those - it's Tiled being bloody ridiculous when you FLIP a tile horizontally or vertically! What it does is graphically flip the tile and then bit flip the tile ID as well. I've no idea why on earth it does this, it seems a bit nuts to me. I raised it with the Tiled devs but apparently it's how it should work. Grrrrr.

Anyway - don't use tile flipping in Tiled and you'll not see this happen.

@englercj
Copy link
Member

@photonstorm The reason it does that is because tiles being flipped (or rotated) are marked by bitmasks.. At the time of this bug grapefruit didn't support flipped tiles, but it does now (see TiledTileset#L169). Lttp flips tiles all around and they work fine :)

I think the reason they chose to use a bitmask is because a single tile on the map has no metadata associated with it except the tile id in the data array, so there is no where else to put it without creating some new objects somewhere, or masking it in.

I guess we are lucky they stayed in the 32-bit range, or we would have some issues supporting it in JS 👅

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants