Large number of draw rects for off screen tiles

0 favourites
  • 7 posts
From the Asset Store
Each tile 64 by 64 pixels - Ultimate Tile Set for your awesome games
  • Link to .capx file (required! If link is blocked remove the http and www parts):

    skydrive.live.com/redir

    Steps to reproduce:

    1. Open Capx

    2. Run in debug mode

    3. Look at draw rect count for tile maps

    Observed result:

    One of the tile maps has nearly 80,000 draw rect even though most tiles are off screen and the CPU usage is very high even though there is very little going on. (Try clicking around to move the sprite)

    Expected result:

    Much lower CPU usage.

    Browsers affected:

    Chrome: yes

    Firefox: don't know

    Internet Explorer: yes (much worse)

    Operating system & service pack:

    Windows 7 SP1

    Construct 2 version:

    158.2

  • It is working correctly. It does not draw all of the draw rects every tick. The high count is because your use of tilemaps is extraordinarily inefficient. If you want to display images, fragmenting them in to tiny tiles means it requires an extreme number of draw calls to render. You should not use tilemaps like this.

  • The image was just a random picture I threw into the capx instead of putting in my real tile map images.

    Is there a size of tile map that is known to be too big? As in too many tiles?

    Is 12800 x 10240 just way too big?

    In my real tile map the image is 640 x 1280.

  • ggibson1, there are no correct answer for your question. Because this depends on the machines you run on.

    No matter what size of your tiles or sprites are, you must test on the devices you will exported to, to ensure that such devices can run your app satisfactorily according to your standard.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It is entirely inappropriate to use the tilemap object to display large images. See this blog post for details:

    https://www.scirra.com/blog/ashley/3/tech-blog-tilemap-tidbits

    When you do this, it has to issue a separate draw call for every tile, because every tile is different. This adds a massive CPU overhead compared to just being able to draw the image once with say a tiled background or sprite.

  • Ok I do not think I am making myself clear. I am not displaying a single large image in a tile map. The image I used in the sample capx I linked in this post was just some random image I grabbed to use as an example... take this image for example as a tile map that when I use it to create paths across a 12800 x 10440 layout I get very bad performance.

    skydrive.live.com/redir

    Since my total video memory usage as reported by C2 is around 20 meg and the view port is 800x480 I would expect that this would work well on a modern smart phone or tablet.

    I would think that there is at least a known ballpark number that would let know if the size I am using is far over the line or not.

  • You'll still notice that in your tilemap, assuming a relatively small tile size, every tile is different. Therefore it is not possible for the engine to optimise it and it dutifully renders each tile one at a time. You should consider using tiled backgrounds instead perhaps, or using a tilemap which can re-use the same tiles more.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)