Apologies beforehand for the gigantic post...
RednibCoding wrote: ↑Sat Nov 11, 2017 9:01 amJust to clarify, the editor is just for developing the game, so its handy to save the map files to the games directory during development and fire up the game to see and test the map ingame. After the game developing phase is done, and game is finished, maps should'nt be changed anymore and maps and other recources are core files of the game, so the game should load a map file as it would, lets say, load an image from the game's directory.
I know that's your angle; you're not the first that had this kind of problem, actually.
First, if you have separate projects for the game and the editor, but both have the same 'identity' as löve calls it, either by setting it manually or by editing a conf.lua, both projects (if both or neither are fused) will use the same save directory.
RednibCoding wrote: ↑Sat Nov 11, 2017 9:01 amWhy can i load an image file without any problems from the games directory let's image1.png with newImage() but not a let's say world1.map file defined by me (where i have written the loading routine let's say with loadMap())
That's what confuses me.
Both can load maps or any other files from that save directory under any circumstances, not just images, and the same thing is true for the source directory, if the files are already there, you just can't write there. The source base directory is where your main.lua file is, whether or not you have it in a folder, in a zip archive with the .love extension (or with just .zip), or if it's fused with löve.exe.
MrFariator wrote: ↑Sat Nov 11, 2017 11:17 amWhat I wound up doing was including an additional step in my build script(s): look for the "official" map levels in %appdata%, copy those files into the game's own directory and then finally create the fused love2d game app. This methodology allows someone with the app (and final set of levels) apply edits to them, without harming the original level file in the process, unless they go out of their way to copy-and-paste from %appdata% to the game folder (and someone will, I'm sure). Also makes it easier to compare changes and see what sticks/works better between the two versions.
Works regardless if you want to disable the editor from end users or not.
I mean, what i'm not understanding is the premise that, since you're the dev, you should not give a wooden nickle about whether your editors dump files into the save folder in appdata or not, since you can always move those manually at once after everything works as you want, and you want to release the game with those files in the game's source folder hierarchy;
heck, you can even have the game itself copy out those files from the source to the save directory when the user starts up the program, if you want them to be able to edit the maps and stuff, without affecting the original files in the source! (because of what i said in my earlier post, the savedir files get priority when finding two files with the same name and path in both directories: file exists in savedir? load potentially modified map, if itdoesn't or if it was deleted, then load default from source.)
RednibCoding wrote: ↑Sat Nov 11, 2017 12:55 pmThat sounds like a good step.
But how do i load the map files from the game's directory? I do not mean the code implementation but the path. How do i tell love that i want to load the map file from the game's map folder.
As i said, both directories map to the same root; now, there is a function to get the real path, so that you can see where a file truly is, but the precedence rule still applies; if a file is in both places, the savedir one will get loaded.
A bit more advanved, but if you FFI in PhysFS, which löve uses, you can re-map the save folder and the sourcebase directory to two sub-directories, for the following virtual tree:
folder names are what you give them, doesn't matter; point is, in those folders, the files will now truly be separate.
RednibCoding wrote: ↑Sat Nov 11, 2017 12:55 pmThat sounds like a good step.I come from frameworks/languages where i could just load anything from anywhere and never ran into any troubles (as long as you know what you are doing).
And you can! There are always way to do anything; as i stated previously, löve doesn't block you from using lua io and such, and you can mess with PhysFS as well, or get luafilesystem (though that'll have portability issues too, i think) if you want to.
RednibCoding wrote: ↑Sat Nov 11, 2017 12:55 pmAnd you definitly should be able to load core game resources for your game other than images and sounds from the game folder. I mean, map or scene files definitly belong to the game core like for example player images do, and not to the user data that has to go in %appdata%.
I think this is still a misconception on your end, since all we're saying is that you can't edit files in the source directory programmatically, not that you can't have every asset in there. :c
RednibCoding wrote: ↑Sat Nov 11, 2017 12:55 pmThis %appdata% thing feels more like an obstacle than a feature.
As for example when you want to deploy a game to Android it needs to have the read/write access to be set anyway. Thats done by so many Android game's/apps. So whats the point love implementing such (to me sensless) restrictions. I mean i like love because it is so "barebones" so you can code everything from scatch in your own way and needs like scene management, entity system, input handling.. Basically everything... nothing like that is predifined, love just gives you the right set of tools to do it easily, so the engine does not force the user to use stuff the way the engine wants to.
And then this restriction with %appdata% that totally does'nt make sense to me because this does'nt follow that red line love2d follows.
Look, for what it's worth, i'm a bit salty about it as well, and to tell you the truth, i am working on a solution myself that i'll share whenever i get around to finish coding it, and testing it on various OS-es.
I'm not exactly the model computer user the current year expects; i have my own PC that only has me as an user, my account is the admin account because fuck restrictions, i takeown-d my whole C drive so the OS doesn't prevent me from deleting bloated stuff they think are necessary features, and i'm experienced enough to not get viruses and shit without a firewall and an antivirus. I'm not boasting, all those things are horrible from a general and comp.-security perspective, probably; just saying that to me, logically, all apps should have their own folder as writeable by them, at the very least, and to not force me to "install" things in C:Program Files (x86 or not)... but i digress.
Also, what grump said.