Recreating Noita's Sand Simulation in C and OpenGL | Game Engineering

Exploring and attempting to recreate Noita’s “Falling-Sand” Simulation from scratch using C and OpenGL.

Be sure to like and subscribe, you cool people. That way I can continue to make more vids
like this.

NOTE: There’s a typo @2:07. I wrote “bytes” when it should be “bits” for the gs_vec2, color_t, and b32 member variables for the particle struct. So the overall size should be *drastically* different (only 24 bytes in total). Sorry for the confusion!

00:00 – Introduction
00:33 – Gunslinger
00:58 – Research/Resources
01:13 – Cellular Automata
01:52 – Sand Algorithm
03:15 – Water
05:25 – Wood/Walls
05:53 – Fire
06:32 – Gunpowder/Salt/Lava/Oil/Acid
07:37 – Polish/UI/Drag-Drop Images
08:56 – Final Sand Sim Presentation / Exploding Pictures

Project source:



Get Noita:

Get Powder Toy:

Blue Dot Sessions – Lakdeside Path:

Resources Used:
Nolla Games GDC:
Noita Gameplay Showcase –
Noita Technical Explanation –
Game Of Life:
Game Of LIfe:

Stuff To Read:

Special Thanks:
Guilherme Teres from Uniday Studio:

Everyone in my Discord channel. Thanks for hanging around and being awesome.


Xem thêm bài viết khác:

Evolution Of Popeye Games 1982 – 2005
  • Thanks for this, yes a series would be awesome – really enjoyed the explanation.

  • How does your computer not crash when simulating all the tiny cells? Are you using some sort of optimization? If so which one

  • Very Epic Video!

  • Very nice video 👍, subbed

  • holy flip. with all these if monsters, how are you pulling so many fps is beyond me. great job at creating your engine sir

  • I've read every one of those articles you showed on the screen, and this video helped me actually understand it. Thank you.

    EDIT: Please make a series on your open source game library, I'd love to build somethingg similar to this for school reasons.

  • WetiuWetiu

    Author Reply

    I really want to make a isometric game but I'm just beginner with hope 🙂 no programming language experience from past, what is your advice for a beginner and I want a video about it if you mind ^-^

  • WetiuWetiu

    Author Reply

    I also wonder, what is the situation of your isometric game engine, it will release soon ?

  • WetiuWetiu

    Author Reply

    I don't even know english well but I understand what's going on :3 thanks master

  • This is one of those videos that could last days and I would still be sad when it ended

  • wow 1 dislike vs 1k like 🙂

  • I've followed your compile instructions to the letter but it wont work. It says "..source*.c" cannot be found, same with render_passes. I figured that it was too deep into the folder tree from the way the path is made, so I moved it one folder up. It still didn't work. I have the latest Visual Studio, and I used the x64 Visual Studio command prompt like asked.

  • Great video man. I found your channel from your Github. I have been looking at making a C game engine and this has provided plenty of inspiration to work from. Keep up with the videos, they are great!

  • I attempted this a while back. I can't believe I didn't try to travel to each cell along a path to handle velocity. I guess I thought it would be too taxing on my computer to run smoothly but, looking at your results, it seems to work well enough. Great video, I really enjoyed it!

  • Amazing video! I was thinking, what if instead of making the sand always fall to the left first, why not make it fall into a random available open space? Is the time it takes to compute just not worth it?

  • Awesome video. The one weird thing I noticed was you say smoke is like sand but with reversed gravity. Isn't it more like smoke is like water but with reversed gravity?

  • RJRJ

    Author Reply

    This maybe one of my favorite coding videos of all time. Very precise and very informative. Good job dude

  • Dude. Incredible. Freakin the best thing on game dev I've seen in a long time.

  • Was very interesting,even though I'm not a programmer i understood because you explained it so well

  • Sandspeil is really fun

  • can you do the nemesis system from Shadow of Mordor/Shadow of War

  • Great video keep it up!
    These are my suggestions: Fez's dimension changing
    Braid's time travel

  • Good job. Well done

  • Your particle_t is not 136 bytes, there's also a wasted bytes on padding. It is 160 bytes at best, but most likely it will be 192 bytes depending on a particular platform. But don't do #pragma pack(1) or alignas(1) in C++, because it will kill the performance.

  • That's really cool, thanks, you got a new sub!

  • On a loosely related note, it always amuses me when Game Of Life is said to have 4 rules. It's really just 2 rules:
    1- living cell survives if next to 2 or 3 alive neighbors.
    2- dead cell is revived if next to 3 alive neighbors

  • A "Sand Game" is a really nice way to put it. 🙂
    Thanks a lot for doing this. I've been really curious about Noita since I first heard about it.

  • Cool video, cellular automata are amazing.
    Just a small thing, but giving the sand a preference in which direction it falls when it collides with a sand particle below it gives it an unrealistic uniformity that the player will notice right away.

  • I would like to see more^^

  • thanks for the video and the tool john, those were valuable insights!

  • I am waiting for the next video.

  • Dude you are like the first one to call this game engineering (base on : searching in youtube) love your vid , such high quality, please make more !!!

  • Awesome information! I really fill happy and rewarded by just clicked on your subscribe button with 🔔 = true.

  • You can reduce considerably the size of the IF statements amount if you put functions inside arrays and just reference the function by its index, for example this python code:

    # predefining the functions
    def particle_smoke():


    def particle_wood():


    # distance values stored in this array (python list)

    distances = [wood_dist, smoke_dist]

    # particle creation functions stored in this array

    particles = [particle_wood, particle_smoke]

    for i in range(len(distances)):

    if distances[i] < min_dist:
    min_dist = distances[i]

    p = particles[i]()

  • Wow!

  • Is this inspired my powder game at all. I'm not trying to say you copied it. This video actually made we remember that game. Its on its the first thing you see if you just look up powder game. They look extremely similar.

  • Super cool and inspiring man

  • DavidDavid

    Author Reply

    Thanks for the video. Very interesting.

  • Come on buddy, do you even cook? I haven't seen salt float. Ever. Not once.

  • RIP John Conway.

  • Hope the notification button pays off kappa

  • I can tell you were inspired by 3blue1brown 😆

    Nice work!

  • I just found the 3brown1blue of computer graphics, and I love it.