gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Saving progress

#18449 - jonnyknowsbest - Fri Mar 26, 2004 3:27 pm

How would i go about coding a savegame routine?? Can anybody point me to any tutorials

Regards

Jonathan

#18450 - tepples - Fri Mar 26, 2004 3:38 pm

  1. Define what exactly you want to save about the game state.
  2. Figure out how to serialize this to a stream of bytes and deserialize it back to a game state.
  3. Copy the bytestream to SRAM to save it.

Which of these steps do you need explained further?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#18455 - LOst? - Fri Mar 26, 2004 8:30 pm

tepples wrote:
  1. Define what exactly you want to save about the game state.
  2. Figure out how to serialize this to a stream of bytes and deserialize it back to a game state.
  3. Copy the bytestream to SRAM to save it.

Which of these steps do you need explained further?


Maybe how to put the bitstream into SRAM? Just a guess.

Use the search function on this board to find topics about SRAM saving. And use a struct for the save data, and save the struct data with the sizeof (struct). And one this you should think of. SRAM can only handle 16 bits ber write (if I remember correctly) so it's always good to have the struct / 2 bytes == 1.

Am I correct thinking here professional people?

#18459 - johnny_north - Fri Mar 26, 2004 8:48 pm

A good set of basic functions lie in staring monkey's library 6:

http://www.gbadev.org/download.php?section=demos&filename=smslibrary_v6.zip

Should be all you need to get started.

#18460 - poslundc - Fri Mar 26, 2004 8:49 pm

LOst? wrote:
Maybe how to put the bitstream into SRAM? Just a guess.


Not sure what the point is of guessing what he needs further explained...

Quote:
Use the search function on this board to find topics about SRAM saving. And use a struct for the save data, and save the struct data with the sizeof (struct). And one this you should think of. SRAM can only handle 16 bits ber write (if I remember correctly) so it's always good to have the struct / 2 bytes == 1.

Am I correct thinking here professional people?


You don't have to be professional to check the specs before posting. I'm certainly not one.

And no, SRAM has an 8-bit port size and can only be accessed with 8-bit reads/writes.

Dan.

#18465 - LOst? - Fri Mar 26, 2004 9:11 pm

poslundc wrote:
LOst? wrote:
Maybe how to put the bitstream into SRAM? Just a guess.


Not sure what the point is of guessing what he needs further explained...

You don't have to be professional to check the specs before posting. I'm certainly not one.

And no, SRAM has an 8-bit port size and can only be accessed with 8-bit reads/writes.

Dan.


First of all, I can't understand some of the specs because I'm not that good at English. Second you are like a god to me, so you beat me whatever I say anyway :P

And 8-bit writes are much better than 16-bit, so that makes it easier for us all.

#18473 - dagamer34 - Sat Mar 27, 2004 1:21 am

http://forum.gbadev.org/viewtopic.php?t=2550&highlight=sram+saving

2 functions I wrote to both load and save structs to SRAM with a small example of how to use them.
_________________
Little kids and Playstation 2's don't mix. :(