Lag is inevitable?

Project link: Adventures of Croton: the final destination official 3.7 by CinnabunPizza

What is happening in the project, and what do you want to happen instead? the game is lagging (clone wise) and there are only five clones and they get recycled. It shouldn’t lag after time. Am I missing something?

Screenshots of code: none needed, it is explained up ^^^ there (lmk if you need them)

4 Likes

Do the clones have when touching blocks?

5 Likes

Nope! Idk what’s up, but they multiply every game and I figured it was bc of scene change w/ the “when game starts) block, so I did the thing where when you unalive, the clones will destroy.

4 Likes

Try not repeating bring to front so much, it seems to be pretty expensive in your project so far

It seems to be completely resorting everything??

7 Likes

You know, that might be it. (Wait, how did you look at my code?)

3 Likes

I just used chrome’s profiler, and it basically looked like this:


I’m not quite sure what that means, but it looks like bring to front is the most expensive block. My more Hopscotch-specific measurer doesn’t load custom images so I can’t play your project with it so I don’t know for sure why this is the case, but it seems interesting.

I’m not sure why it’s even laggy at all, this doesn’t look too bad to me.

Edit: Also looks like collisions might be a bit of an issue too, so maybe those are the main culprit

I’m also suspicious of how long it is taking to paint, I’m not sure that makes sense…

Actually looking at it more it seems like your code is not actually the cause of the lag, it is mostly painting…

This is a particularly laggy frame:


So I guess it could be your project, but painting alone is taking almost 32ms. I’m not sure if that is for a single frame or what. I don’t know if this makes sense.

5 Likes

Hold on, I’m twelve and not so smart, what is painting if you don’t mind me asking? (Is it the custom art?)

5 Likes

I’m not entirely sure so I may be wrong but I believe it is Chrome drawing the webpage on the screen, so nothing that should really be overly affected by your code

5 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.