Access to the directory of the game?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
murks
Party member
Posts: 185
Joined: Tue Jun 03, 2014 4:18 pm

Re: Access to the directory of the game?

Post by murks »

zorg wrote:To be fair, i myself have a few projects in the making, and the way i did config files were the following:

Game startup:
- If it/they do not exist in the save folder yet, then use internal copies and copy those to the save folder.
- Load the config files from the save folder (and by config, i mean game-specific configurations mostly; audio (volume) settings, (minimal) graphic settings, input settings)
When settings are modified in-game:
- Export the settings with the same structure as before, into a .lua file, so it can be easily loaded. I have some strings in a table denoting lines in a file, and i use string.format to put the variables there too, then simply concatenate the table and write it out, overwriting the previous file. (One could also opt to only serialize the modified settings when the user quits the game, but this is safer.)
Thanks,
I was imagining something like this, but have little experience with storing data to files and loading it later. I am worried about robustness a bit, but I guess as long as the user does not manually modify it there should be no problems. Guess I just have to try.
bartbes wrote:
murks wrote: That means that due to the filesystem access restriction what I had in mind is not possible across the platforms I care about.
Wait what? You can fuse on every platform! Also, if you really, really want to, you can still use the io library...
Do you mean the fuse CLI parameter or something else?
On Linux I could just write a small bash script to run the game with --fuse, but I have no idea how to do it on OSX. I also don't know where to put the config file on OSX since as far as I know the game is "installed" via drag and drop or somesuch nonsense. On Windows and Linux I can just put it next to the executable.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Access to the directory of the game?

Post by bartbes »

murks wrote: Do you mean the fuse CLI parameter or something else?
On Linux I could just write a small bash script to run the game with --fuse, but I have no idea how to do it on OSX.
As a small nitpick it's --fused. And you can use a script on both linux and OSX, or you could do actual fusing, which is documented on the [wiki]Game Distribution[/wiki] page.
murks wrote: I also don't know where to put the config file on OSX since as far as I know the game is "installed" via drag and drop or somesuch nonsense. On Windows and Linux I can just put it next to the executable.
Which is exactly the problem with using the directory the binary is in.
User avatar
murks
Party member
Posts: 185
Joined: Tue Jun 03, 2014 4:18 pm

Re: Access to the directory of the game?

Post by murks »

bartbes wrote:
murks wrote: Do you mean the fuse CLI parameter or something else?
On Linux I could just write a small bash script to run the game with --fuse, but I have no idea how to do it on OSX.
As a small nitpick it's --fused. And you can use a script on both linux and OSX, or you could do actual fusing, which is documented on the [wiki]Game Distribution[/wiki] page.
It is only described for Windows, and I guess it could get messy because you also need to ship all kinds of libraries which then have the wrong version half of the time. Just like when you buy a game for Linux on GOG and use a Linux distribution other than the supported ones.
bartbes wrote:
murks wrote: I also don't know where to put the config file on OSX since as far as I know the game is "installed" via drag and drop or somesuch nonsense. On Windows and Linux I can just put it next to the executable.
Which is exactly the problem with using the directory the binary is in.
Thanks, I did not consider the OSX case.
Well, I could just not provide any config option for OSX, that would be simpler, and on OSX you are encouraged to make everything as simple as possible for the user, right?

Only joking. I understand now why going with a config file in the save game directory is the sanest way to go for any serious game.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Access to the directory of the game?

Post by bartbes »

There are actually instructions for OSX, here. Linux instructions also exist, but basically tell you not to do it (unless you know what you are getting yourself into).
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Access to the directory of the game?

Post by Jasoco »

zorg wrote:
murks wrote:...whether OSX is considered fused I have no idea...
No idea whether Mac has a special combined thing like executables on windows, but a .love will be unfused by default, and you can use the commandline flag to make it fused.
I don't believe OS X (Or macOS as it's now called) needs a Fused mode because of the unique and different way it handles apps. Apps on macOS are packages, that is to say special folders with all the important stuff inside it. For instance, the Löve app on macOS is a folder that contains the love binary (Which on Windows would be the .EXE file) as well as all the libraries Löve requires that on Windows would be .DLL files all sitting outside the .EXE in a separate location.

So on macOS, "Fused" mode is achieved differently. Instead of using a Terminal command to fuse the .love file to the .exe, you simply place the .love file INSIDE the .app folder package (In a specific location of course.) and Löve is designed to run it first if it's found. After that with a little Text editing, you can make a copy of the love.app into your own separate stand-alone game.app.

I could be getting some details wrong though.
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Access to the directory of the game?

Post by zorg »

Okay, so on OS X, you can indeed combine the project files with the app as well, just differently from how you'd do it on windows.
Still, to simulate a fused state (like having löve drop the "LOVE" folder part from the save directory's path), it would work the same with the --fused flag on OS X too, no?
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Post Reply

Who is online

Users browsing this forum: No registered users and 210 guests