View Full Version : text file format
08-28-2001, 02:32 PM
Hello, i'm trying to use a file format to store my world in; yet, that i make is simple, i don't include the textures in the file, just the vectrices, but it will be improved.
The problem is : filling the text file by hand is boring and takes a long time.
I have thinked to make a world creator, but it will take a long time.
Do you have any advices ? i'm sure many people have had this problem yet.
additionnal questions : what is a binary world file (what is inside, code ?)
What is the aim to have a multi-sector file format ? anyway, all will be loaded, no?
tanks for help,
Go for a binary file format for your verts, ascii just isn't efficient at representing floats. If your keen on ascii files try the .obj file format it plain text and many modeling packages support it so you don't have to manually modify your files.
Still I'd recommend binary.
A world file depends on what the creater wants in it. Carmack put geometry in his world file, I'm not, besides that his is binary and mine is text.
A multi sector file format is good for paging. "All will be loaded"... no. The idea is that in really big environments your memory won't be sufficient to hold all the data so you just pull in the bits near your location. don't do this until you have smaller levels loading, there are many issues you'll need to address.
As an example on one way to do it(my way) I have a world file that might (simply) look like this:
<World Name="Test World" Position="0 1 0" Angle="0 0 0">
<Light Position="50 50 50"/>
<Model Position="0 0 -60" Angle="45 0 0" File="structure\radarbase.lwo"/>
See how I have no vertices in there. I load lightwave models in when I want geometry. I use a simple XML parser to create a tree structure in memory to store my world as it appears in the file.
08-28-2001, 05:28 PM
another option, if you dont mind text files and a little work (although, not nearly as much as writing your own editor), is a program called blender www.blender.nl (http://www.blender.nl) . its a 3d modeling/animation program, its free, and its available for a large number of platforms.
the reason i suggest this, is because it has a python api that lets you write export scripts using python. of course, you have to learn python first www.python.org (http://www.python.org) has the python interpreter, and docs about it, how to learn it, etc..
also, blender has a rather steap learning curve, so, you may want to buy a book or something. there is also a great user comunity that writes tutorials, and will help you with any problems you have...
08-29-2001, 05:22 AM
tanks for your great help,
i still don't know what is exactly a binary file format :-)
08-29-2001, 12:02 PM
You can also doing your level in WorldCraft or UnrealEd 2.0 and export it in a text file.
After that, you read the file and display it.
I'm working on a UnrealEd 2.0 .T3D file format. My program cleans the file and it's more easy to use.
Here's my site :
Rob The Bloke
08-29-2001, 03:26 PM
Originally posted by MarsuGL:
...i still don't know what is exactly a binary file format :-)
a text file represents stuff as a long string of bytes (chars). lets say a float is represented as such :
that simple float takes 8bytes (one for each character). Storing it in a binary file it would take up 4bytes (the size of the data). When storing in a binary file, you'd copy the 4bytes directly into the variable, however using a string, it would have to be converted. This is where the slowdown occurs. The next problem is that each space, carriage return etc takes up another byte of data, thus adding to the file size. With binary all of this is nicely compacted.
The advantage of text files is that they can be easily understood, and edited by hand if neccessary. The other thing is that most 3D packages export data as text files, so getting a binary may be difficult unless you
a. write your own plugin
b. write some apllication to convert the data into your own format
09-01-2001, 06:09 AM
vhere can i find samples about binary file format use?
09-02-2001, 04:57 AM
I can send you docs for the 3ds file format. That is binary. Binary is much better to use, it's very boring to write an ascii parser...
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.