Building a Game (Engine) w/ Pixel Simulation in C

Поделиться
HTML-код
  • Опубликовано: 12 дек 2024
  • "Nobody said it was easy"
    Coldplay, The Scientist
    Signup for updates and/or support the project: colbyhub.com/
    Play my falling sand game, Pocket Dust: colbyhub.com/p...

Комментарии • 34

  • @xoxogamewolf7585
    @xoxogamewolf7585 2 месяца назад +5

    *appears*
    *posts a video*
    *disappears*

  • @hiimpaco9743
    @hiimpaco9743 6 месяцев назад +5

    On the how cool is this = falling boxes = dopamine . you earned my follow and love !

  • @scottcastle9119
    @scottcastle9119 Год назад +13

    Making a game engine is the ultimate passion project, I’ve entered in this space myself, but I’m having someone else build it for me.

    • @colbyhub
      @colbyhub  Год назад +3

      Totally! Why the move to have someone else build it?

    • @scottcastle9119
      @scottcastle9119 Год назад +2

      @@colbyhub I can’t code lol

    • @ThatMathEnjoyer
      @ThatMathEnjoyer 3 месяца назад +1

      ​@@scottcastle9119 just start off with something simple like lua in pico8 for example and move when you want to have more power.
      I started at the beginning of this week and I have a very basic physics engine up that bounces balls arround and has them collide.

    • @austinmontgomery6683
      @austinmontgomery6683 2 месяца назад

      @@ThatMathEnjoyer pico 8 is such a killer tool for learning game development stuff

  • @luan1177
    @luan1177 7 месяцев назад +2

    I really appreciate this idea man, i aways loved to see sand falling, and mixed with rigid body physics objects and stuff its just so cool, even tho theres 2 years we dont see progress, i hope one day you come back somehow.

  • @tarvankrieken
    @tarvankrieken Год назад +8

    I need more of this in my life

  • @Roanokekidstech
    @Roanokekidstech 8 месяцев назад +2

    I would love seeing more of this

  • @FlygarN338
    @FlygarN338 2 месяца назад

    Dude, im on the same journey!!! Glad to see someone in the same crazy fun and demanding situation 😅

  • @JaredQueiroz
    @JaredQueiroz 2 месяца назад

    3:40 thats beautifull man.... I have my wallpaper

  • @kiririn39m8
    @kiririn39m8 11 месяцев назад

    another flex project, nice!

  • @evprkr3914
    @evprkr3914 8 месяцев назад +1

    Man I gotta know how you got the physics bodies interacting with the pixel simulation, because I’m stuck on that exact thing!

    • @colbyhub
      @colbyhub  8 месяцев назад +1

      Hey! I have the source code up over here: git.sr.ht/~colbyhub/ampersand , my memory is a bit foggy, but it's something like "once per frame, after the physics processing and sand processing, see if any 2D bodies overlap any of the sand cells -- if so, then fling the sand randomly out of the way". The Noita GDC talk also is a good resource!

  • @psyker4321
    @psyker4321 Год назад +4

    Hey man, you have a discord or something we could join? Just delving into multi-threaded C programming and this peaked my interest. I have experience building a similar 2d physics simulator in C++.

    • @colbyhub
      @colbyhub  11 месяцев назад +1

      Hey! Thanks for asking! The project has been on a hiatus due to other competing projects and life changes, but I've considered starting a Discord for this and other projects if folks are interested -- nothing at the moment, though!

  • @EndlessEnergy
    @EndlessEnergy 2 месяца назад

    Too late, I got lit AF.

  • @christojojo4433
    @christojojo4433 7 месяцев назад

    I would like to see this physics engine support periodic table

  • @tundera1297
    @tundera1297 4 месяца назад

    music used in the beginning please

  • @emoneytrain
    @emoneytrain 11 месяцев назад

    Flippin’

  • @mmy4328
    @mmy4328 2 года назад

    Great work! I'm also working on a sand simulation game.
    After reading your source code, seems you are iterating the cells one by one in every tick.
    I wonder if you have considered "only update the cells (and its neighbors) that were updated in the previous tick".

    • @colbyhub
      @colbyhub  2 года назад +1

      Thank you! That's a really interesting idea! Yes, I am currently iterating over the whole grid, but exiting early if it's "air" or was updated this tick already. This makes reasoning about cell positions on the screen and in-memory very easy but still requires a large number of calls. Using your suggested method, do you think we could make less calls? What would be the best way to store that information?

    • @mmy4328
      @mmy4328 2 года назад

      @@colbyhub I just store the cell objects in a HashSet in each iteration:
      In the very first tick, I put all the cells into the HashSet; in the second/later ticks, I iterate through every cell in the hash set, update them, and put them back into the hash set if they've changed.
      To improve performance, I also needed to override the hashcode() function for my Cell (something like hashcode = x + y * maxHeight) to avoid hash collision in the hash set.
      One caveat of this approach is that since there are no ordering in the Hash Set, we cannot guarantee "the lower cells will get processed before the upper cells". I guess I can use Sorted Set to keep the cells sorted by their Y coordinate, but it'll definitely hurt performance. So far Hash Set seems working for me.
      I think this approach will have better performance if the entire grid is relatively "quiet" - if the grid is super busy all the time, then we better off iterate through every single cell in every tick.
      I'm also exploring integrating rigid body physics into the sand simulation (I think the "main stream" way is to use a physics engine like Box2d and then synch the rigid body into the sand simulation). Your approach of implementing the physics in the sand simulation will definitely out perform them and will scale better.

  •  Год назад +1

    Pixels, projectiles, effects? Reminds me of multiplayer 2d game Arcanists

  • @TheGroszber
    @TheGroszber 8 месяцев назад

    Hy if the project is open source, can you post your github link? Thx!

    • @colbyhub
      @colbyhub  8 месяцев назад

      Hey! You can view the source here: git.sr.ht/~colbyhub/ampersand I haven't updated it for a while, but hope to get back to it someday!

  • @DylanFalconer
    @DylanFalconer Год назад

    Cool! Are you still working on this?

    • @colbyhub
      @colbyhub  Год назад +2

      Hey thanks! It was put on pause for a season (attempted to start a separate SaaS business), but I've recently picked it up again and have started on the harder parts (like implementing a marching square algorithm to generate physics bodies for sprites on-the-fly) so hoping to make a follow-up when there's more to show haha
      Also, I recognized your name from when I was researching ECS, thanks for making that video -- it was helpful!

    • @DylanFalconer
      @DylanFalconer Год назад

      @@colbyhub Oh that's great, I'm glad you found it helpful. I wish you good fortune with your business! Looking forward to the updates :)

  • @josecarmona5959
    @josecarmona5959 2 года назад

    Like!

  • @Matteus88
    @Matteus88 2 года назад

    First!