Hey PICO-8 folks! I'm working on a farming sim, and immediately hit a roadblock with persistent memory for web users. Here's the issue:
Because it's a farming sim, I need my map tiles to be changed by the player on the fly. This isn't a problem with mset(), but my issue arises when it comes time to save the map data. Saving a whole grid of map values and flags for grass/dirt/tilled dirt/vegetables/weeds/rocks requires a lot of different numbers to be saved. I understand that cstore() is an option, but that's only for cartridge players, not players on the web, if I understand correctly. And with only 64 memory slots with dget() and around 1024 map tiles to save (if I shrink the map significantly), if I translate the tiles to decimal or binary values, memory's still far too tight.
Is there any type of memory storage or trick that has allowed any of you to store large amounts of map data persistently for web users, or am I out of luck?
If you use
cstore() they can both be read by the web.
Yet at no point can you SHARE data between two different computers and users. When you run your cart online, anytime you use
cstore() that data is saved locally to YOUR hard-drive and no-one else's.
There is no instance at any point of saving data
on the internet where it can be globally read by others - not yet. ZEP is working towards this. :)
If you are running offline, it is also saved to your HD but where you can access it easily, usually in the
My suggestion is to use
cstore() as you have 12288 bytes to work with instead of just 256 with
The disadvantage of using
cstore() is you get the animation for a second showing Pico-8 is busy whereas using
cartdata() the information is loaded and saved instantly.
For more information on using the 12288-byte method, go HERE:
For more information on using the 256-byte method, go HERE:
Hope This Helps !
Ah, interesting! I was under the impression that cstore() didn't work at all for web users, but since I have no need to share this data between users, this may work for me. I'm unfamiliar with the 'busy' animation, but if I'm careful about when data saves, I should be good to go. I'll give this a try. Thanks so much for your help, dw817!
You are very welcome, @eggnog. Also be aware you have RAM 0x8000-0xFFFF you can POKE and PEEK or MEMCPY() to for added memory if you need it. This is relatively new so it's definitely useful.
Good luck !
Thanks again for the help, @dw817! I did some work with cstore() and have a system working with two external carts - one to store the original map data, and one to store the current map data. The cart pulls from one or the other depending on what it needs to do.
As you said, there's a short loading screen, but it's a price I'm willing to pay to finally get this working. Thanks again for the help! :)
[Please log in to post a comment]