Cloning/indexing bug in 3.19.0


#1

@Liza @Rodrigo @awesomeonion @t1_hopscotch

I’ve come across a bug in the recent update that appears to be a problem with new cloning/indexing mechanism. I’ve a project that creates 50 clones (just a simple repeat loop) then, in part, changes the object’s size as an inverse function of the native Clone Index.

Note the size difference between the last circles in the pictures below. It appears that the clone indexing is not consistent. (The image with the smallest dot is the expected outcome)

  • The project behavior only changes upon exiting the project and returning
  • The player appears to alternate between which behavior results, corresponding to the bullet above.
  • Restart doesn’t change the behavior from whichever it is at the time

The project referenced is in my drafts titled Trippy Wobble (debug)


#2

Cool :l first reply also this “bug” may just be a small problem with the clones or variables.


#3

Did you try changing the order of the blocks?
:thinking:


#4

It looks like the issue is with z index.


You can see that in this picture I switched the clones to numbers and clone #41 is in front of clone #43. If they were circles then the larger circle for clone #41 will blot out the smaller circle of #43. It’s not completely deterministic what order they will appear in. What we should have is a way to explicitly set z index. Absent that you could get around it by setting a wait proportional to the clone index and then bring to front at the end of the wait. That way the largest clone index would be guaranteed to be brought to front last.


#5

@awesomeonion Thanks for looking!

clone #41 is in front of clone #43.

I can’t actually tell that from 2 over lapping texts of the same color… But where is clone #42? Did a circle with Index #42 not didn’t get created? Otherwise the Set Position code would have positioned it between 41 and 43 (“between” meaning X/Y positions, not Zorder).

It’s not completely deterministic what order they will appear in

Well. That’s unfortunate.

I have to ask; how is the original not Index 1, the 1st clone created not Index 2, the 2nd clone not Index 3, etc?

Users can certainly set the Zorder or possibly re-index them (if it’s not a read-only property? I haven’t tested that) according to the creation order (and hence Zorder), but then I think creating an index the old, manual way would just be easier. Besides, don’t you think it’s going to be confusing to many users when the Index order doesn’t correspond to the creation/Z-order as one would expect?

What we should have is a way to explicitly set z index

Yes, that would be great! I asked Montoya & Thomas for that a while back to no avail. Actually, many users have asked for this. I recall either Montoya or Thomas saying there already is a Zorder property that just wasn’t exposed in the editor GUI, so it should be easy to add.

you could get around it by setting a wait proportional to the clone index and then bring to front at the end of the wait. That way the largest clone index would be guaranteed to be brought to front last.

Agreed, but that potentially creates an undesired “loading” delay. But I think it could be done in 1 or 2 “frames” without a Wait block. I’d have to test and confirm. But, regardless, since it’s an app intended to facilitate learning, Hops shouldn’t have to do this IMO.

P.S. Thank you for all your & THT’s effort and working to continually improve Hopscotch.


#6

@awesomeonion I don’t think the problem is that the Zorder isn’t deterministic.

I’ve had a bit more free time today then before so I took some time to try and troubleshoot. I made a copy of the referenced project: was Trippy Wobble (test)

It arranges the clones sequentially based on the Clone Index. When the iPad is tapped, it changes the circles to display the Clond Index. As you can see from the overlapping random colors, the Zorder does correlate to the Clone Index.

Once the project is loaded, it does this consistently ever time. The problem is that this correct behavior only results every other time the project is loaded.

On the alternating loads, now this version of the project is not displaying the circles at all (until the iPad is tapped, then it displays the Clone Indexes same as before)