crowbar Posted March 29, 2015 Share Posted March 29, 2015 (edited) I'd like to have a running character leave footprints in the ground, but I want it to be efficient as possible and I'd assume that making a keeping track of a new image for each footprint would be inefficient. My idea is to have a big transparent texture that covers the whole level and just modify certain pixels of that texture. How can I do this in Pixi? Or, is there a better way to solve my footprint problem that I haven't thought of? Thanks! Jordan Edit: It looks like it might be possible with this: http://www.html5gamedevs.com/topic/667-question-pixel-array-render/So I guess my question now is: In terms of efficiency and I approaching this problem the right way, or am I going in the wrong direction? Edited March 29, 2015 by crowbar Quote Link to comment Share on other sites More sharing options...
agamemnus Posted March 29, 2015 Share Posted March 29, 2015 I think it is better to just use sprites and remove them or add them as needed. Otherwise you'll need to create a texture for the entire screen and keep modifying its pixels. That is somewhat slow and takes a huge amount of video memory. Quote Link to comment Share on other sites More sharing options...
xerver Posted March 30, 2015 Share Posted March 30, 2015 Yeah honestly just a bunch of sprites is the way to go here. Quote Link to comment Share on other sites More sharing options...
crowbar Posted March 30, 2015 Author Share Posted March 30, 2015 Hmm, okay, I'll have to stress test it. I was hoping for a lot of permanent objects and I'm worried using them all as sprites would be too expensive. Quote Link to comment Share on other sites More sharing options...
xerver Posted March 30, 2015 Share Posted March 30, 2015 We can renderer ~100k moving and rotating sprites in webgl with no perf degradation as long as you batch properly. I wouldn't be too worried about it. Quote Link to comment Share on other sites More sharing options...
crowbar Posted March 31, 2015 Author Share Posted March 31, 2015 We can renderer ~100k moving and rotating sprites in webgl with no perf degradation as long as you batch properly. I wouldn't be too worried about it.Doesn't batching only work if its the same sprite tho? What if I want to use sprites of different shapes or colors? I guess http://www.goodboydigital.com/pixijs/bunnymark/ kind of answers my questions. My real purpose is to make a particle engine with persistence. I had no idea 100k sprites was possible. Here is another scenario. I want my character to eject shells when he shoots his gun and I want the shells to stick around until the level ends. Based on your answer I should be able to have thousands and thousands without there being any problem? I notice that the bunnymark uses a "Particle Container" but I can't find any documentation on it. I can't even find it in the files used for the bunny mark. What is it? Quote Link to comment Share on other sites More sharing options...
xerver Posted March 31, 2015 Share Posted March 31, 2015 Batching works if it is the same *base texture* meaning the same base image. I can have all the sprites in my game in a single image spritesheet, and they will all be batched. The ParticleContainer is a new v3 container that enforces a single layer of children, and uploads specific properites of those children to the GPU where all the transforms occur. It is a super fast way of rendering sprites that share a common texture, and only need basic transform updates. http://pixijs.github.io/docs/PIXI.ParticleContainer.html Quote Link to comment Share on other sites More sharing options...
crowbar Posted March 31, 2015 Author Share Posted March 31, 2015 So if all sprites come from they same sprite sheet, then they can all be batched under the same container? Quote Link to comment Share on other sites More sharing options...
crowbar Posted April 1, 2015 Author Share Posted April 1, 2015 I was finally able to build PIXI.js manually (confusing since there is conflicting documentation, but no ParticleContainer exists). Why is this? P.S. The build instructions are different on GitHub verses your documentation:https://github.com/GoodBoyDigital/pixi.js#how-to-buildhttp://pixijs.github.io/docs/index.html#toc6 Quote Link to comment Share on other sites More sharing options...
xerver Posted April 1, 2015 Share Posted April 1, 2015 Because the master branch is v2, you need to checkout the dev branch for v3 (which is the docs you linked). If ParticleCOntainer doesn't exist you built v2, which is not what you want. You can also just use the shipped built files instead of building yourself: https://github.com/GoodBoyDigital/pixi.js/tree/dev/bin Quote Link to comment Share on other sites More sharing options...
crowbar Posted April 2, 2015 Author Share Posted April 2, 2015 Oh! Okay that makes a lot more sense! Thank you 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.