Forum Libraries, Components, and Plugins

CCTiledMap cutting off large maps

CharlieKilianCharlieKilian USMember

I'm having a problem with CCTileMap only rendering the first part of a large map. If I make the map smaller, the entire map renders. But once it gets past a certain size, the tiles stop rendering. A certain number of tiles will render starting from the upper left, but beyond a certain point no tiles are displayed.

I've attached an example, which I'm running as a Windows GL application. The example has two maps: ExampleMap_200x80_Works.tmx and ExampleMap_215x80.tmx. Both maps share a common tileset image, with 16x16 tiles. On both maps, I have added tiles to the lower left and lower right corners (in the shape of an L and an inverted L, respectively) to be able to visualize the corners. A repeating pattern of tiles runs across the bottom four rows.

The map that works is 200 tiles x 80 tiles. The entire map is rendered. The broken map is identical, except it has been extended to 215x80 tiles. The extra 15 columns are causing some kind of problem where the bottom two rows of tiles aren't being rendered.

Is this something I'm doing wrong? Or a known limitation with CCTileMap? Or did I legitimately discover a bug? None of these would surprise me. I'd appreciate any help I can get with this. I've traced into the CocosSharp code far enough to know that the map data is loaded and parsed correctly, and the quads seem to be getting sent to the render, but I'm starting to get out of my element by that point, so maybe I'm not seeing what I think I am.

To save on size, I didn't attach the entire set of project files. Program.cs and content go in a Windows GL app, MapTestLayer.cs goes in as Shared PCL project. Let me know if you'd rather have a complete set of project files. I've tried it with the CocosSharp nuget packages, and I've also tried getting the latest project files directly from git and compiling them as part of my project, and the problem happens either way.


  • RamiTabbaraRamiTabbara AUMember, Xamarin Team Xamurai

    Hi Charlie,

    Thanks for picking this issue up. Long story short, there's a limit of 65,535 tile vertices that can be rendered per draw call. So for your two particular tile maps we have:

    • 200x80x4 = 64,000 < max
    • 215x80x4 = 68800 > max

    which is why the larger of the two tile maps will not render correctly. I've opened up a new issue here to propose a change that would split up the rendering of a large tile map into multiple draw calls.

    Please also keep in mind that we'll also be adding culling support into our tile map rendering, meaning that for larger tile maps, only the visible tiles will be drawn. That should not only help performance, but additionally limit the instances where a user will be rendering over 65k tile vertices in one go.

  • I have the same problem here. I am trying to render a 100x100 tiles but the maximum row rendered is 55.

Sign In or Register to comment.