Tilemap Performance Questions

0 favourites
  • 10 posts
From the Asset Store
Firebase: Analytics, Dynamic Links, Remote Config, Performance, Crashlytics on Android, iOS & Web Browser
  • Hi, I'm just starting to mess around with the tilemap, and I was wondering, right now my tilemap is about 80X60 tiles (@ 8px/tile) and if I move sprites on top of the tilemap the CPU usage spikes incredibly,.

    This can be fixed by making the tilemap invisible and no other changes. Is this the normal performance?

    I should say I have tried seamless mode off and it helps, but not much.

  • What you described should not spike the CPU at all. You should provide a minimal .capx to prove this.

  • Hey Ashley,

    Here's a capx for it https://www.dropbox.com/s/gc1zy56gaweucg9/marines%20test%20for%20cpu%20spike.capx?dl=0

    I wasn't sure if it was something I was doing or not. Anyway, the way it is you'll see the CPU usage spike when the green circles are moving (In the task manager on my computer it maxes out a core) and if you click the button it'll make the tilemap invisible and you can see the CPU usage go down to practically nothing.

    I hope it's either a simple fix or that I'm doing something stupid!

    Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There is a pretty consistent high CPU usage across Chrome, Firefox and IE11, and all their profilers show it's spending all the time making WebGL draw calls. I suspect it's simply that you are using a very many small tiles. You have seamless mode off which helps, but you still have a huge number of 8x8 tiles with sections of alternating patterns, so there are no runs of the same tile. See How the WebGL renderer works: normally it can render entire regions of tiles with a single "set texture" then a single "draw quad" call, but alternating tiles forces a "set texture" then "draw quad" call per tile. With such small tiles and a large viewport you can fit in 100x100 tiles or 10,000 tiles on-screen, which gives you an idea of how much scope there is to hammer draw calls.

    If nothing is moving in the layout C2 does not bother re-drawing the screen at all, which is probably the only reason you see higher CPU usage when things start moving.

  • Is it possible that a tilemap is faster if I use the tilemapeditor from Construct, instead I Import a tilemap with JSON?

    I made the tilemap from the example above with Constructs own tilemapeditor and it seems that is a little faster.

  • Erik101 - I doubt that makes any difference at all, if it renders the same tiles at runtime it's identical.

  • You're right, I just told the tilemap to set 100x100 of the same tiles and there was no noticeable performance usage. Thanks, I'll just have to change the way I'm doing it.

  • Hi Ashley, I had a question about draw calls.

    You mentioned that each alternating tile would have a separate draw call.

    So, if we had a ground texture and wanted to add a variety of rocks in the dirt, would it be more efficient to have a tilemap with different rocks drawn on each tile, or one tilemap tile for just the dirt and have separate rock sprites placed over top?

  • Hi Ashley, I had a question about draw calls.

    You mentioned that each alternating tile would have a separate draw call.

    So, if we had a ground texture and wanted to add a variety of rocks in the dirt, would it be more efficient to have a tilemap with different rocks drawn on each tile, or one tilemap tile for just the dirt and have separate rock sprites placed over top?

    This is a great question; I'd also love to hear more about this. I've been using large, layered, mostly transparent tilemaps, painting unique details onto a "base" tilemap, and getting really high CPU usage.

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