I can't believe it's been almost 5 years I posted that old rotoscale effect here. It's been roughly 5 years that I discovered and loved Pico8, it's a console that stuck on me and that I love to program little bits and bobs on it.
I also can't believe how far the community have gone with that small computer. Just look back and see how much projects evolved on it and how thriving it is after so long. Y'all are so productive and creative you make the BBS and the community awesome!
So yeah, after a few years, I had to touch up that old cart. It was really poorly optimized. Inspired by a few awesome devs, I used a few new tricks based on peek/poke and damn, it goes way faster than I expected. I jumped on the occasion to add translation and a small effect, just because why the hell not.
Update 2020-05-05 (or 2020-05-05 for people reading days before months)
Finally got to make it fit under the 0.2 CPU timing limitations (Post binary operations re-re-balance). Big frame time gain of ~50%.
- Increased the spritesheet to 32x32 to only keep a bitmask instead of calling FLR.
- Precomputed a 128x128 pixel map to make up for the bigger pattern (and to make a neat shifting pattern)
- Precomputed the wave effect to avoid doing the calculation too many times
- Extra color shenanigans because why not?
- Slowed down the scrolling and zooming. Bumping up the wave shift to amplify its visibility.
Nice optimizations! There's still some low-hanging fruit in here too.
- %32 can be replaced with band(n,31), or in the general power of two case, a%b == band(a,b-1)
- there are still a few divides and multiplies by powers of two that can be replaced with shr and shl
- values in sal could be negated during calculation (s would need to be inverted, but this can be done without adding an extra operation. You'd also need to invert the additions etc in _update() to have any perf benefit)
[Please log in to post a comment]