Jump to content

Speeding up performance of many graphics with polygons


Ianmh
 Share

Recommended Posts

I'm building a tile based game, and I'm generating a lot of tiles with drawShape and polygon data and then adding them all to a container. Every tile is generated. Right now if I go larger than about 150 x 150 the app crashes with a webGL failure. Do I need to convert these to sprites or something else? Any suggestions? Also, even though there are many tiles there are a much smaller amount of variations, is there a way to copy and reuse already generated tiles? I might want to change the colour so they can't be of the same instance.

Link to comment
Share on other sites

cacheAsBitmap may be of use to you if your generated tiles do not need to change much.

http://pixijs.download/dev/docs/PIXI.Graphics.html#cacheAsBitmap

Also generateTexture.

http://pixijs.download/dev/docs/PIXI.SystemRenderer.html#generateTexture

It sounds like you are running into problems with Pixi needing to render a lot of graphics objects on the fly. Baking things into textures where possible may help with that.

Link to comment
Share on other sites

either generate textures (better in one atlas), either use one Graphics object per many tiles. Call it a chunk. Every time something updates in chunk, you have to refill it. The downside is that triangulation will be called each update. If chunk is too small => too many chunks lead too many drawcalls. If chunk is too big => update cost is high.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...