GLBasic forum

Main forum => GLBasic - en => Topic started by: PeeJay on 2008-Feb-05

Title: Shoebox question
Post by: PeeJay on 2008-Feb-05
Having shoebox is very handy for protecting media files, I have to admit.

Does anyone know a way (or can suggest a way) of adding data files to a shoebox, and then opening them in a read only stream? I am working on a game that has the room data in separate files, which is then read back by the game as and when it is needed. Unlike Microsoft, I'm not a fan of having loads of little files everywhere, so I wonder if anyone can think of a way of adding them into the shoebox file?
Title: Shoebox question
Post by: Ian Price on 2008-Feb-05
How much data is in the data files PeeJay? Are these your location data (text etc.)? Could you not convert the data into images and use colour testing to get the info? Or hard coding the info into the game itself?
Title: Shoebox question
Post by: PeeJay on 2008-Feb-05
There's around 40K of data in 60 files currently (so not practical to hard code) and given that I remember in a different thread it was mentioned that colours can vary a not inconsiderable amount, simply converting the data to RGB values and creating a bitmap could lead to data corruption (to say nothing of making the whole thing totally illegible if I come back to it in six months time!)

The game in question is Manic Miner - the location text for the other game is all hard coded ;)

MM has gone GLified (and I am now taking advantage of the alpha blending, by doing things like giving Willy a working helmet oo-er!)
Title: Shoebox question
Post by: Kitty Hello on 2008-Feb-06
I think Openfile and getfile should work on text files in a shoebox as well. Or did I get your idea wrong?
Title: Shoebox question
Post by: PeeJay on 2008-Feb-06
No Gernot, you got the idea exactly right. However, I am currently using:

OPENFILE
READLINE
READWORD
CLOSEFILE

and if the files are included in the shoebox only, the game just crashes out.

I am still toying with the idea of making a binary bitmap, as this would enable me to store the info, and, if it's binary, the issues of colour variation would be negated, but I didn't know if anyone had coded any workarounds in the past ...
Title: Shoebox question
Post by: AndyH on 2008-Feb-06
Take a look in the code snippets (if you haven't already) as Gernot has created a memory bank function to create, read, write and free blocks of memory.  Doesn't solve the shoebox issue you are having, but you could save all your level data in one binary file on disk, load it in and manipulate it with these functions.

I think Gernot is going to add them as built in commands at some point too.