Metaballs and marching squares test

Hi there,

Been lurking in this games section, seeing all the really cool stuff for a while so figured it was time to post something.

I've been having a go at making some metaballs run on playdate as a fun little experiment. I've found plenty of really great websites about the technique but these are a couple if you are unfamiliar -

I've got the main functionality of it in C and call into it from Lua. I've done some optimising but I'm sure there is more for me to squeeze out of it.

I'm using a sprite with a draw callback so I can use the addDirtyRect functionality and only redrawing areas where the balls move.

I'm using drawLine when fill is false and fillPolygon when it is true.

So far when the balls are moving and allowed to fill the whole screen I can only get a few balls before dropping below 30 which isn't great. Perf is a bit better when when they are not filled. And when I increase my resolution value (which maybe counter-intuitively makes them look worse) then I get better perf as you can see here -


My half game idea I have won't involve the balls moving all the time though so performance wise it should be fine as they only need to recalculate / redraw when they move.

Would love any feedback or optimisation ideas.



An update - put the optimisation to 1 side and had a go at making a monster. Kinda cute me thinks.



Update - I seem to have put the game bit to 1 side and been making a blobby monster maker instead. I'm sure if I continue down this path for a bit a game will appear.




Love how squishy this is.
Cool idea!

1 Like

I've been messing around with a few things, getting some menus working and a modify / delete mode to change bits once placed.

Tried adding a limb option so you can make a section where it places balls in-between a start and end. The idea being that I can then use these for limbs and animate them.



An update

Things have changed quite a bit but nothing too major, got an outline drawing and changed a lot of how the model is created structurally which should help to simplify things a bit going forward.