Log In  

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?

P#117800 2022-09-22 15:35

1

Hi @eggnog:

If you use cartdata() or 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 dset() or 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 \saves\ or \snaps\ directory.

My suggestion is to use cstore() as you have 12288 bytes to work with instead of just 256 with cartdata()

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:

https://www.lexaloffle.com/dl/docs/pico-8_manual.html#RELOAD

For more information on using the 256-byte method, go HERE:

https://www.lexaloffle.com/dl/docs/pico-8_manual.html#Cartridge_Data

Hope This Helps !

P#117803 2022-09-22 16:22

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!

P#117807 2022-09-22 17:06

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.

https://www.lexaloffle.com/dl/docs/pico-8_manual.html#MEMCPY

Good luck !

P#117808 2022-09-22 17:37

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! :)

P#117923 2022-09-25 02:46

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 13:24:45 | 0.015s | Q:16