[Tutorial+Example] Saving and Loading done EASY!

Learn to use DS Game Maker by Example.

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

Postby Nobody » June 29th, 2011, 5:02 pm

doesn't the R4 automatically create a save file with the file name but with the save extension? So then couldn't you just try to write it to the save file that is automatically created?
Feel free to ask me for help. I'm on the forum a lot.

Recent Projects:
Retro Ducks: viewtopic.php?f=13&t=3533 (latest)
The Living Dead 2: viewtopic.php?f=13&t=3483
Crafters DS (Minecraft 2D Clone!) viewtopic.php?f=13&t=3082
User avatar
Nobody
 
Posts: 2323
Joined: February 14th, 2011, 12:08 am
Location: United States of America

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

Postby Nobody » June 29th, 2011, 5:24 pm

Oh, ok. I'm going to try this again to see if before i did something wrong or if it is just my card. Also yoshi, what does your current version of game player do? I downloaded it to try it, but i didn't use it yet. Does it download nds from somewhere yet, because i wasn't sure if you made the change yet.
Feel free to ask me for help. I'm on the forum a lot.

Recent Projects:
Retro Ducks: viewtopic.php?f=13&t=3533 (latest)
The Living Dead 2: viewtopic.php?f=13&t=3483
Crafters DS (Minecraft 2D Clone!) viewtopic.php?f=13&t=3082
User avatar
Nobody
 
Posts: 2323
Joined: February 14th, 2011, 12:08 am
Location: United States of America

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

Postby Nobody » June 29th, 2011, 9:54 pm

The change between downloading other files to nds files. So it works now. So can i play the file once it's done?
Feel free to ask me for help. I'm on the forum a lot.

Recent Projects:
Retro Ducks: viewtopic.php?f=13&t=3533 (latest)
The Living Dead 2: viewtopic.php?f=13&t=3483
Crafters DS (Minecraft 2D Clone!) viewtopic.php?f=13&t=3082
User avatar
Nobody
 
Posts: 2323
Joined: February 14th, 2011, 12:08 am
Location: United States of America

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

Postby Foxi4 » June 29th, 2011, 10:43 pm

I don't think Yoshi implemented bootloading yet. The application just downloads the *.nds onto your cart and then you can boot it yourself, amirite?
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: 1221
Joined: December 31st, 2010, 3:25 am

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

Postby baron » July 16th, 2011, 11:25 pm

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
Place these actions in the Actions folder of your DSGM installation directory (usually C:\C:\Program Files\DS Game Maker\Actions).
(249 Bytes) Downloaded 238 times

Save Data.action
(217 Bytes) Downloaded 233 times


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).
Have you played Sliker DS?

There's this cool new Android game that you should totally play.

http://officeofstrategicinfluence.com/spam/
User avatar
baron
Site Admin
 
Posts: 177
Joined: December 30th, 2010, 9:54 pm
Location: London, England

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

Postby Foxi4 » July 17th, 2011, 5:35 am

Legal actions? Are you serious lol?

Using FAT functions is the basis of learning C, so-called "tutorials" in saving/loading files for just about any platform roam the internet left and right and they look just about the same in every single case:

1) Open a file.
2) Read/Write into the file.
3) Close the file.

It's really nothing extra-ordinary. What I do have to say is that in my honest opinion, it's 10 times better to do this process step-by-step in code rather than using actions - it allows you to "learn while you work", so you strike two birds with one stone.

Setting up a proper Structure for the save file and knowing it by heart is extremely important when loading data later on, that's why the tutorial in the Original Post is so extensive, with screenshots and instructions step-by-step.

The actions will be useful though, it's infinitely easier to just throw those in and "forget" about re-typing everything. For anyone that's going to use them, I do *recommend* at least looking at the action code to know what the hell is going on, and once you're more experianced, ditching them altogether in favour of using a C-Script - DSGM supports those natively for a reason. ;)
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: 1221
Joined: December 31st, 2010, 3:25 am

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

Postby aekara » July 17th, 2011, 10:55 pm

Hi i have one question:

lets say that i have made a game. In the game there are four levels and i have completed on the two and then i save it,and when i turn off my ds.next when i turn on my ds and load the game on my flashcard and press the button were i load my save file ,what will happen?I mean will it load the level three or what?

THANKS
Working on something big!

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

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

Postby Foxi4 » July 17th, 2011, 11:31 pm

Everything depends on how you structure your game. If saving will occour on each room change or each level increase, loading the variable will do just that - load the variable. You'll need to prepare your code to "transport" you to the correct room depending on the state of said variable.

It's not saving the "state" of the game, just the current content of the structure.
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: 1221
Joined: December 31st, 2010, 3:25 am

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

Postby Nobody » July 19th, 2011, 12:12 am

basically, it only stores variables. So if you wanted to continue the game you'd have to tell the game to load the variable, and then based on the value (last room), it would go to that room.
Feel free to ask me for help. I'm on the forum a lot.

Recent Projects:
Retro Ducks: viewtopic.php?f=13&t=3533 (latest)
The Living Dead 2: viewtopic.php?f=13&t=3483
Crafters DS (Minecraft 2D Clone!) viewtopic.php?f=13&t=3082
User avatar
Nobody
 
Posts: 2323
Joined: February 14th, 2011, 12:08 am
Location: United States of America

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

Postby equinox » August 11th, 2011, 4:05 pm

Hi,

but this code not work on DS EMULATOR?
equinox
 
Posts: 11
Joined: August 10th, 2011, 5:50 pm

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

Postby nicklausw » August 13th, 2011, 2:36 am

equinox wrote:Hi,

but this code not work on DS EMULATOR?

You can not use NO$GBA.

Try a different emulator.
my stuff
pong - sms/gb
sudoku - sega master system

next project - something for the nes, perhaps?[/b]
User avatar
nicklausw
 
Posts: 1037
Joined: May 23rd, 2011, 10:25 pm
Location: The Capital Wasteland

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

Postby nicklausw » August 13th, 2011, 2:39 am

Nobody wrote:basically, it only stores variables. So if you wanted to continue the game you'd have to tell the game to load the variable, and then based on the value (last room), it would go to that room.

So Make a Boolean Variable called Level3 and set it to true and it will load it.
my stuff
pong - sms/gb
sudoku - sega master system

next project - something for the nes, perhaps?[/b]
User avatar
nicklausw
 
Posts: 1037
Joined: May 23rd, 2011, 10:25 pm
Location: The Capital Wasteland

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

Postby Nobody » August 13th, 2011, 5:53 pm

equinox wrote:Hi,

but this code not work on DS EMULATOR?

Most emulators won't utilize it for one, most of them don't have FAT capabilities and such; so to test it you need to but it on a real DS.
Feel free to ask me for help. I'm on the forum a lot.

Recent Projects:
Retro Ducks: viewtopic.php?f=13&t=3533 (latest)
The Living Dead 2: viewtopic.php?f=13&t=3483
Crafters DS (Minecraft 2D Clone!) viewtopic.php?f=13&t=3082
User avatar
Nobody
 
Posts: 2323
Joined: February 14th, 2011, 12:08 am
Location: United States of America

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

Postby equinox » August 14th, 2011, 6:15 pm

Tnk1000,Nobody,,,for info.
equinox
 
Posts: 11
Joined: August 10th, 2011, 5:50 pm

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

Postby nicklausw » August 16th, 2011, 9:59 pm

Does DeSmuMe 0.9.6 support this?
my stuff
pong - sms/gb
sudoku - sega master system

next project - something for the nes, perhaps?[/b]
User avatar
nicklausw
 
Posts: 1037
Joined: May 23rd, 2011, 10:25 pm
Location: The Capital Wasteland

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: 1221
Joined: December 31st, 2010, 3:25 am

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

Postby BLsquared » 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?
You may call me BLsquared, Commodore, or TexasBatman. Preferably BLsquared.
My avatar was made by this guy: http://christianmanga.com/smf/index.php ... bum;in=374

"Every puzzle has an answer." - Professor Layton
"In war, there is indeed no substitute for victory." - Douglas MacArthur
"Love and Peace!" - Vash the Stampede
"It's High Noon!" - McCree
Member of Memefefe's Squad
User avatar
BLsquared
 
Posts: 997
Joined: August 10th, 2011, 4:39 pm
Location: United States of America

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: 690
Joined: July 12th, 2011, 1:24 pm
Location: Earth

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

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

OK, I'll try that.
You may call me BLsquared, Commodore, or TexasBatman. Preferably BLsquared.
My avatar was made by this guy: http://christianmanga.com/smf/index.php ... bum;in=374

"Every puzzle has an answer." - Professor Layton
"In war, there is indeed no substitute for victory." - Douglas MacArthur
"Love and Peace!" - Vash the Stampede
"It's High Noon!" - McCree
Member of Memefefe's Squad
User avatar
BLsquared
 
Posts: 997
Joined: August 10th, 2011, 4:39 pm
Location: United States of America

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: 1221
Joined: December 31st, 2010, 3:25 am

PreviousNext

Return to Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest

cron