ratalaika / angel-engine

Automatically exported from code.google.com/p/angel-engine
0 stars 0 forks source link

OS-independent file storage #45

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi.

I hereby request support for saving and loading of game-related files. Every 
game has to store some files (think saved games). Unfortunately, accessing the 
file system looks different under the three supported platforms (Windows, 
Linux, Mac). Also location for user-specific files is different, and even 
directory separators, etc. It would be perfect if game developers didn't have 
to deal with this in every game.

So for instance it could be something like:
void Files::save(string dir,string fileName,string content);
Which would store the content into a file in OS-specific user's home directory.

Then it could be read with:
string Files::read(string dir,string fileName);

Or maybe something more C++-ish, instead of a function Angel could produce a 
stream object?

As a matter of fact, currently I only have to save very simple data (few ints 
and a string). So instead of messing with files, game devs could just store 
some named values. For instance I would like to call:
Storage::saveInt("MarioGameLevel",4);
And then I could read it back with:
int level = Storage::readInt("MarioGameLevel");

And Angel would just store it somewhere appropriate for each platform in 
user-specific location (so if few users have logins on a machine, the value can 
be different for each). How cool would that be?

Original issue reported on code.google.com by rhy...@rhywek.com on 20 Feb 2011 at 3:40

GoogleCodeExporter commented 9 years ago
This is a very game-specific need that could be handled with Lua files at the 
ClientGame level. 

Original comment by lieseg...@gmail.com on 8 Mar 2011 at 4:12