Hi guys,
I have in total around 300 entities in my scene. All of these entities need to have a ParticleVPlay, because each one can die somewhere in the scene and needs to ‘explode’ at that point.
I’ve noticed that having 100+ ParticleVPlay has a major effect on FPS. The CPU and RAM usage shoots right up and I’m unsure as to why. I’ve reproduced this with the following example (you may need to substitute the json with your own):
import Felgo 3.0
import QtQuick 2.0
GameWindow {
id: gameWindow
activeScene: scene
screenWidth: 960
screenHeight: 640
EntityManager {
id: entityManager
entityContainer: scene
}
Scene {
id: scene
// the "logical size" - the scene content is auto-scaled to match the GameWindow size
width: 480
height: 320
Repeater {
model: 300
ParticleVPlay {
id: particles
fileName: "explosion_blue.json"
autoStart: false
running: false
}
}
PhysicsWorld {
debugDrawVisible: true
}
Rectangle {
color: "black"
anchors.fill: parent
}
Rectangle {
width: 100
height: 25
color: "white"
anchors {top: parent.top; right: parent.right}
Text {
text: "Move"
anchors.centerIn: parent
}
MouseArea {
anchors.fill: parent
onClicked: scene.move()
}
}
function move() {
player.y = 0;
player.move()
}
EntityBase {
id: player
width: 25
height: 25
x: scene.width/2 - player.width
y: 0
Rectangle {
anchors.fill: parent
color: "red"
}
BoxCollider {
id: collider
bodyType: Body.Dynamic
}
MovementAnimation {
id: animation
target: parent
property: "y"
velocity: 100
maxPropertyValue: scene.height - player.height
onLimitReached: y = 0
}
function move() {
animation.start()
}
}
}
}
Press the top right button to start moving the entity. Even though the particle effects aren’t being started, the FPS has dropped dramatically. Whilst it’s running, notice the high CPU and RAM usage.
If you change the repeater model value to 10, it’s usable again.
Any suggestions to achieve what I need?
Thanks!