Reading assets from game folder.

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
IceReaper
Prole
Posts: 2
Joined: Wed Mar 14, 2012 12:51 am

Reading assets from game folder.

Post by IceReaper »

Hi there, i just registered because i cant find a way to do the following:
My game (or atm still proof of concept) consists of two folders which include the game assets. While the first one, which includes all lua files, will be packed and merged into the executable file, i want all sounds and textures to be in an "Assets" folder which is plain readable, so people can build their own texture packs etc. After searching though this forums, i found out that you can only read from the .zip / folder and the save directory. However what i basicaly try to do, can also be doable if i require another .love file or folder. For example: Game/ or Game.love (which will be packed into the .exe) will somehow tell the engine to load another love file/folder (the Assets folder) which doesnt include any .lua files.
Hope my explaination is enough, so how do i manage this? :) In the worst-case i have to add this to the source.

The second thing is, can i somehow add a password to the zip which i append to the .exe? If only possible via source change, ill need to look into that if there isnt a variable defined at a central place for the password.

For both problems i would prefer not touching the source, cause i try to avoid to constantly update my fork then :D

Greetings
IceReaper
User avatar
jradich
Party member
Posts: 100
Joined: Mon Dec 12, 2011 8:44 pm

Re: Reading assets from game folder.

Post by jradich »

I think you could use love.filesystem.setIdentity or something, but I'm not quite sure....... FOR THE LOADING TEXTURE PACKS, BTW.
Losing a friend's trust is the fastest way to lose a friend, forever. FOREVER!
User avatar
tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Re: Reading assets from game folder.

Post by tentus »

What you should probably consider doing is have the art in the .love file, but defer to textures from the save directory. (As in, there's a media/images/cursor.png, but if there's also a media/images/cursor.png in the save folder, you'd use it.) That way you always have a fallback in case an image or something is missing, and you don't have to distribute two files, just the one.

As for passwording the zip: nope, that would require source changes.
Last edited by tentus on Wed Mar 14, 2012 3:58 am, edited 1 time in total.
Kurosuke needs beta testers
User avatar
sanjiv
Citizen
Posts: 88
Joined: Mon Feb 27, 2012 5:11 am

Re: Reading assets from game folder.

Post by sanjiv »

I have no idea what I'm talking about, but just for the sake of providing a friendly face, the description of require suggests that it looks outside the .love file anyway. I.e. it may search a save directory that doesn't seem like it'd be included in the zip turned love file. https://love2d.org/wiki/love.filesystem

But it seems like you already considered this. Why didn't that work for you?

[edit: oh hey, it seems I was thinking along a reasonable path. Whoray for me!]
IceReaper
Prole
Posts: 2
Joined: Wed Mar 14, 2012 12:51 am

Re: Reading assets from game folder.

Post by IceReaper »

Jeah, i could probably do this, putting the assets in the .love file, and extract them, however this is now as i wish it to work. What i try to do is exactly this:

Game.exe <- The Löve .exe plus appended game-lua-script zipped using a password, so people cant simply hack that code (multiplayer cheating etc). So i'll implement a source change to add a hardcoded but again crypted stored password.

Assets/ <- a folder including all images and sounds. This folder goes into the same directory where the .exe lies, so all which is present in the save folder, is actualy some save files and config files, nothing more.


looks like i need to change the source for both sollutions. So i'll do this today :D Thanks anyway for help :)
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Semrush [Bot] and 5 guests