Log In  

can someone explain to me how to use cart swapping with this? https://www.lexaloffle.com/bbs/?pid=35138&tid=28467

I don't really see any tutorials on pico8 cart swapping.

I would like to have carts for the following..
-for the game which handles logic..
-for the editor which contains no map or tiles by default..
-for maps carts which contain map and tile data.

is something like this possible with reload() and cstore()?

P#48817 2018-02-01 00:56 ( Edited 2018-02-02 22:27)

1

Yes. The code portion cannot be swapped out at runtime while preserving the rest of memory, so the cart with the code is the main cart that gets loaded. The code can then call reload() to load maps and tiles (and sfx and music) from other carts, and cstore() to save them.

http://pico-8.wikia.com/wiki/Reload
http://pico-8.wikia.com/wiki/Cstore
http://pico-8.wikia.com/wiki/Memory

For your map editor, reload() and cstore() are exactly what you want. The main cart has the editor code and can load and save map and tile data as needed from other carts. You can even limit the memory ranges to reserve some tiles for the editor's purposes (icons, mouse pointers).

You'll need to learn how addressable memory works so you can specify the appropriate address ranges to reload() and cstore(). Notice, for example, that tiles are stored as a single "sheet" that resembles a screen's worth of graphics data in memory, so the bytes for a single tile are not contiguous.

Also note that reload has a simulated delay with a "loading" animation, so they're not something you can do in the middle of an action sequence. But they're good for level transitions or cutscene breaks in games, or in specialized editors like yours. This does make reload() impractical for loading multiple small regions of memory (e.g. each line of a single sprite), so it's easiest to do big chunks at a time.

P#48903 2018-02-02 17:27 ( Edited 2018-02-02 22:27)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-19 01:23:07 | 0.005s | Q:9