Sign in to follow this  

X File Format

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am interested in creating my own model format which I can manipulate easier than most of the current file formats. In order to do this, I want to take an existing X file and transfer and encrypt the data in order to make the file dependant on the application its meant for, and not any other programs. (Ie. 3ds Max, or Milkshape) But in order to do this, I need to know exactly what format the data is in within the X file. Once I can read an X file and understand it, I will be able to create a simple program that interprets the data from the X file to my own file format. I am also interested if animated X files exist. If they do, do they have a different file extension than *.X, and if not, is that information included in the X file, or does that have to be all hard coded? Thanks for your time, Griffyboy0

Share this post


Link to post
Share on other sites
You should look at the DirectX docs. There's a decent reference on XFile formats, and the loader APIs.

At its core, XFile is a collection of data templates which define how data is organized in the file. There are no built-in structures except the Header template. An XFile contains template definitions, and then data in a form dictated by the templates.

There are standard templates that D3DX uses to load and store mesh data and mesh animation and material data. All that is in the docs too. Between the docs and looking at sample .x files that come with the SDK, you can find what you need.

I'd recommend looking at the XFile APIs instead of writing your own parser though. There's the low-level APIs which walk through the bits of data with no knowledge of what a mesh really is, and there are higher-level loaders like D3DXLoadMeshFromX() and D3DXLoadMeshHierarchyFromX() which load meshes and animated meshes, respectively.

Share this post


Link to post
Share on other sites
I would like to use the X file format, but A lot of the functions that I know are so broad, and don't allow me to get into the nitty gritty of hard coding skeletal movements.

Basically, What I would like to do, is make my models so that they cant be opened by other programs, and I would like to know exactly what all of the data within them means, so I can hard code movements.

Sure it isn't the most efficient thing to do, but I wont be hard coding every movement, I just want to impliment a "Rag doll" system, and hard code universal movements like walking, and running. I dont necessarly want all different movements to be different model files, because the filesize would get so large, and it would be so limiting on future updates and patches.

But what exactly did you mean by "There are no built-in structures except the header template." All of the X Files that I have seem to follow the same format, given some have extra data that others don't.

Thanks for the reply though! I will look through the documentation and see what I can come up with.

Thanks again,

~Griffyboy0~

Share this post


Link to post
Share on other sites
Well like I said, there are two different APIs, the low-level data-by-data API, and the high-level ones which load entire meshes and animation hierarchies. By 'no built-in structures' I mean you can have a legal XFile which contains data that has nothing to do with meshes. XFiles can literally store anything, but they're useful for meshes and such.

You store skinning info for the mesh and bone hierarchies, which you need for ragdoll stuff. Then you store animation sets for specific animations like walking and running. There are standard templates which store that data. Get into the docs and especially samples.

Out of curiosity though, why seal the model format?

Share this post


Link to post
Share on other sites
Well, I looked through the documentation, and found exactly what I needed. Thanks for the refrence.

Anyway, I want to seal the models because the game I am working on is an mmorpg, and I would perfer it if my players didn't mess with the models of the game, because it takes away from their experience, even though they may not think so.

I would like my players to experience the game the way I want them to, and not to fiddle with the music and models. It isnt like theres a large modding community for mmorpg's out there anyway.

Don't ask me why I want to impliment "rag-doll" death sequences on an mmorpg though. Just thought it was a good idea...

~Griffyboy0~

Share this post


Link to post
Share on other sites
well u can continue to use the X format and apply key pair encryption (the encryptor can multiply the X with the key1 and your game client can multiply the X at load time with key2).
And u can still use D3DX with LoadXFromMemory rather than the disk.

Not to start a flame war or anything, but it seems to me like people are going to play it the way you intend from the beginning and for the rare few that mod, doesnt it enrich their playing experience that they can create their own models and such?
My mantra would be: whatever keeps them playing, haha. I mean the Quake engines are all heavily moddable, Unreal comes to mind, Baldurs Gate for RPs. Plus the MMO system isnt really open to hacking per se, so why worry about some guy who wants to play as a clown rather than a paladin? I duno just my opinion, anyone else have thoughts?

Share this post


Link to post
Share on other sites
Well, I guess it's up to the player how he or she wants to play the game, but I would really like it if the player doesn't mess with the game files, because he or she may mess up a file used in a future update, and wouldnt be able to get the full experience of the update.

If a player is determined enough, I guess he or she could modify the game files anyway, so I guess my effort would be wasted in that aspect.

Besides, I don't know if I can write a parser that is more efficient than the included ones in directX. (I'm only a 14 year old novice. lol)

~Griffyboy0~

Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this