custom file formats

Started by
9 comments, last by sakky 22 years, 1 month ago
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
Take back the internet with the most awsome browser around, FireFox
Advertisement
Why not use one of the many existing package formats documented at Wotsit?

[ GDNet Start Here | GDNet Search Tool | GDNet FAQ | MS RTFM [MSDN] | SGI STL Docs | Google! ]
Thanks to Kylotan for the idea!
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
Yes, I''ll be more descriptive on my questions. What I want to make is sorta like a wad file. What I realy want is a file that I can cram all my graphics and sounds into. If needed I would add some level data or something or the sort. But basicly I want a file formate the will hold all of my graphics and sounds in a nice tight little package that only my program can read. I guess I''m trying to mimic the DOOM engine in a way. I like the the way the cfg files let you change thangs and how the EXE is just the engine but the realt stuff is in the WAD file. I want to do something like that so peopl can edit and change thangs in my game if they want. I''m been reading the tutorials on Flip Code about making your own scripting engine. I''m sure some of you have seen them. I don''t realy need a compiler for my own script I make do I. Can''t is jsut be like an html document. Because that would make it easy on the use instead of having to go find the compiler. Or go through the mess of learning how it works. I want them just to simply be able to write a few thangs in a text file and then give is a sertain extention. Then they can see the changes as soon as the game loads up. I want to make a Galaxian clone of some sort but I would also like the user to be able to play around with it in more ways then one. So you see, I''m sort of stuck with a bunch of stuff I know nothing about but have only reaqd some thangs on. I seen the scripting tutorial on GameDev too. It gave me a few ideas. But Flip Code is talking about useing flex to make a lexer or what ever its called. Sounds realy complicated but it would also be fun to learn and play around with. You never know you could actually make something that starts a trend. But I''ll go back a read up on my Practical C++ book by McGregor and get those ios down like the inside of my palm...I mean back of my hand. I''v only looked at Wosit a little bit, but I''l go back and download many file formats to take a look at. The question I asked is kinda of hard to answer because know one realy knows what another person wants or needs. I think I should of asked for advise od compressing image and sound data or rending levels from 2D graphic files(DOOM, WOLF3d) or a script. But then again you don''t know what I ned or exactly what I want. I realy would like the user to be able to explore and play around with thangs. Making little changes in his or her script to change the game. Then giving them a little freedom and a sort of tease. Leaving them thinking "I wonder what this would do". Having the opportunity to explore and change almost any thang in there game. I was thinking about making the engine I''ll make read the script file for not only graphics and sounds but level data to. Sort of like a cfg file in a way but with compressed graphics and sounds in it. But it I was going to make that type of format then I will need some sort of compiler or compressor. Or and editor so you could change the level data. I would also like to make sort of a debug mode that would let the played go around and play the game the edited and be able to change it while playing it. Does this sound like a good idea?
Take back the internet with the most awsome browser around, FireFox
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.
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....
Take back the internet with the most awsome browser around, FireFox
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.
please structure your writing, its very difficult to both read and follow as it is

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.)
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.
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.

This topic is closed to new replies.

Advertisement