Tips for a non-laggy project!

hopscotch
followforlikes
helpwithcode

#1

So, I've been experimenting with hopscotch lag these days. I've found some pretty good tips to use.

1. Don't use repeat forever

It's obvious, repeat forever is going to lag the code. For big projects, use 7=7, it helps! Or if (value) equals 1, do (code)

2. Don't use huge numbers

So, I'm talking about set speed. Some people decide to do 999999999999999, which is not going to make it any faster than 99999. So, stick with that, don't use unnecessary large numbers.

3. Try to use as little abilities as you can

Abilities lag the code a LOT, especially if you have five thousand of them. I am currently making a music project, and oh boy... It's so laggy!

4. As less text boxes as you can!

So characters, shapes, text boxes. I understand if you are going to make a password project and you'd need to cover the code, but that's probably the key component to having a non laggy project.

5. Clones

Clones are REALLY laggy, if you put too much or enlarge them. It's best to stay away from them if you can.

Thanks for reading! I hope this helps. Please comment if you have a different strategy!

  • Thanks! It helped.:smiley:
  • It kinda helped? :confused:
  • it didn't help :sweat:

0voters


Questions on how to solve lag
EP125's General Topic + Q and A [QUESTION]
How do I fix lag in projects?
#2

Good advice! You should make an Advice Column for yourself. :laughing:


#3

When I make things super duper fats I use multiplication. Until I can't any longer. I'm that type of person. :joy::joy:


#4

Thank you, @Follow4LikesOfficial. I would like to learn how you tested these ideas and found them to be true.

EDIT: I should volunteer something. I have found lag issues with (1) collision detection, where there are many bodies. Things really slow down, when there are lots of "when _ bumps _" going on, especially right before any actual collision happens. That one is frustrating. I have also had issues with (2) lots of clones, even when the clones aren't even doing anything. There may be a lag problem as well from having (3) lots of rotating bodies or (4) large, magnified bodies. The thing is, since these features make-up what I consider to be any interesting game, they seem kind of unavoidable. Is that your experience also?


#5

Or clones bumping the edge of the screen. That slows things down too.


#6

Probably just for me, but Check If Else blocks (if there is a lot) can cause a project to lag or crash. And...clones obviously


#7

It was quite simple actually. I took some projects on Game Changers, like @Magmapop's MC Sneakup, @CreativeCoder , @Rawrbear and @AHappyCoder's TOT, and some other projects. Then I tried using these rules, and they seemed to go laggy. I have two iPads, so I lined them up together, one with the laggy code, one without. The laggy project was slower, all seen by two human eyes.

Large, magnified bodies, hmmm... I haven't tried these yet, but if you want to try an experiment of your own, please do!


#8

I am using that a lot more now that I have a faster iPad :wink:


#9

Oh yes that's how It is with me!


#10

This is really cool!!!!


#11

here's a question for the hopscotch team, why can't actions be performed in-between frames? I know it is possible, (especially with simple variable changes, but I'm looking at pen) but did you purposely slow down the code in order to A: make it easier for people too new to recognize the potential of the "wait" block, ot B: to prevent hopscotch from crashing the iPads themselves, if B you have done so in-successfully, as I have made 2 projects that not only crash hopscotch, but restart the iPad, and occasionally a blue screen pops up, (for 1/4 to 1/2 second) the fourth I made was... I thought it was too powerful to publish, it successfully restarted the iPad about 3/4 of the times that I ran it, and by restart, I mean black screen, Apple logo and everything.

slightly off topic but does have to do w/ the performance speed of hopscotch


#12

Great advice @Follow4LikesOfficial!!!!!!


#13

I think it might be neat (though admittedly geeky) to create some simple benchmark code to test what is being inferred about laggy performance in Hopscotch.

I say "simple" just so we might isolate and understand culprit situations. I am confident that my old iPad would come-in dead last in any competition, but I still think a benchmark could shed some light on exactly which blocks cause others to lag (fighting for CPU cycles) or which are prone to be laggy themselves (just plain slow) on any iThingy. I'm going to have a go at it. On my platform, I already know that (1) clones and (2) collision-detection sit near the top of the list. Some of the other stuff, like repeat-forever loops, have evidently been ID'd as a problem as well. Makes sense. And that's to say nothing of what causes crashes.

Anybody got any good ideas for a benchmark? I have two of them in mind. I am thinking about timing how long it takes certain things to happen a fixed number of times... 🤔 We could compare results. Would that be fun?


#14

u should!


#15

Also, clones! Using clones lags the project a lot, let me tell you. I am making a game called Who did it? And I used: When 7=7; Create A Clone
When Character is Cloned; Set Pos to X square x position Y random 1 to 1000
It lagged .-.


#16

Cuz it's a clone :P. I'll add it later


#17

Why would 7 = 7 work better than repeat forever? Is there some code I'm not aware of?
Also, using 9999999999 does sometimes make the object do something way different than the code.


#18

Idk, but it worked better when I compared with two iPads


#19

And go to any laggy/slow game and see how slow it is when you create a new rule and do

When play button is tapped
Repeat forever
Set sound to (anything) wait 0 milli
(end)


#20

I get no credit..? :neutral_face::sweat_smile: