Jump to content


Photo

Save files


  • Please log in to reply
11 replies to this topic

#1 Redyoshi

Redyoshi

    GMC Member

  • New Member
  • 31 posts

Posted 29 January 2012 - 03:58 PM

Hey GM4Mac people,
Does anybody know how to create a reliable save file system for macs? Like maybe one that could store multiple saves, keep track of levels beaten (so you could go back and replay previous levels, but not skip levels that you haven't beaten), and such? Nobody seems to know how. I might have been able to figure it out, but then I took an arrow to the knee, so I would REALLY appreciate input.
  • 0

#2 RandomationGames

RandomationGames

    GMC Member

  • New Member
  • 189 posts

Posted 29 January 2012 - 07:45 PM

You can use text or ini files. I only have experience with the latter though.
  • 0

#3 Hexenritter

Hexenritter

    GMC Member

  • GMC Member
  • 149 posts

Posted 29 January 2012 - 09:10 PM

Working with GM4MAC is a little bit like working on a PSX game without memory card access.
I'm experiencing the same problems, and no, you can't use any external-file-related functions (at least not in the way it's meant to be in GM8 for Windows).

A way to do it, is creating a password screen like in the early Megaman Games.
This is how I do it :)

For example:
1356 - leads to level 2
or 7799 - leads to level 6

cheers!

edit: by external file functions I didn't mean DyLib Extensions, only the native GML functions

Edited by Hexenritter, 29 January 2012 - 09:28 PM.

  • 0

#4 Dangerous_Dave

Dangerous_Dave

    GMC Member

  • Global Moderators
  • 9276 posts
  • Version:Unknown

Posted 30 January 2012 - 07:22 AM

I use text files in GM for Mac with no troubles. The only problem you may have is that the application directory is not the intended place to store these files. Just store them in "~/Library/MakeFolderHere" and you'll have no issues.
  • 0

#5 Hexenritter

Hexenritter

    GMC Member

  • GMC Member
  • 149 posts

Posted 30 January 2012 - 04:15 PM

that's interesting. And how does that work if you're editing your game which doesn't run as compiled app? Is it only working with compiled app packages?
  • 0

#6 1 Shogun

1 Shogun

    GMC Member

  • GMC Member
  • 40 posts
  • Version:Mac

Posted 31 January 2012 - 03:11 AM

You could create an object for each level that creates a separate save file at its create event. Then, create a menu in which when an object button is selected or clicked, it loads the particular save file pertaining to the object button if the save file exists. Else, you could have it load an error sound and a message box when clicked or change the object's sprite alpha to half. If you use save files instead of importing variables from text files it is much easier and no items or points carried over from previous levels are lost. And, if you plan on making an app, the save files are placed within the Contents folder of the app in the MacOS sub-folder so everything is self contained or portable. Most people don't even bother to look within the app folder so the save files won't be accidentally deleted.

P.S.

But, word of warning! For some reason when the game project file is edited and the save files loaded have been created from a previous edit, sometimes errors occur. So it would be best that when testing after an edit, clear out the previous save files and start game from scratch. But, it has been a while since I've seen this issue and could be GM7 for windows doing this. Good luck!
  • 0

#7 Dangerous_Dave

Dangerous_Dave

    GMC Member

  • Global Moderators
  • 9276 posts
  • Version:Unknown

Posted 31 January 2012 - 04:06 AM

that's interesting. And how does that work if you're editing your game which doesn't run as compiled app? Is it only working with compiled app packages?

Storing the files in ~/Library works fine when running from GM. Storing them in the app does not, as the app is recreated each time. For the final version it would be fine though.
  • 1

#8 Redyoshi

Redyoshi

    GMC Member

  • New Member
  • 31 posts

Posted 31 January 2012 - 08:56 AM

Working with GM4MAC is a little bit like working on a PSX game without memory card access.
I'm experiencing the same problems, and no, you can't use any external-file-related functions (at least not in the way it's meant to be in GM8 for Windows).

A way to do it, is creating a password screen like in the early Megaman Games.
This is how I do it :)

For example:
1356 - leads to level 2
or 7799 - leads to level 6

cheers!

edit: by external file functions I didn't mean DyLib Extensions, only the native GML functions


I'd forgotten about that way... I'm going to use that for some of my games actually.

You could create an object for each level that creates a separate save file at its create event. Then, create a menu in which when an object button is selected or clicked, it loads the particular save file pertaining to the object button if the save file exists. Else, you could have it load an error sound and a message box when clicked or change the object's sprite alpha to half. If you use save files instead of importing variables from text files it is much easier and no items or points carried over from previous levels are lost. And, if you plan on making an app, the save files are placed within the Contents folder of the app in the MacOS sub-folder so everything is self contained or portable. Most people don't even bother to look within the app folder so the save files won't be accidentally deleted.


Hm, didn't know you could do that, This is probably what I'll use for the game I'm making now.

I use text files in GM for Mac with no troubles. The only problem you may have is that the application directory is not the intended place to store these files. Just store them in "~/Library/MakeFolderHere" and you'll have no issues.


How exactly do you use text files? Excuse my n00bness.

Anyways thanks everyone for the quick responses.
  • 0

#9 Dangerous_Dave

Dangerous_Dave

    GMC Member

  • Global Moderators
  • 9276 posts
  • Version:Unknown

Posted 31 January 2012 - 09:05 AM

How exactly do you use text files? Excuse my n00bness.

Anyways thanks everyone for the quick responses.

The same way as in the Windows version of GM. It's not particularly hard, but it's probably best if you read the help file or find a tutorial as it's not as straight forward as you might expect.
  • 1

#10 Hexenritter

Hexenritter

    GMC Member

  • GMC Member
  • 149 posts

Posted 31 January 2012 - 06:10 PM


that's interesting. And how does that work if you're editing your game which doesn't run as compiled app? Is it only working with compiled app packages?

Storing the files in ~/Library works fine when running from GM. Storing them in the app does not, as the app is recreated each time. For the final version it would be fine though.


Oh, ok I see. That was very helpful.
Now... where would I have to put the files in (within the App's content folder), when I'm done compiling it? Can I just put it into Contents or MacOS?
  • 0

#11 Dangerous_Dave

Dangerous_Dave

    GMC Member

  • Global Moderators
  • 9276 posts
  • Version:Unknown

Posted 01 February 2012 - 03:47 AM

I think GM regards MacOS as the working directory, but I think the Resources folder is a more appropriate place to put it. There's no set variable for it though so you have to work it out based on the working_directory.
  • 0

#12 Hexenritter

Hexenritter

    GMC Member

  • GMC Member
  • 149 posts

Posted 01 February 2012 - 06:05 AM

Dude you really safe my life here :)
All external file functions work just perfect.
I really had no idea how to work around certain problems which weren't even problems.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users