Spent this week making a little Worms/Scorched Earth terrain demo. Tried making one of these with my first ever #pico8 project and ran into massive performance issues due to using pset.

This uses tline and a 2D array of vertical slices. Destroying the terrain earth shrinks a slice, or cuts/slices it into two. Perf is good, as terrain is destroyed, there are more slices, but less to draw! Second gif shows this in action.

Code/cart is here https://www.lexaloffle.com/bbs/?tid=140579

Tline Terrain Demo (Worms/Scorched Earth terrain)

@Powersaurus that's really cool, I always bruteforced it and wondered what would be the optimal solution.

@mantis thanks!

I'm not sure it's necessarily optimal, but it's much, much faster than a 2D pixel array and pset (was this similar to what you tried?) that I tried 7-8 years ago. It leans on pico8 having a large amount of lua memory available, and tline being quick

Interesting discussion in the other replies about various approaches and pros and cons, I hadn't thought of til today .