Nerdy Hopscotch Questions - Coding Megathread

Please read the topic before asking questions here! :zap:

If you’ve been using Hopscotch for a while, or you’d call yourself an expert, I encourage you to watch this topic so that you can help whoever here has their weird questions!

This topic is dedicated to obscure uses of the Hopscotch engine! Here you can discuss very nerdy, specific or niche functions of Hopscotch, like memory management, weird bugs, JSON oddities or other interesting-but-niche mechanics that let you debug and plan your code better.

I made this topic because although it’s easy to ask a really niche question in YCTAYHCH, it’s very likely to be drowned out by other conversations, and would never get answered.

Also, the “Debug my Code” category can generally end up with pretty simple questions from new users, which can drown out the category.

What shouldn’t I ask? :x:

Any common question that most people could answer would not fit in the context of this topic. Also, keep your question specific enough to be considered niche.

So what counts? :white_check_mark:

You should ask questions that are specific to the engine, which are questions weird enough to be considered niche.

Don’t ask these sort of questions:
:x: How do I use variables?
:x: How does sine and cosine work?
These questions are for common uses, and can be answered pretty quickly in YCTAYHCH, or around the forum!

These questions are fine:
:white_check_mark: Using math, can I abuse local variables and sine/cosine to optimize clone spawning for my game?
:white_check_mark: Is there a straightforward way to make clones copy one another without needing to multithread (or create a lot of first-frame conditionals) for property setters?
These questions are pretty complicated, and if topics are made for them, they might get easily missed by those who might know the answer.

15 Likes

So here’s my first question: Memory management and performance is weird in Hopscotch. And it’s hard, too, because there are a lot of caveats.

I had a couple of things to ask in this regard:

  • When you destroy a clone, does it become completely destroyed in the project, or do you need to reload the project for a fresh copy of it?
  • Do Repeat forever loops within destroyed clones affect performance?
  • What about Repeat forever loops (or events) that set variables or check if conditionals? Do these affect performance?
  • Are event loops generally faster than Check if or Repeat forever loops?

A lot of this I need to test on my own, but any insight would be highly appreciated!

8 Likes

Ok destroying a clone only destroys it in the instance your running.

Tested this out and nope!

No as well!

Repeat forever actually worked faster for me

3 Likes

Thanks!! What was the code you ran in the loops?

Maybe it depends on that? I think I’ve generally had faster response time on the event but I can’t remember what I ran, lol. (I’ll need to dig back into Yukon’s code…)

3 Likes

3 Likes

Ah I see! (Personally, I use Set Position and Set Angle instead because they’re easier to control.)

For those sort of blocks I feel like it would be harder to test because they’re not ran on a frame by frame sort of basis, and they block the next operation once ran. That’s kinda where my question comes in play, because I feel like one of the repeat loops take longer to run a single frame in some cases.

Sorry for being so technical, so many other habits are kicking in from other programming languages right now lol

I should probably come back with some of my own testing too though!

3 Likes

Thats why i did it to see how fast it would be without changing speed

2 Likes

I have a question: why are strings that contain only numbers, not any letters or space, limited to 23 digits?

2 Likes

Wdym can you add more detail or an image

1 Like

theyre not strings, theyre number (11, 826, -2, etc) and they have a length limit [1] which is probably what you mentioned.


  1. maybe javascript limit? not sure ↩︎

1 Like

Ok, let’s say I’m making a semi-auto pixel art, and I just copied out the string, and used something to remove all whitespace, and copied it directly into Hopscotch, why does it become only 23 digits and it is not the original string

2 Likes

editor or player? if it’s editor, it’s a bug, and if it’s player, it’s what i said 2 posts above

2 Likes

Aah! That makes so much sense! The number would be e+ and would not work

3 Likes

yeah it turns into an exponent

2 Likes

after some coding experience, i found out that we need to add an empty wait (0) after a destroy block or the block after it will be run

3 Likes

I don’t have a project on hand, but something you can do is explore the main variable in the browser console while the project runs on a computer. That should be able to answer some of those questions

Depends on the loop – some like device press I think are limited to 30FPS, but game playing I think is 60. I’m not super involved in the player, so I wouldn’t know other performance differences right now.

Very much. Removing the canvas, or even the frame, doesn’t seem to ever fully reset the tab memory to what it was before that. To be honest though, maybe something isn’t being garbage-collected when it should be though.

If they don’t exist on stage, theoretically nothing would have effect. If they do, Set Text would have the largest impact I would imagine.

I think I remember that… there’s also some weird behavior that occurs when you run two or more destroy blocks on the same frame with invisible objects.

4 Likes

Hmm… memory leaks? :thinking:
That does count as a memory leak right? lol

Hmm, actually do you think that’s related to the SVG engine? Maybe Set Object (changing the shape for example) has the same performance hit?

(I’m actually now wondering if new SVG text objects are instantiated every time behind the scenes, or if they just change text contents. I’m guessing i uses <svg>? I would hope that it’s the latter…)

I’ll definitely need to mess with projects in the browser console a lot more.

3 Likes

someone ready to test that out?

3 Likes

Already have before, I pretty sure I did z index 99999999 before it womped!

1 Like

Welp now i know the best way to have intentional lag (not that i want it)