Live data from Hacker News

Fireflies

ncase.me

51–60 of 93 posts

Re: Fireflies

#51

Nature has the best algorithms, don't it folks? I have a question about a detail. The rule is: 1. When you see a nearby neighbour flash, nudge your own clock forward. 2. That's it. My question is -- when the fireflies are firing at the same time, they see each other flash, so they all nudge their clocks forward, correct? Assuming they don't nudge their clocks forward at the same amount, they would fall out of sync, c…

> If you see a neighbour nearby flash, when you are not flashing, nudge your clock forward by a bit. I think this is it. There could be some missing detail (e.g. a firefly is unable to "see" when it flashes) which keeps them from nudging their clocks once already in sync

This reminds me of collision detection algorithms for wireless antennae. You can't 'hear' when you're transmitting, since your own signal drowns out anything you might receive (for simple antenna arrays) - I imagine the same is true for fireflies.

Re: Fireflies

#52

What an extremely nice interactive read. Works good on mobile. And it applies the biological lesson to human life, which is a nice way to finish a sermon. Article. Well done.

Yup ditto. A quick superb from me

Re: Fireflies

#53
Kind of curious how it works, when you inspect it, there's just a canvas, the fireflies don't seem to be individual, so no sense of "objects" or "individual entities"

open source time to read

but with regard to say if it was a real-time rendered animation, then calculating the point of origin and affecting the nearby fireflies... hmm

the view clock part was particularly impressive though I could see it as a state thing, still so many of them on the same page, not crashing the browser or something interesting. Maybe I'm over thinking it.

edit: I didn't look at the scripts though below the canvas.

Re: Fireflies

#54
post #45

Nature has the best algorithms, don't it folks? I have a question about a detail. The rule is: 1. When you see a nearby neighbour flash, nudge your own clock forward. 2. That's it. My question is -- when the fireflies are firing at the same time, they see each other flash, so they all nudge their clocks forward, correct? Assuming they don't nudge their clocks forward at the same amount, they would fall out of sync, c…

Nudge the clock "forward", not increase speed. So the overall frequency will be a little higher, but it won't keep on increasing

Exactly. For anyone having trouble, just picture a pure sinusoidal signal, flash = sin(2π·freq·time + phase). Fireflies are changing their phase, not their frequency. Completely independent parameters.

Re: Fireflies

#55
post #42
post #5

I think the example works more quickly than it should due to the line "if(ff.clock>1) ff.clock=1;" Every time the clock goes over 1, wouldn't you mod the clock value, not set it to 1 exactly?

No, partly because fireflies take a certain amount of time to "charge" so jumping mid cycle might not be plausible physically. So what this line does (which is in the section of code where a flash alters the fireflies around it) is that after advancing the other fireflies clocks, if any are over 1 then it puts them in the right state to flash on the next time they're evaluated. If you mod it, then you would have the…

If the fireflies take that time in their clocks to "charge the light", could it be that when they nudge their clock once or more in the cycle, the intensity of the light is a bit lower than it would normally be?

Re: Fireflies

#56
post #53

Kind of curious how it works, when you inspect it, there's just a canvas, the fireflies don't seem to be individual, so no sense of "objects" or "individual entities" open source time to read but with regard to say if it was a real-time rendered animation, then calculating the point of origin and affecting the nearby fireflies... hmm the view clock part was particularly impressive though I could see it as a state thi…

Canvas is pretty performant. WebGL is even more performant. You can easily have a few thousand things on the same page at a time.

Re: Fireflies

#57
post #56
post #53

Kind of curious how it works, when you inspect it, there's just a canvas, the fireflies don't seem to be individual, so no sense of "objects" or "individual entities" open source time to read but with regard to say if it was a real-time rendered animation, then calculating the point of origin and affecting the nearby fireflies... hmm the view clock part was particularly impressive though I could see it as a state thi…

Canvas is pretty performant. WebGL is even more performant. You can easily have a few thousand things on the same page at a time.

They have states right? I'm curious how that is like a JSON string or something to access each thing and change individually? I can go read haha

Re: Fireflies

#58
post #54
post #45

Earlier quoted context omitted.

Nudge the clock "forward", not increase speed. So the overall frequency will be a little higher, but it won't keep on increasing

Exactly. For anyone having trouble, just picture a pure sinusoidal signal, flash = sin(2π·freq·time + phase). Fireflies are changing their phase, not their frequency. Completely independent parameters.

So the frequencies of the fireflies need to be pretty close to the same. How close are they actually?

Re: Fireflies

#59
post #14

Parable of the polygons is extremely questionable. For one, it attempts to have its cake while eating it too, by pretending it's an abstract demonstration about choices while explicitly calling out to hot topics in diversity, implying a clear causal link. For another, the model involves discrete agents on a discrete grid making decisions based on their immediate 8 square neighborhood, with no persistence or hysteresi…

There's a LOT of hysteresis. Polygons stay in place unless sufficiently unhappy.

Re: Fireflies

#60

Yay ncase did it again! Don't forget to (re)view his project on The Parable of the Polygons: https://news.ycombinator.com/item?id=8716538 Playable posts are amazing. Interactivity in texts is amazing. <3

Wow, really great - thanks for the link!
Post reply on HN