Lots of lag for no good eason

It would make sense for a project to lag when doing a bunch of sine and cosine equations. It would also make sense for a project to lag with a bunch of clones; but in Hopscotch, stuff only lags when you make it really really big. What’s up with that?

Your username: Yusamac205 :man_technologist:t4:

What kind of device are you using?: iPad Pro 11” 2018

1 sentence description of the problem (I was doing _________, and then __________ happened): I was making a bunch of clones of text really big and Hopscotch lagged at a crazy rate

Steps that the Hopscotch team can take to reproduce my problem every time:

  1. Make and object with a lot of clones
  2. Set the size (or width and height) to something giant
  3. Play the project
    ….

I expected this to happen: No lag

But instead this happened: Lots of lag

Here’s a sweet screenshot:


14 Likes

Alright, so I know this doesn’t look like a big deal at first glance, so let me explain:

Hopscotch doesn’t lag when I do a bunch of equations on clones or when I make them constantly move. It only lagged after I made the object bigger. This is an optimization problem with the blocks that control scale and it’s probably what lags up a lot of good games on Hopscotch

Btw, first post :upside_down_face:

7 Likes

can you link the project here?

3 Likes

It’s coming out tomorrow, but you can replicate the problem with the steps I gave.

4 Likes

its not like i’m going to steal your code, i’m just looking for reasons for lag.
here is the best problem finder.
change something in those blocks, and then play it.
if a white screen comes up, its your internet
if not, it’s hopscotch

4 Likes

Wow, you’re a good bug finder and you are exactly right, but I’ve already done that and have found the problem. It happens again even when I create a new project.

Here’s the exact code you need to replicate the problem:

4 Likes

Run an FPS counter with the code I just posted to experience the problem for yourself

2 Likes

tested, and it wouldn’t bug out if the clones are empty, if you place them with value or as an image, it lags out

seems to be a major fps drop nontheless
i guess it’s fixed, but you could always keep this topic open in case it comes back for different reason

1 Like

It only bugs out when you grow the object. The problem is not the clones, the problem is the grow block.

2 Likes

yeah, otherwise i’ve had projects handling 16000 clones drawing trails perfectly fine, so it couldn’t be the clones, but some code certain to clones

1 Like

It’s not the set position block or any equation I run on it. It’s the size. If the object is too big, no matter what code you have in it. This shows a major optimization bug with the grow block

2 Likes

correct. but i guess, logically, it proves that that was supposed to happen

see, right there in that code, that code was, uhh 1 or 2 frames?

if it had to run 1 frame 300 time, then the drop should be at least 5 fps no matter the device

draw trails don’t take up frames, that’s why bg’s are usually lag free
fun fact: for me, the drop was about 45 fps :0

1 Like

But you’re forgetting:

  1. the frame rate is consistently worse after the object grows for the rest of the play
  2. it happens even if you pinch to set size instead of using a block
2 Likes

true, true, i can’t deny that
oh no i have to go sleep its like 11

2 Likes

Merry Christmas and goodnight. We’ll figure this out more tomorrow.

1 Like

I just realized that the FPS only dropped to 45. Am I so spoiled that 45 FPS isn’t smooth enough for me?

3 Likes

The maximum is 4096, including clones

3 Likes

This is kinda late but maybe you can fix the problem by making the clones invisible until it’s done making the text.

At first I thought maybe you have an old device but then I noticed it’s not that old.

3 Likes

Nope, it lags at a constant pace for the rest of the project.

3 Likes

When you create clones in that project, is there an end? Like, does it stop when the # of clones created reach 300? I know that if there’s no limit, it keeps on creating clones until it hits the max number of objects, which can cause a LOT of lag for the entire project, even if said clones aren’t doing anything.

You can create an object that records the number of objects in the project to see if that’s the issue.

2 Likes