Stayed up late last night (5hrs past normal bed time! 😅) hacking on some #pico8 #GameDev - trying to emulate an infinite scroll map while minimising CPU operations.
Got it working about 90%, but I think I've got some off-by-1 errors cropping up.
Current approach is to use 32 map tiles (2 screens worth), and move the camera modulo screen height within that area. At the same time; generating new map data on demand "ahead" of where the current camera window ends.
First pass was very convoluted, but second pass has considerably cut down the complexity. I wonder if there's an even easier way to do it all?
https://github.com/jesstelford/icy-8/blob/infinite-levels/main.lua#L307-L328 (see comments at the top of the file for a diagram).