Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] About simple and Non-Container Sprite for performance and particle system #3105

Closed
finscn opened this issue Oct 13, 2016 · 6 comments
Labels
🤔 Question User question, similar to Help Wanted or Needs Help. These can be addressed whenever someone has tim

Comments

@finscn
Copy link
Contributor

finscn commented Oct 13, 2016

The WebGL is a fast renderer , but JS is still not fast enough for thousands of sprites , on mobile especially.

If supply a simple and Non-Container Sprite , Could it supply hight performance ?

@englercj
Copy link
Member

Not sure what you are suggesting, but you can use the ParticleContainer instead of a Container and if all your sprites share a texture you will see a significant performance increase because all the transforms are happening on the GPU instead of the CPU.

@englercj englercj added the 🤔 Question User question, similar to Help Wanted or Needs Help. These can be addressed whenever someone has tim label Oct 13, 2016
@ivanpopelyshev
Copy link
Collaborator

If you have less than 5000 particles, standart container will be ok.

ParticleContainer has a limitation: you can't use more than 1 texture atlas for sprites inside, and you cant use containers inside of it.

@finscn
Copy link
Contributor Author

finscn commented Oct 14, 2016

@englercj ,

In current Sprite , if a sprite is NOT a container (most sprite is not container) ,
the code below is still run once :

for (i=0 , j=this.chlidren.length; i<j ; i++){
// ...
}

there are 4 steps :

set i 
read this.children.length
set j
check if  i<j

If you very care about function call ( is like at #3108 (comment) ) , I think you should care about these 4 steps , especially this.children.length.

I think most sprite is non-container in the game , A Sprite Class without any operation about children is a good solution.

.

@englercj
Copy link
Member

Then feel free to create a non-container sprite for your project. The core sprite will remain as-is however. We've had this discussion many times over the past years and the community wants it to be a container.

You can easily create your own sprite that doesn't inherit from container if you feel it is important for you application.

@finscn
Copy link
Contributor Author

finscn commented Oct 14, 2016

@englercj , yes , your decide is very good .
I just mean I hope could add a new Non-Container Sprite , not change Current Sprite to Non-Container .

@lock
Copy link

lock bot commented Feb 25, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Feb 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🤔 Question User question, similar to Help Wanted or Needs Help. These can be addressed whenever someone has tim
Projects
None yet
Development

No branches or pull requests

3 participants