naychrist Posted May 31, 2023 Share Posted May 31, 2023 (edited) hi all, I am trying to optimise a game using pixi. at the moment I have tens of players on screen firing bullets at each other, which knocks a few frames off the frame rate. The bullets are currently created by drawing a circle inside each bullets own PIXI.Graphics object, which I assume is inefficient. I have since created an image file to tint and render for each bullet but creating a sprite of this texture for every bullet seems like overkill. Is this the best way to do it and if so how best to load the picture once then copy to all the sprites? I assume there is no pixi way to bind the texture once then draw repeatedly? Ages ago when working with c++/opengl I would have done this using point sprites although I realise shaders are the preferred approach now. any advice on the pixi way (or other ways) to do this would be appreciated! EDIT - have ended up create one PIXI.Texture and then create a sprite per bullet passing this into the constructor. This has helped my performance but if any other tips I'd love to hear them! Maybe I'm over thinking this if pixi is doing batching etc under the hood. Edited May 31, 2023 by naychrist 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.