Advertisement

My own file format

Started by August 28, 2000 06:50 PM
6 comments, last by Rederick 24 years, 3 months ago
I''m looking for a way to include multiple files into my own file type(I.E bitmaps, world geometry 3d formats). Like the way the game Everquest has its own .s3d format, as do most commercial games. Is this relatively easy to do? What books would you recommend me reading to get started in doing so? Thanks!!
Playing games is what I live for. Getting paid to make those games is how I will live.
that one book, the title is something like 3D File Formats or something to that extent. try searching amazon. thats the best place i can think of to start.
Advertisement
I''ve never read the book mentioned, but I would assume it covers existing file formats, rather than making your own. But really, making your own file format is pretty easy to do, so it wouldn''t require a book. It''s basically just a matter of figuring out what kind of information you''ll need to describe each file, and then putting all that information into a header. Then you''ll just need one function to write the header, followed by the image(s) data, to create files of your new type; and one function to read in the data, to load files of your new type. Sorry if I''m not being specific enough...?

-Ironblayde
Aeon Software
"Your superior intellect is no match for our puny weapons!"
I THINK I know what you''re getting at. So I would put info like my different bitmaps'': height, width, colors, etc...and for 3d geometry: hehe . Does anyone have any sample code for doing this?

Thanks!

OH and btw, I''ll check on that book you mentioned at amazon.com right now.
Playing games is what I live for. Getting paid to make those games is how I will live.
umm...it would have much to do with file i/o.

let''s say you have a bitmap (.bmp) file and a audio(.wav) file.
And the you have your own file( .myf). You would save the audio to the first part of your file and the .bmp as an add on to that file. You just have to make sure you know the byte location of where each file (.wav, .bmp, and whatever else you''re saving) is. Then later, you would open that file and read certain bytes to your program data. For example:

let''s say your .wav file starts at byte 0 and ends at byte 99 and the .bmp starts at 10 and ends at 199 or so. You would open the .myf and read the first 100 bytes and read it into a "Wav Handle" and the last 100 bytes to a "Bitmap Handle."

hope that helps
I actually worked on something like this once , the way I did it was set up a header at the begining of the file...like this:
__GOOEY__
Start.wav 0000
Game.bmp 2340
and the numbers just corresponded to the byte that the file started at.
Ps - 0000 was a reference point to the first byte past the header, so my program just did HEADER_BYTES + location to find the true starting point for the file.
Advertisement
Thanks for the input guys. I just found this article that describes pretty much what you''re saying right from this site!

Resource Files Explained

With code and everything.
Playing games is what I live for. Getting paid to make those games is how I will live.
You could just separate each different file with an index, a name, and a type. e.g.:

    <1 BMP TITLEPICTURE>001001011111111 bitmap stuff etc.</1><2 WAV ENTRYSOUND>568y0Ë45kgÄ wav stuff etc.¶,Q¤0n7t51051‰}‹£© §4</2>    


so when you input the file just use a struct containing data about name index and type.

Lucas
-=[ Lucas ]=-

This topic is closed to new replies.

Advertisement