How To

Is checkpoint saving possible?

1

kusogaki 2021-01-18 19:55 (Edited)

I want to make a simple text adventure game. The intro sequence may be pretty long and boring, so I want to make like little checkpoints where the game automatically saves your progress so you could come back to that exact point and continue playing as normal.

I made an extremely lazy quick example of how I imagine it to look like in 5 minutes.

I have no experience in programming whatsoever, so I can't really tell if something like this is possible here.

Edit: Forgot to attach the example.

Lazy Example..nx | Open in app
2021-01-18 19:57

was8bit 2021-01-19 00:20

Here is a quick example of using PERSIST memory...


was8bit 2021-01-19 00:24

Basically, POKE $E000,value saves a value, but it is limited to a value 0-255

CHECKPOINT = PEEK($E000) reads the value and loads it into the variable of your choice... in this case, CHECKPOINT

PERSIST memory will reset if the code is edited, or if user choosed to do so while looking at the code, selecting the SHARE/UPLOAD tab and select option CLEAR PERSIST MEMORY


was8bit 2021-01-19 00:28

If you are not familiar with HEX numbers, then to save/load more values with PERSIST memory, jusr use

POKE $E000+1,value
POKE $E000+2, value

You can use all the way up to $E000+4096, so you can have 4,096 small values stored in PERSIST


was8bit 2021-01-19 00:30

Remember, PEEK POKE is limited to a value 0-255... larger values are abit more complicated but not impossible... for now, what i posted already should be all you will need :)


Timo 2021-01-19 07:03

Persistent memory should survive even code editing. But renaming the program might make it reset.


kusogaki 2021-01-19 08:19

Thanks for the help! Very useful information. I understand now, thank you so much.


was8bit 2021-01-19 08:25

:)


Log in to reply.