Page 1 of 2

Save File Possible? Examples?

Posted: Tue Jan 26, 2021 7:01 am
by Jdulay
Hello,
I am wondering if Save File functionality is possible. If so, are there any examples?
I'm planning a number of Homebrew games I'd like to develop and publish and need to plan accordingly based on Save File functionality.
Thank you very much for your time,

Jerrel

Re: Save File Possible? Examples?

Posted: Tue Jan 26, 2021 4:46 pm
by Ruffsta
well, i am strictly a 4.9 user and none of my games required saving files.. so i won't be much help to you sorry. but there are 5.12 users on here who i hope will try and help you out..

btw, i have actually ask the same thing for 4.9 lol - still waiting for an answer, but that's because i don't there really is any other 4.9 users atm...

Re: Save File Possible? Examples?

Posted: Wed Jan 27, 2021 12:51 am
by Jdulay
Thank you for the reply. I couldn't find any information on the differences and benefits between the 2 different versions.

I'm planning a basic password system to record basic progress in games, but no one wants to remember a 20 character password!

Re: Save File Possible? Examples?

Posted: Wed Jan 27, 2021 2:10 am
by SWEET_TOOTH
There are example on 4.9 folder in Virtual Machine. However I found it buggy, as it almost loads random or wrong position, however the same one if you repeat without saving again. SO it means the saving is either correct or kinda correct. Something in HOW it saves or what variables it loads is the question. Maybe James can comment on that. I mean saving is quite a crucial feature to have ;) I hope you find out more as I will also need to know how to save on 5.12

Re: Save File Possible? Examples?

Posted: Wed Jan 27, 2021 4:38 am
by DigitalDesignDude
DSGM 5.12 does have functions relating to reading and writing data to a file.

Below are the examples from the "index of DS Game Maker Functions" Documentation

Note that you need to make a .txt file and import it to the Game Settings menu under the NitroFS section in order to use the below examples.

So far I haven't been able to save new data to an external save file even when trying a compiled game on an actual ds. There likely something more I'm missing but I'm unsure on what else to try.

You can also try some of the code from someone asking the question on gbatemp here:
https://gbatemp.net/threads/can-you-sav ... er.562359/

Reading from a file

Code: Select all

Dim FileContent As String
Read_File(FileContent, "story.txt")
Draw_Text(Top_Screen, 1, 1, FileContent)
'Draws the contents of story.txt on the top screen at position 1, 1
Writting to a File

Code: Select all

Dim Content As String = "Hello, World"
Write_File(Content, "new_born.txt")
'Writes 'Hello World' to 'new_born.txt'
Listing Files in a directory

Code: Select all

List_Files(Top_Screen, 1, 1, "/")
'Lists the files in root folder of the .nds file I believe'

Re: Save File Possible? Examples?

Posted: Wed Jan 27, 2021 9:04 am
by Jdulay
That is hugely appreciated! Thank you! I'll try to get save file system working.
Are you saying you haven't been able to get save data working, though, despite this code being available?

Re: Save File Possible? Examples?

Posted: Wed Jan 27, 2021 1:57 pm
by DigitalDesignDude
Yes, I haven't been successfully able to write any save data to a file dispite the code being available.

I can read and output all the text from test
.txt file though, with the code I shared earlier. But of course that's not very useful on its own.

I think the problem may have to do with writing data to the correct file path but that may require repetitive testing with actual ds hardware inorder to find the correct path.

That's just a hunch though, I imagine saving could still be possible with an emulator if some more emulation setup work was done.

Wish someone with more experience in this area could give us some guidance.

Re: Save File Possible? Examples?

Posted: Thu Jan 28, 2021 2:10 am
by AR Studios
I would love it if this could be solved, I am also wanting to use a save feature.
Maybe if there was some way to tweak the 4.9 Save feature and use it on 5.12 but better? Idk

Re: Save File Possible? Examples?

Posted: Thu Jan 28, 2021 5:03 am
by Jdulay
I'll share any information I can figure out while I try to get it working.
If I can't get it working, I guess it's back to the ol' password system.

Re: Save File Possible? Examples?

Posted: Fri Jan 29, 2021 8:26 am
by Jdulay
SWEET_TOOTH wrote: Wed Jan 27, 2021 2:10 am There are example on 4.9 folder in Virtual Machine. However I found it buggy, as it almost loads random or wrong position, however the same one if you repeat without saving again. SO it means the saving is either correct or kinda correct. Something in HOW it saves or what variables it loads is the question. Maybe James can comment on that. I mean saving is quite a crucial feature to have ;) I hope you find out more as I will also need to know how to save on 5.12
Thanks for adding in your experience. Hopefully we can band together and figure out how to make it work.