Limitations always make me think about breaking them, and when last time I realized that you can “load()” cartridges while your program is running, that seemed something exploitable :)
So here is one way to circumvent the limitations somewhat: You can only fit one “fullscreen” picture in the gfx space in pico-8 - BUT the cartridge change and load is fast (at least compared to changing a physical cartridge :) ) so what if I put more pictures my program need in other cartridges, and load when I need?
Turns out it can be done. :)
Here is a demonstration: a “fullscreen” anim player. It reads the frames from the cartridges in the “frames” directory, and copies the contents to the screen.
It is not that fast as I hoped to be, but it is still useable. It plays an animation with no problem, and with some planning it should be useable for other purposes too (while something else is still happening on the screen, like a game for example :) )
As the screenshot shows: it consumes 96% of cpu time, but only in the frame when the load and refresh happens. (I refresh every third frame, that’s how the average is around 32% - two frames with zero cpu load, one with 96%).
In theory you could spread the cartridge load and the refresh to different frames, but unfortunately the load is not “silent” (it prints a message to the screen), and that scrolls/writes in the picture. I couldn’t come up with a way to hide that yet, but the separete load/update lowers the max cpu usage to 49.6% (the average is stays the same, because now we have one frame with zero, and two frames with roughly 49%).
But of course an animation player is really the stress test of this technique. Apart from… you now, actually playing animations (like intros or something) you don’t really need to refresh that fast probably, and loading data from other cartridges can be used a number of different ways: backgrounds for an adventure game or transition screens, or replacing the tileset for an another world in the game, etc.
I have the sample for you to download (I don't think it will work in the web player), but it seems that I can't post any links in this forum, so please go to my blog post on tumblr and download from there if you want to check it out: http://blog.ccatgames.com/post/118623662172/still-playing-with-pico-8-limitations-always-make
[Please log in to post a comment]