Topic: OO stuff and frame drop
Hello! i'm having multiple problems with on my shooter project,
have a look at this Video, it's a gameplay vid of an arcade game that illustrate some of the problems i'm having.
And i apologise for my english / clarity of what i'm trying to explain. i have very hard times doing this.
I'm using the same script than Here (+ the isActive(object) for optimisation that is not present here) for all objects :
- 1 Player projectile
- 1 Ennemies
- 1 Ennemy projectile
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Problem 1 : Brutal frame drop when player is shooting fast
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
see the player shots ? i believe all single projectiles are OO items spawned every frames, right ?
If i'm trying to do this in maratis, the frame rate drop dramatically
my method :
one hitbox (just a invisible cube), and one graphic item (the projectile)
I'm joining the collision cube with the projectile graphic with :
setParent
OR
follow behavior
Both method works and the result is the same for both methods (same frame drop, no differences)
Note that :
spawning 1 bullet every frame works ok
spawning more than 1 bullet every frame result in hyper frame drop
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Problem 2 : Frame drop when two ennemies of the same type are shooting together
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
See the "tank" who's shooting green projectiles ?
if i'm spawning 1 ennemy like that, it will run ok, if i spawn 2 at the same time,
when it starts shooting even if its a very low amount of projectiles (about 10 for each)
frame drop occurs. I believe it's a similiar problem than in problem 1.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Problem 3 : Progressive frame drop when using "for i=1, #projectileList do" in the ennemy script to check whenever there is a collision between the player projectile and the ennemy
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
This one starts to freeze after some time. i would say after 20~ ennemies are spawned.
I had make sure everything in the ennemy script and bullet script
(objects, values, and extra stuff) got deactivated when a collision occurs.
When removing "for i=1, #projectileList do" from the ennemy script, frame drop is gone, but then i cant make collision between player bullet and ennemy
So right spawning multiple projectiles very fast makes the game freeze and testing collision between OO projectiles/ennemies make the game freeze
I don't know what to do, any ideas ?