Log In  

Cart #35171 | 2017-01-07 | Code ▽ | Embed ▽ | No License
6

Simple sand and water simulation.

Controls:

Button 0 = Reset
Button 3 = Spawn water line
Button 4 = Spawn sand pixel
Button 5 = Spawn sand line

Could be optimized by removing static sand and water particles from the list + optimizing the update order.

Not really much of a game yet but is fun to play around with. Thinking of trying to make a puzzle game with this involving scales.

P#35172 2017-01-07 13:51 ( Edited 2017-01-08 00:25)

Bookmarking this.

Got a grip of things I have to finish on PICO-8 before I take on anything new, but this is certainly relevant to things I want to build up to!

How hard is it to implement different kinds of liquids into this too? Like say, oil that floats (but not instantly), or ice/steam variants that interact with said stuff (like ice that floats on the water, but can be melted and added to the water)?

P#35185 2017-01-07 17:40 ( Edited 2017-01-07 22:40)

Cart #35193 | 2017-01-07 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

Hey, I made the beginnings of the UI!

Also, there's an erase tool, but if there's a lot of particles on the screen, it turns into a slideshow.

Snowy days are the best, aren't they?

P#35194 2017-01-07 18:37 ( Edited 2017-01-07 23:49)

@TonyTheTGR
Shouldn't be too hard especially if you generalize all the functions and enable depending on the material. (Water is basically sand + 3 extra functions) For liquids I would make an index of densities and based on that determine which liquid would go on top. (Water first checks the pixel below it and if it's oil you could switch their positions) The only problem is that with each addition the amount of calculations increases but at the moment you can easily spawn 2000+ particles and experience no lag and that is without optimization.

@Skyrunner65
Wow, very cool! Will make testing a lot easier. :) Thanks! Wondering why the cpu is so low when not erasing but skyrockets when erasing though. I'm guessing that for some reason the cpu is not displayed correctly when not erasing. Will check tomorrow.

Edit:

Ah, I see. Because the updating isn't done in the _update it isn't added to the cpu statistic. That's why the erasing does show up and the updating doesn't.

P#35198 2017-01-07 19:25 ( Edited 2017-01-08 12:11)

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2020-04-05 13:11 | 0.026s | 2097k | Q:37