[Tutorial+Example] Saving and Loading done EASY!

Learn to use DS Game Maker by Example!

Re: [Tutorial+Example] Saving and Loading done EASY!

Postby Foxi4 » September 21st, 2011, 11:02 pm

Try it out to know for sure. It *should*, but I can only guarantee it works correctly on most contemporary SLOT-1 flashcarts.
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1119
Joined: December 31st, 2010, 3:25 am

Re: [Tutorial+Example] Saving and Loading done EASY!

Postby Commodore » December 14th, 2011, 8:25 pm

bksonic wrote:I typed an extremely long PM to a user explaining how to save/load in DSGM 5.12, not even knowing that this topic actually existed. This is why users should really use the Search box if they need help.

Here are some actions I created to make saving and loading easier for users. They use similar code to what Foxi4 presented in his tutorial (please read below), with only minor differences which will not affect the outcome (save_file is called savefile in the actions, as they are quite old).

Load Data.action

Save Data.action


Also, just in case there is any legal actions taken, I promise that I did not rip these off from the tutorial and claimed them as my own. These were old actions from DS Game Maker 4.9 which I imported into DSGM 5 (I used these actions in 4.9 for Sliker DS).


bksonic, when I used your actions in "my SPACE iNVADERS", the music stopped working when I tested it in my Acekard. The music works in the emulator though. Any way to fix this?
"Every puzzle has an answer." - Professor Layton
_______________________________________________________________________
December 17, 2012 - MegaMan 25th Anniversary
_______________________________________________________________________
Member of Memefefe's Squad
User avatar
Commodore
 
Posts: 557
Joined: August 10th, 2011, 4:39 pm

Re: [Tutorial+Example] Saving and Loading done EASY!

Postby aekara » December 14th, 2011, 9:17 pm

the problem is becouse sound it using nitro and save/load use fat

EDIT

here is the solution

in the game setting make sure you have inited both fat and nitro
now when you want to stream an background sound just before you call the "Stream background action" in the palib action put chdir("nitro:/"); and then when you want to save or load just before the save/load code add chdir("fat:/"); on the palib action and do that every time you want to use fat or nitro
P.S You can't use fat and nitro at the same time as far as i know
Working on something big!

My web site here.
aekara
 
Posts: 693
Joined: July 12th, 2011, 1:24 pm
Location: Earth

Re: [Tutorial+Example] Saving and Loading done EASY!

Postby Commodore » December 16th, 2011, 4:17 pm

OK, I'll try that.
"Every puzzle has an answer." - Professor Layton
_______________________________________________________________________
December 17, 2012 - MegaMan 25th Anniversary
_______________________________________________________________________
Member of Memefefe's Squad
User avatar
Commodore
 
Posts: 557
Joined: August 10th, 2011, 4:39 pm

Re: [Tutorial+Example] Saving and Loading done EASY!

Postby Foxi4 » December 16th, 2011, 10:53 pm

Alternatively if you feel lazy you can just stream sounds from FAT and forget about Nitro altogether OR use full paths (fat:/file.extension or nitrofs:/file.extension) instead of chdir.
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1119
Joined: December 31st, 2010, 3:25 am

Re: [Tutorial+Example] Saving and Loading done EASY!

Postby Paul » March 14th, 2012, 7:31 pm

Is it possible to save multiple variables?
Paul
 
Posts: 47
Joined: July 23rd, 2011, 3:21 pm

Re: [Tutorial+Example] Saving and Loading done EASY!

Postby Commodore » March 14th, 2012, 10:30 pm

You can using structures the long way, or you can use arrays. You can save them just like a variable.
"Every puzzle has an answer." - Professor Layton
_______________________________________________________________________
December 17, 2012 - MegaMan 25th Anniversary
_______________________________________________________________________
Member of Memefefe's Squad
User avatar
Commodore
 
Posts: 557
Joined: August 10th, 2011, 4:39 pm

Re: [Tutorial+Example] Saving and Loading done EASY!

Postby Haloflooder » March 24th, 2012, 9:20 pm

When I tried your example on my NDSL TT. The screen just stays white when the TT is booting into the boot menu. When I put the codes in my game, TT loads fine but when I boot my game, the screen just stays black. Is it just my TT not working or is this example too old for DSGM 5.12?
Haloflooder
 
Posts: 2
Joined: March 24th, 2012, 9:16 pm

Re: [Tutorial+Example] Saving and Loading done EASY!

Postby Foxi4 » March 28th, 2012, 1:28 am

The example is just fine, it's likely that whatever menu you're using doesn't understand ARVG protocol. Try launching it using Homebrew Menu from Drunken Coders.

http://devkitpro.org/wiki/Homebrew_Menu
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1119
Joined: December 31st, 2010, 3:25 am

Re: [Tutorial+Example] Saving and Loading done EASY!

Postby Haloflooder » March 28th, 2012, 5:54 am

Thanks, that fixed everything :)
Haloflooder
 
Posts: 2
Joined: March 24th, 2012, 9:16 pm

Re: [Tutorial+Example] Saving and Loading done EASY!

Postby EgoTrip » June 14th, 2012, 12:05 pm

I am having trouble following this, the explanation has been everything but clear and concise.

Say I have some variables called Chocolate, Level, Record1, Record2, and Banana.

Exactly how do I 1: get the game to load these variables when the game starts, ie in a Title screen control object create event.

2: save the variables when they need saving, such as when a level is complete, ie in a Level control object.

Thanks in advance. The quicker this is sorted the quicker I can release the next version of my game. This is the only thing missing in the engine.
EgoTrip
 
Posts: 70
Joined: June 5th, 2012, 3:04 pm

Re: [Tutorial+Example] Saving and Loading done EASY!

Postby Nobody » June 14th, 2012, 12:54 pm

are you asking how to do the actual saving code or how to make the game to where it saves and loads when it needs to?
Feel free to ask me for help. I'm on the forum a lot.

Recent Projects:
Crafters DS (Minecraft 2D Clone!) viewtopic.php?f=13&t=3082 (latest project!)
The Living Dead - viewtopic.php?f=13&t=1582
Mario Craft - viewtopic.php?f=8&t=1736 (Most Popular!)
Spawn Zombies - viewtopic.php?f=13&t=3444 (Newest)
User avatar
Nobody
 
Posts: 1980
Joined: February 14th, 2011, 12:08 am
Location: United States of America

Re: [Tutorial+Example] Saving and Loading done EASY!

Postby EgoTrip » June 14th, 2012, 3:24 pm

the code
EgoTrip
 
Posts: 70
Joined: June 5th, 2012, 3:04 pm

Re: [Tutorial+Example] Saving and Loading done EASY!

Postby Nobody » June 14th, 2012, 5:58 pm

all you really need is a copy and paste. First create the struct of everything you want to save, and then change 'save_data" to the name of the struct
Feel free to ask me for help. I'm on the forum a lot.

Recent Projects:
Crafters DS (Minecraft 2D Clone!) viewtopic.php?f=13&t=3082 (latest project!)
The Living Dead - viewtopic.php?f=13&t=1582
Mario Craft - viewtopic.php?f=8&t=1736 (Most Popular!)
Spawn Zombies - viewtopic.php?f=13&t=3444 (Newest)
User avatar
Nobody
 
Posts: 1980
Joined: February 14th, 2011, 12:08 am
Location: United States of America

Re: [Tutorial+Example] Saving and Loading done EASY!

Postby EgoTrip » June 14th, 2012, 7:14 pm

If I could follow it I would, but I need a specific example relating to specific variables as put in my previous post. I can get it to work by copying it as it is, but after that, when I attempt to incorporate my own variables it just keeps throwing up error messages.
EgoTrip
 
Posts: 70
Joined: June 5th, 2012, 3:04 pm

Re: [Tutorial+Example] Saving and Loading done EASY!

Postby Foxi4 » June 14th, 2012, 11:24 pm

EgoTrip wrote:If I could follow it I would, but I need a specific example relating to specific variables as put in my previous post. I can get it to work by copying it as it is, but after that, when I attempt to incorporate my own variables it just keeps throwing up error messages.

Simply add your variables to the attached structure and you're done - there's really nothing mind-boggling here to speak of. All you need to take note of are Types of variables - u8/s8 for unsigned/signed 8-bit, u16/s16 for signed/unsigned 16-bit (INTEGER in DSGM), bool for Boolean, char for single Characters, char name[lenght] for strings.
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1119
Joined: December 31st, 2010, 3:25 am

Re: [Tutorial+Example] Saving and Loading done EASY!

Postby Buck_7 » June 14th, 2012, 11:35 pm

What are the difference bewtween unsigned, and signed???16-bit intger?
Upcoming games I'm working on:
  • Minecraft2DS
  • Bow Man DS
  • Bird poo!
------------------------------------------------------------------------
COOL LOOK 3D portal port for DS! http://drunkencoders.com/2013/01/dstal-advance/
needMusic?needHelp?Ask.
User avatar
Buck_7
 
Posts: 1001
Joined: February 19th, 2011, 1:44 am

Re: [Tutorial+Example] Saving and Loading done EASY!

Postby EgoTrip » June 15th, 2012, 12:22 am

Give me an example please, using my variable names, because I cant get the stupid thing to work. I am missing something really obvious here, but for the life of me I just cant see it.

Integers are whole numbers, ie no decimal places. Signed is -127 to 127, unsigned is 0 to 255, 16 bit is -32768 to 32767, and 0 to 65535
EgoTrip
 
Posts: 70
Joined: June 5th, 2012, 3:04 pm

Re: [Tutorial+Example] Saving and Loading done EASY!

Postby Buck_7 » June 15th, 2012, 12:38 am

I don't know if this helps or not, but I had this example...
Upcoming games I'm working on:
  • Minecraft2DS
  • Bow Man DS
  • Bird poo!
------------------------------------------------------------------------
COOL LOOK 3D portal port for DS! http://drunkencoders.com/2013/01/dstal-advance/
needMusic?needHelp?Ask.
User avatar
Buck_7
 
Posts: 1001
Joined: February 19th, 2011, 1:44 am

Re: [Tutorial+Example] Saving and Loading done EASY!

Postby Foxi4 » June 15th, 2012, 1:59 am

I just realized something - are you testing your code on an emulator and are you sure that you properly initialized FAT? You can't use both FAT and NitroFS at the same time - you have to switch between those two.
Current Projects:

FalloutDS: Postponed until proper libraries are created, 10%
Foxi_Lib: A completely revised version of NitroSprites[FINAL], NitroBackgrounds and NitroText[FINAL], 40%
Foxi4
 
Posts: 1119
Joined: December 31st, 2010, 3:25 am

PreviousNext

Return to Tutorials & Examples

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron