TrippyTouch (cricket rings)

helpwithcode

#1

So, i have a question for anybody who is wiling to run another experiment with me. It has to do with the behavior of a piece of code that I was working on for a fun drawing pad - kind of like the hundreds of twisty emoji wave drawing pads that we have seen published, but different.

Here is the link to the code:

Crickets:
https://c.gethopscotch.com/p/xilfhh9qm

Alien Music:
https://c.gethopscotch.com/p/xio2g2ic7

Droid Bubbles:
https://c.gethopscotch.com/p/xio49gvjg

Heartbeats:
https://c.gethopscotch.com/p/xipyvkops

Magnetic Tempest:
https://c.gethopscotch.com/p/xio5ws8o0

And here is what I'm seeing on my iPad2 running the latest version of Hopscotch under iOS 9...

So, as with any drawing pad, you can make curves and dots. And, if you use clones, you can do animated effects. That's what I decided to do. And it works just fine, at least for a while. But then I noticed that the timing of the animation started changing. In order to understand how it was changing, I decided to add a sound for when each animation loop restarted. I chose crickets. It's not like we have a lot of sounds to choose from, and we can't make our own. But with the crickets chirping, the effect was really trippy. All the cricket sounds started synchronizing. That's funny, because that's what those bugs really do in nature.

But here's the thing: as far as I can tell, there's nothing in the code that should make that happen! The timing of every point or point on a curve is completely independent. You get to choose that at random. So it's completely "asynchronous". But when I wait a while, all of these asynchronous things start syncing-up.

So, what I'm looking for are the answers to two questions, and I'm going to create a poll for one of them: (1) Do you see and hear the effect on your device? And (2) Do you have any idea why it might be happening? Please take a look at the code, and give it some thought.


#2

Also, this second post will be the place for the poll, in case I have typing mistakes in the opening post. I always make typing mistakes on this silly iPad. And the forum won't let us edit the text in a post that contains a poll, for some reason.

EDIT: I don't know what's up with this business of being locked-out of editing text that accompanies a poll, but it happened again, so this second post had to be abandoned and a third one used. Sorry.


#3

Right, so here's the question / poll:

  • Yes, the crickets and rings eventually synchronize. Whoa... why?!
  • No, the crickets and rings do not synchronize on my device. Meh... whatever.

0voters

Thanks.
oio


#4

I saw your alien one and it works now! I really like it!


#5

Thanks. But any guesses, as to why it is synching-up like this?

I mean... If you make a pattern of dots with random timing, they all still eventually converge! At least on my device they do. It's cool and all, but it is actually interfering with something else that I was trying to make! Besides hard-coding random delays, I don't know how to make it quit doing this. :stuck_out_tongue_winking_eye:


#6

Sorry I couldn't participate in your "experiment" earlier, I was at school :stuck_out_tongue_winking_eye:

That IS weird..something always has to happen when you make something, huh @oio? I don't see why I would sync up, as the code doesn't have any values or anything that would change the time.

I'll look through the code some more and I'll tell you what I find.


#7

I think I have figured this out. And it's kind of... neat.

Neat and trippy! :sunglasses:

I think the explanation has to do with how Hopscotch runs independent processes on our iDevices. Independent processes like clones that do stuff. Though independent, each ring animation (and sound) has to use whatever CPU resources are available. Each cloned, noisy instance has to fight with the others for attention (execution cycles). But there's another important part to this. It's the fact that each loop has a hard or busy part and an easy or idle part. In my code, there's a make-some-noise-and-animate period of time, and there's a more-or-less do-nothing part of the loop for each ring. So, if any single instance (clone process) is out of sync with the majority, that instance is getting held back by the load on the CPU due to the others. It literally slows down, because the CPU in an iPad or iPod or whatever doesn't really have infinite cycles per second to offer. If it did, I don't think we'd see and hear any effect. Eventually, the out-of-sync instance of a cloned, animated and noise-making object gets slowed down by all the others to the point that it is no longer leading (or lagging) the other instances in time.

So what you get is something i hadn't ever considered before in computer code execution. And it's kinda cool. Abstract, but cool. It's essentially a computational coupling mechanism between otherwise independent, cyclic (repeating) processes that acts like a potential well (like a bowl with marbles in it) with a restoring effect, similar to a bunch of springy things tied together by some common structure. It's a resonant system. Resonant bits of code. How crazy is that?! Well... Of course they are. Every cloned loop is identical. So they all have the same time characteristics. Given limited resources, they "want" to sync up, unless we deliberately mix them up with something that randomizes their timing.

Ok, this whole thing was random. Sorry. I hope at least somebody got something out of it! :blush:


#8

@oio, thank you for inviting me, I can help sometimes, just mention me @Phase_Studios.


#9

Your votes are 50-50.

Sorry @oio but it didn't work for me.

  • Hey, me too!

  • wut r u talking about it wirked

  • Who cares? YOM KUPUR 4EVA!! NO SCHOOL

0voters

You may choose up to 3 options.

Okay now this is gonna be funny poll results. :yum::sweat_smile::heart_eyes:


#10

Can I help? It seems really cool @oio


#11

Hey @oio, my sound isn't working so I don't here the synchronization, but it sounds good to me. -Gavin's Games


#12

So, i'm curious, @H4x0r... what device are you running on? Also, sometimes, you have to wait quite a while, before it locks-on and syncs-up.

If I was going to guess, it would be that you have a newer iPad with a faster processor. If that's the case, and if you really don't see the synchronization happening, then that would match my guess about how this hapens at all on mine and some others' (slower) devices. It seems to depend on how taxing the part of the cycle that does the animation is.

I have no way of knowing, but I would also guess that most of the people who did not see the effect didn't wait long. It can literally take minutes. I think it depends on how out of sync the original points were. Also, you have to make somewhere between 4 and 10 rings at least, but not like a hundred. When it works, the resulting sounds are really TRON / Transformers-like.

Anyway, like your poll implies, not everyone is likely to get why this is interesting or to care. For these, I can do nothing... :sunglasses:


#13

I'm running on iPad. Also, click here to view the post where you confessed this was random and someone got something out of it. Sorry for the offense! So it didn't work for me, and I think that's why.


#15

No offense taken. Not at all, particularly where none is intended. I appreciate the attention to my query. I was simply agreeing that you are probably on the mark with your "Who cares? YOM KUPUR..." poll injected into my thread - acknowledging that my question is a bit esoteric. Yes, it is. Like just about everything else at some point in time. At least my interest and intentions are genuine.

My confession, as you describe it, is that this phenomenon kind of came-up unexpectedly for me - hence, randomly. I guess I could've picked from any number of other words to better convey my meaning. It's an outlier. It's a surprise. It's ghost-in-the-machine stuff. It's a behavior we don't explicitly code for. It just happens (or, as in your case, evidently, doesn't happen) on its own, or it only happens some of the time... like other seemingly "random" phenomena. And, as such, it's a thing not likely to be of mainstream interest in this community. After all, the center of the zeitgeist, here, isn't intensely academic. And that's okay. But one never knows...

That said, @H4x0r, you seem to be the kind of coder whom i would expect to get his or her mind around something like this and to figure out a way to actually exploit it. Am i misreading you? I mean, an account with the H4x0r name (and a cookie emoji) is full of remixes of cool material that bears similarity in some respects. I enjoy the stuff you seem to gravitate towards. I wish it were feasible to collaborate in this strange corner of the space, whether this particular topic is all that good of a fit or not. There are just a few coders who can pull it off.

By the way... exactly which iPad version are you using? And have you tried again? And, if so, still no synchronization? Hmm. Thanks, i think. :sunglasses:


#16

I'm gonna have to get a dictionary here. :yum: