Page 1 of 2

Alternate ways to store data files

Posted: Sat Mar 10, 2012 12:10 am
by N_K
Hello all!

I'm planning to develop a 2D RPG. Originally, I started to write an SDL-based engine from scratch, but then I found Löve. So I started to play with it, and I like it very much, it's an amazing 2D engine. The only thing that holds me back at the moment is that it's entirely Lua-driven. Even people with limited game development knowledge will eventually figure out how to open .love files, read the scripts, and the whole game will be spoiled.

I know it's possible to append the .love file to the end of the Löve executable. However, I don't really like the idea to distribute the game as a single, extremely large executable. I know it's also possible to compile the lua files to bytecode, but as far as I know, they won't work on platforms different from the one they were compiled on.

What I think about now is to pack only the script files into the executable, and keep all the other data files in an external .love/.zip file. Is it possible to do this?

My other idea is to grab the source code, and use Löve directly from C++. As far as I understand right now, all the functionality are coded in C++, and then the C++ methods are simply exposed to the Lua interpreter, but they can also be called directly, right? Is there anybody who tried this before?

Thanks for your help in advance. :neko:

Re: Alternate ways to store data files

Posted: Sat Mar 10, 2012 2:39 am
by slime
Even people with limited game development knowledge will eventually figure out how to open .love files, read the scripts, and the whole game will be spoiled.
Why would the game be spoiled? People who are interested in the code with enough knowledge to understand it would already know the in-game consequences, and there's a high chance that they would have finished the game already.

Re: Alternate ways to store data files

Posted: Sat Mar 10, 2012 2:50 am
by N_K
Thanks for your reply.

Well, trust me, I've seen a few casual gamers who managed to open even proprietary archive formats just to figure out something they couldn't solve ingame. So it's simply not a good idea to serve the whole internal game mechanism to the player. In game that's entirely algorithm-driven, like a tetris clone, they can't figure out much when looking at the code, but, for example, in and RPG, with all the dialogs, events, and items, it's not that hard to spoil the game.

Re: Alternate ways to store data files

Posted: Sat Mar 10, 2012 3:14 am
by pk
I think what you are asking for and the way LOVE is designed are mutually incompatible.

Re: Alternate ways to store data files

Posted: Sat Mar 10, 2012 3:29 am
by slime
N_K wrote:Thanks for your reply.

Well, trust me, I've seen a few casual gamers who managed to open even proprietary archive formats just to figure out something they couldn't solve ingame. So it's simply not a good idea to serve the whole internal game mechanism to the player. In game that's entirely algorithm-driven, like a tetris clone, they can't figure out much when looking at the code, but, for example, in and RPG, with all the dialogs, events, and items, it's not that hard to spoil the game.
Wouldn't they just look online for answers if they can't find out through the game files? Online walkthroughs are certainly nothing new.

Re: Alternate ways to store data files

Posted: Sat Mar 10, 2012 3:52 am
by N_K
pk wrote:I think what you are asking for and the way LOVE is designed are mutually incompatible.
As far as I know, Löve is designed to be a general-purpose 2D engine. What I need is a general-purpose 2D engine. It has a pretty extensive Lua interface, but the engine itself is still coded in C++. And then it seems that nobody tried to do this before, but I guess it wouldn't be hard to use it from C++, so I'll go ahead, and try to get something out of this. :nyu:

So, for now, let's forget about why I don't want to expose my scripts to the players, and let's forget about why I want to code the game in C++, but can someone tell me if it's possible to use external data files (e.g.: there's game.love, which contains only the scripts, an there is data.zip, which contains all the media)?

Re: Alternate ways to store data files

Posted: Sat Mar 10, 2012 4:32 am
by slime
Currently everything read by love's virtual filesystem needs to either be in the .love file or in the game's save location (inside appdata in windows, etc). For release, love files are typically packaged with the executable so the user only sees the executable.

I think in the future it would be cool to have different ways for people using love to organize their game data, but this is the only way right now.

Re: Alternate ways to store data files

Posted: Sat Mar 10, 2012 5:16 am
by tentus
It's entirely possible to load external zip files in Love. They'd have to be in the save directory, but it's very doable. Just dang inconvenient.

Re: Alternate ways to store data files

Posted: Sat Mar 10, 2012 5:55 am
by pk
Even then, any sufficiently intelligent user can get at the scripts and resources.

If people can hack Minecraft they can definitely hack LOVE. Compiling directly to to a binary format will make it harder, but I doubt you will gain much for all your effort.

Re: Alternate ways to store data files

Posted: Sat Mar 10, 2012 7:49 am
by Boolsheet
Many of the LÖVE module functions in C++ access the Lua API to get a dynamic number of arguments more conveniently into the arrays. This means it's not possible to use only C++ without modifications. The developers talked about a solution for this issue, but it will not be included in the next version of LÖVE.