Skip to content
Sign UpLog In
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
24

Flurry — Enjoy a flurry of snowflakes from the comfort of your computer!

fuzzyastrocat
fuzzyastrocat

This is a very old project (like, very very old) that I decided to port over to repl for the holiday season. It's a fully computer-generated snow scene (the snowflakes are generated anew every time!). There's not a ton to say about it — it's just a nice background-esque thing with calming snowflakes drifting through the air.

Screen Shot 2020-12-24 at 11.34.14 AM

How it works

The cool part is how it's made. Each snowflake is made using a controlled particle system and then mirrored sixfold to create the nice symmetry. The method was inspired by this coding train video.

The motion of the snowflakes is controlled by perlin noise, and each has a preset "rotation offset" to make them look like they are spinning at different times.

So, go ahead and check it out in fullscreen!

Hope you enjoy!

2 years ago

Voters

Comments

TopNew
1
xxpertHacker
xxpertHacker

Seems to have poor performance.

2 years ago
1
fuzzyastrocat
fuzzyastrocat

@xxpertHacker
This is a known issue with some systems, there is a fix that I have not yet had time to implement.

2 years ago
1
DynamicSquid
DynamicSquid

Cool!

Oh, quick question about lang dev if you don't mind :)

How am I supposed to do built in classes like arrays and strings?

For example the array class has methods push, pop, etc; and to handle that, I just have a bunch of ugly if statements, but is there a better way?

I know for many compiled langs like C++, they have a basic primitive type like char*, and they they create an array class around that. But my lang doesn't have that. Should my lang have that?

2 years ago
1
fuzzyastrocat
fuzzyastrocat

@DynamicSquid
Ok, I'll handle this one at a time.

If you have builtin classes, then you need to make their functionality builtin. Exactly how you do this depends on the structure of your language, but ideally you should be able to make builtin classes just like user-defined classes would be constructed. Whether that means pre-adding objects to a list of classes, creating a new object in the global space, or however your language implements OOP, it should be able to be done just like a user-defined class would be defined. This is the "cleanest" approach.

Now, as for the basic primitive thing, that depends. Really, it's a question of how low-level you want your language's foundation do be. Do you want to have a builtin list type and then build all abstractions on top of that? An object type? A raw pointer type? It's really up to how low you wanna go.

2 years ago
1
DynamicSquid
DynamicSquid

@fuzzyastrocat
Hmm... I want my language to be fairly high level, so I guess creating a builtin list type would be the best bet.

Ugh, lang dev takes so long. I always think of something new to add or change and I can never finish!

How are your langs coming along?

2 years ago
1
fuzzyastrocat
fuzzyastrocat

@DynamicSquid
They are not! I got kinda busy, didn't have time to do it and therefore lost interest. I'll probably pick it up sometime in a week or two.

2 years ago
1
DynamicSquid
DynamicSquid

@fuzzyastrocat
Oh lol. When you get back to it, I hope they're smoother to develop than mine :)

2 years ago
1
Baconman321
Baconman321

Really slow. Otherwise, cool algorithm!

LOL I am the master of performance and yet I don't have any tips rn. I'll let u know if I have tips for performance

2 years ago
1
fuzzyastrocat
fuzzyastrocat

@Baconman321
The algorithm is inherently "slow", there's no way around that. However, it runs perfectly fast on my system. Do you mean that there is a slow startup or a low FPS?

2 years ago
1
tussiez
tussiez

@fuzzyastrocat
Most likely a loop, the tab is eating 24% of my CPU and 60% of integrated graphics

2 years ago
1
fuzzyastrocat
fuzzyastrocat

@tussiez
@Baconman
The only thing I could do to potentially speed it up is cache the snowflake image in a graphics object. The issue with this is that now there's a bunch of graphics objects which might not work at all on some systems. So unfortunately I think it has to stay as-is.

2 years ago
1
tussiez
tussiez

@fuzzyastrocat
Hmm
How exactly are you updating the snowflakes? Textures shouldn’t be an issue, as long as you use images that aren’t insanely high-res, e.g 1024x1024

2 years ago
1
fuzzyastrocat
fuzzyastrocat

@tussiez
I'm drawing the snowflakes by drawing the particles which constitute the snowflakes.

2 years ago
1
tussiez
tussiez

@fuzzyastrocat
Ah, that’s why it runs so slowly.

2 years ago
1
tussiez
tussiez

@tussiez
You’re updating all the particles

2 years ago
1
fuzzyastrocat
fuzzyastrocat

@tussiez
I'm not updating all the particles, just drawing them.

2 years ago
1
tussiez
tussiez

@fuzzyastrocat
The particles still seem to be the source of the issue

2 years ago
1
tussiez
tussiez

@fuzzyastrocat
It's a lot of particles to draw either way.. 🤷
I still appreciate the work you put into building the snowflakes "from scratch" and applying transformations

2 years ago
1
fuzzyastrocat
fuzzyastrocat

@tussiez
As I said in the post, this is a very old project. I don't have the time right now to fix it, but later I may.

2 years ago
1
Baconman321
Baconman321

@fuzzyastrocat
You could try running some of the calculations in the GPU or using webassembly...

2 years ago
1
fuzzyastrocat
fuzzyastrocat

@Baconman321
GPU wouldn't be worth it, it'd be much better to cache in a graphics object. Webassembly has nothing to do with it, it's not the calculation speed it's the render speed.

2 years ago
1
tussiez
tussiez

R e a l l y n i c e !
I s t h i s r u n n i n g @ 6 0 F P S ? I t a p p e a r s t h a t t h i s a p p i s r u n n i n g s l o w l y o n m y l a p t o p.

2 years ago
1
fuzzyastrocat
fuzzyastrocat

@tussiez
It should be, it's probably just that your laptop can't handle the rendering as fast.

2 years ago
1
tussiez
tussiez

@fuzzyastrocat
I have a pretty good laptop...

2 years ago
1
tussiez
tussiez

@fuzzyastrocat
You could add a frame counter to see if the app is actually running full speed. I would’ve forked the Repl, but I’m on my phone rn

2 years ago
1
tussiez
tussiez

@fuzzyastrocat
Okay, seems to be running good now

2 years ago
1
fuzzyastrocat
fuzzyastrocat

@ZDev1
Aww... how can I improve it then?

2 years ago
1
zplusfour
zplusfour

@fuzzyastrocat
it's very good!
I think you don't need to add something

2 years ago
1
fuzzyastrocat
fuzzyastrocat

@ZDev1
Oh, sarcasm. I see :)

2 years ago
1
kmurp62rulz
kmurp62rulz

t h i s p l e a s e s m e

2 years ago
1
fuzzyastrocat
fuzzyastrocat

@kmurp62rulz
Glad to know you enjoy it!

2 years ago
Load more