Log In  


Is it possible to link multiple .p8 file together so that I can create a single level in one file and then save a few variables, then load the next .p8 file to create a second level?

2


reload() takes an optional filename that lets you load memory regions from other carts. Using just reload(), you can have all of your code in the main cart, then load level data from other carts. Cart ROM normally stores sprite, map, sfx, and music data, but you can store arbitrary bytes and move them around with memcpy() and the like if needed. http://pico-8.wikia.com/wiki/Reload

load() is actually just the "load" command that you can type at the command prompt, and it can be called from a cartridge. When called from a cart, it replaces the current cart in memory including code and temporary RAM and starts executing it immediately. http://pico-8.wikia.com/wiki/Load

load() does not allow you to preserve local variables, but you can use cartdata to persist values associated with a key that both carts share. You'd call cartdata() with the same key in both carts, then call dget() and dset() to get and set the values, respectively. http://pico-8.wikia.com/wiki/Cartdata


That's genius, I've been wondering if you can "link" carts together to make a sort of episodic game. I think reload() might work perfectly.


That is pretty interesting to think about. Although just using load() with save data means each cart would have to have the same "primary" code...essentially duplicating your code and maintenance, less than ideal.

I'd think the reload() stuff might lend itself more to the episodic idea but is probably more complicated to implement...? Either way, interesting to consider making a game that needs multiple carts - "Insert disk 2" hehe


How does this work in relation to SPLORE? Can you submit multi-cart games?


reload() doesn't work with BBS-loaded games. They must be local files.

A player could conceivably download each of the parts of a multipart game via Splore to the local filesystem, then start the main cart from Splore using the local files category. Currently, saving a cart this way requires exiting Splore while the cart is in memory to get to the command prompt, then using the save command. So it's not exactly user friendly. But technically you can do it without leaving Pico-8.

It'd be cool if reload() and related functions had BBS equivalents that you could call with BBS cart IDs, maybe as a fallback if the file is missing locally but there's an Internet connection. But this is not currently a feature.


why not have multi-bank carts instead ?

limited to 4 banks (128k), for limits' sake. plus, loading a bank brings up a 5 seconds loading screen with raster bars in the overscan zone. maybe even draw the label line by line.

that would bring a tear to my eye. :'-)



[Please log in to post a comment]