#### Archived

This topic is now archived and is closed to further replies.

# custom file formats

This topic is 5773 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Can some one please tell me were I can find some information on createing my own file format. I would like to be able to make my own type of graphics and level format. But I have no idea on how I would go about doing this. Thanks in advance

##### Share on other sites
quote:
Original post by sakky
Can some one please tell me were I can find some information on createing my own file format. I would like to be able to make my own type of graphics and level format. But I have no idea on how I would go about doing this. Thanks in advance

well, theres not much info on creating your own file format, simply because it will be yours, so you make it up... i've done this (simple file packing format) all you need to understand is file io really.

look at exisiting formats graphics or whatever see how they are put together then mimic that but using your own method. for example, with my file packing format i worked with PAK files then made it(the format) the simplist i could think of.

for level files, that really depends on what the level will need to file will need to contain, i.e.. number of enemies on the level, their position, level boundries, whatever is needed.

edit: or as Oluseyi said

Edited by - Bezzant on February 22, 2002 12:18:42 PM

##### Share on other sites
Shit kid..

First, ever hear of paragraphsS? How about organizing your thoughts a bit better?

Secondly, you''re getting way too complex here. Why would you need a script parser or lexer? Please read what Oluseyi wrote. If you''d like a file format that can hold all of your graphics/sound/etc, use a standard like the .PAK or .PK3 format, for instance. Wotsit.org has all of the information you need on it. It''s simple, elegant, and very easy to implement.

I''d advise the .PK3 format since its basically just like zip, however, the Quake PAK file format is pretty damned cool, and alot more fun to use.

quote:

But it I was going to make that type of format then I will need some sort of compiler or compressor.

Uh..what? Why would you need a compiler for reading/writing a file format? Just make some basic console program with standard C input/output.

By the way, I don''t think your idea about having a configure file hold both state variables and game/level data is very good. What would be the point in this? It wouldn''t make much sense.. It''s both easier and more efficient to have more than one file needed for your game. If you try to pack every damned thing into one file, doing something as simple as trying to read in an option like "color mode: 32bit" would take significantly more time because it has to sift through megabytes of images, level data, etc.

##### Share on other sites
Yeah, but I want to be difficult. I don''t want make a config file holding my games display data. I wanted a typr of script file that would hold data on how the game would act. Like on DOOM were you can change if there are any monsters or in the keep reviving all the time. Plus the option were and witch type of moster would be at along with items. Thats what I ment and I am doing what Oluseyi said. But I want the experience in making my own file formats and scripting engines/langs for later use. Besides I would like to make my own file format because I just do. I think its cool and I want to do it. all that scripting and configure stuff only changes what the level would look like. Just like the WAD file format. Thats the type of format I want to make but with a little use friendly twist. What I ment about a compiler or compressor was the person thats making the level will need one. How else are you going to get the image data and sounds all into the file. What say "pic go there" then boom its done. The main perpose of this is so I can can do the level editing and change of the graphics. Because I want to make lots of silly versoins of my game and be able to do it real easy like. Thats what the file format I''m trying to mkae comes in. So I can can switch around or do wierd stuff to my game this not haveing to recompile the damn thang over and over again....

##### Share on other sites
Do you expect this sort of information to be imparted in the course of a couple of forum postings? You need to go and spend a year or two learning the concepts of language design and compiler / interpreter implementation, amongst other things.

--

The placement of a donkey''s eyes in its head enables it to see all four feet at all times.

##### Share on other sites

anyhow, i think you should forget about writing a scripting language for the moment, it is/can be very complicated.

as for creating a file backing format like wads, you could use PAK files, of pk3 (renamed zip files) but if you want to create your own is really simple.

think about the most basic info that will be needed about the file thats archived- its filename and length (position as well, assuming you have a file index at the start). im not going to explain it all, because you''ll learn more from doing your own research, but look at existing file packing formats (PAK, WAD etc.)

##### Share on other sites
Why reinvent the wheel? Just use an existing format. I use the q2 model format (md2) and the q3 map format. This is a good idea for a number of reasons:

1) There is likely to be a healthy number of free samples to be found. So no need to construct your own (which flows to the second point).

2) No need to construct the tools neccessary to construct your custom models/levels.

3) There is likely to be sample code/tutorials/people willing to help with all aspect of loading/rendering these formats.

eb.

##### Share on other sites
Yeah, but he wants it to be difficult remember?

--

The placement of a donkey''s eyes in its head enables it to see all four feet at all times.

##### Share on other sites
Dealing with difficult people is annoying.

If you want to create your own file format, then be our guests..It''s not very hard.

There''s no secret magic behind it..its your file format, do what you want with it. The most common way is having a header in the top of the file which you read in, containing all of the "files" that are "stored" in the file (basically its just the ''binary'' of all the files in one large file). The header should include filename, file length, and offset (position in the file).

For instance, here''s a basic example:

  FILESIGNATURE // optionalHEADER | +-- BOB.JPG //it''s name 3200101 //size 25 //offset | +-- sounds\blah.wav etc..etcDATA | +-- 83ansdjknfwhuw38r //data of bob.jpg

You get the drift.

• ### Forum Statistics

• Total Topics
628714
• Total Posts
2984358

• 23
• 11
• 10
• 13
• 14