Results 1 to 6 of 6

Thread: Simple falling sand game in Pascal?

  1. #1

    Simple falling sand game in Pascal?

    Hi all,
    I have looked at the falling sand game here http://chir.ag/stuff/sand/ and I was wondering how on earth you would code something like this?

    I want to start simple and only make particles fall and be constrained by walls like in this game, but I wouldn't know where to start...

    Anyone have any ideas?

    EDIT:

    I did find these links after some more googling:

    http://www.piettes.com/fallingsandgame/index.html - C++ Falling sand game
    clone
    http://www.piettes.com/fallingsandgame/download.html - sources and binaries for C++ falling sand game clone.

    Cheers,
    Paul.

  2. #2

    Simple falling sand game in Pascal?

    No ideas how to make it - but it it is really cool once you work out what is going on
    The views expressed on this programme are bloody good ones. - Fred Dagg

  3. #3

    Simple falling sand game in Pascal?

    http://phoenix.forest-tm.com/?p=48

    So, lets start with the solver itself! I wrote SAB in Delphi, so all of the code here will be in Delphi. Don’t worry, it’s not hard, think of it as of psuedo code
    The views expressed on this programme are bloody good ones. - Fred Dagg

  4. #4

    Simple falling sand game in Pascal?

    Quote Originally Posted by czar
    http://phoenix.forest-tm.com/?p=48

    So, lets start with the solver itself! I wrote SAB in Delphi, so all of the code here will be in Delphi. Don’t worry, it’s not hard, think of it as of psuedo code
    Thanks for that link czar!! It will be very useful!!

    cheers.
    Paul

  5. #5

    Simple falling sand game in Pascal?

    You have a bunch of particles and also solid pixel map to use, or if memory and speed is not an issue it would be easiest if everything is particles. Used graphics engine don't matter much, it could be basic WinAPI, OpenGL etc. they just draw everything little differently but basic code behind is independent of engine.

    Each particle follows given laws of physics, gravity and collisions to pixelmap/materialmap, and when they make a complete stop, insert them in pixelmap and remove particle itself. Information about particle type should be later seen as color in pixelmap or a separate materialmap (just a 2 dimensional array of bytes).

    There is also a detach behaviour to clear a pixel and make it a particle again, that triggers when neigbour particle (that is up, down, left or right of it) makes a move off, or a hole is made in pixelmap. This makes solid water flow down again once the floor is removed, even if the water itself is stabilized to 0 particles and all pixelmap.

  6. #6

    Simple falling sand game in Pascal?

    Something is missing there is the electrostatic force that keeps particles together, maybe that could added to the implementation for a more realistic effect. And maybe a game could be made about picking charged particles with a brush... just an idea.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •