Log In  


Officially, you can't use multiple data storage one one program.
This feels mostly true, but very similar in spirit to statements like "pico-8 has 16 colors".

"cartdata() can only be called once per program", is already less restrictive :
You could have a game that uses 3 save slots, each with a different cartdata ID because each save requires most or all of the 256 bytes of a cartdata storage, and let the player choose his slot at start of the program. You'd only ever call cartdata once per game session, but would have three storage slots used in one program.
This would still not be great because you can't display any info about the slots before loading them so the player would have to blindly load a slot, see if it's the save he intended to use, and reset the game if he made a mistake.

Could we do that programmatically ? Turns out that yes, we can :
extcmd("reset")
Does reset the cart. Problem is, how do we remember what the previously viewed storage was, or what we were doing before triggering the reset ?
Previous storage content is super simple to get : the reset call did not erase the memory, so you can just peek it at address 0x5E00. You can't get it with dget() : you'd get a crash "dget called before cartdata()"
The "what were you doing" part is less convenient but manageable : poke the info into high memory that doesn't get cleared when you reset, and at start of the game, check the memory to see if it's a fresh boot or the continuation of something.
Pretty cumbersome, but this opens a lot of possibilities :
You could build an achievements page that would load cartdata form other games and display the list of completed ones, (if the info is in the save, of course).
You could have a cartdata containing a custom player sprite that could be used in many of your games...
You could have a multi-part save, but you'd lose the flexibility of dget()/dset()
Lots of possibilities, has anyone explored those yet ?

2



[Please log in to post a comment]