manelis Posted January 2, 2015 Share Posted January 2, 2015 Hello, I am using pixi on the creation of a strategy browser game map. This map was previously implemented in flash but was extremely heavy, due to the large number of objects. In My first implementation in pixi I was just using one sprite for each hexagon, city, road, etc, and was incredibly slow. However, considering that the map is mostly static and we just drag it around, I was thinking about generating textures for most of the scene nodes, which would drasticaly decrease the number of objects in the scene. Example:var texture = fow_shared.generateTexture();fow_shared = new PIXI.Sprite(texture);fow_shared.alpha = 0.7;fow_shared.position.x = jsmap.getMapXPos(jsmap.minX, jsmap.minY);fow_shared.position.y = jsmap.getMapYPos(jsmap.minX, jsmap.minY);shared.addChild(fow_shared);My question is, should I need to worry about the size of the texture created by generateTexture (and so, break it in smaller parts) or does pixi take care of it? Here is a example from the code above: The fog of war is just one texture. Considering that each hexagon is 250x172, the texture is now 3240x2236, however, I need to support much bigger maps than this. Thank you for the help. Quote Link to comment Share on other sites More sharing options...
xerver Posted January 2, 2015 Share Posted January 2, 2015 Texture size matters. Head over to http://webglstats.com/, scroll to the bottom so all the graphs load, and look at MAX_TEXTURE_SIZE. That is some stats on the largest texture size people's GPU can handle. Increasing texture size will increase memory usage, bandwidth needed to talk to the GPU, memory used on the GPU, etc. Pixi does nothing magical to break apart large textures for you, that is application specific. Quote Link to comment Share on other sites More sharing options...
agamemnus Posted January 2, 2015 Share Posted January 2, 2015 Manelis: Both your initial ideas are terrible. You should use sprites. One texture per sprite type. You should only show only a set amount of sprites on the screen, varying the linked texture as needed. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.