Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / .X Files and Conversion for Dummies

Author
Message
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 28th Feb 2005 10:32
The .X File and Conversion for Dummies Tutorial

By RUCCUS of The Game Creators


This tutorial will give all of the newcommers here the down-lo on .X files and what to do when you need to implement them into you're game. Bare in mind that I myself am quite a large noob, erm, newcommer I mean, and I dont at all think I'm a pro at doing anything in DB yet. This is just to help those that may need it.
This tutorial requires the use of a program called Deep Exploration, an excellent program that can convert many file extensions. It isnt free but isn't expensive either. Click the link in the forum post above this, the one that lists where recommended programs are (I forget what the forum post is called but it's stickied).

Part 1: What the hell is a .x file?


What's a .x file? ".x" is simply the extension for a DirectX file. DirectX files are the main type of files supported by DarkBasic and are essential in 3D Game creation (unless you intend to use a bunch of boxes, which could still make a very good game). DirectX files can store all the information of a 3D object, it's coordinates, it's textures, it's animations, it's size, and lots more.

Part 2: How do you save a 3D File as a .X File?


Well, first of all, let's assume you're using 3DS Max. Simply create your object in 3DS Max as you wish. Once your object is complete to your likings, select it and go to File>Export Selected. Export your file as a .3DS file (the default file extension) into your media folder for your game. Why not just export it as a .x file? Well 3DS Max cant do that unless you isntall a plugin that I cant find at all, so we'll use a different way.
Once you've exported your file into the folder you wish, open up Deep Exploration, find the file you exported, select the file, then go to File>Batch Conversion>Geometry Files. Choose where you would like to save the new file into (the same media folder you saved the .3DS file usually) and then select from the dropdown list to convert the file into a DirectX file. Select Ok and boom, you now have a .X file with your model and info about the model in it!

Part 3: Implementing the file into Dark Basic


Now, the final step; the code. Simple insert this code before your main loop, using the correct directory to find the file:

LOAD OBJECT "directory",object number

Where the directory is, enter the exact directory your file is located in.


The number at the end specifies the object number, just like using the make object command.

If you want less directory information, you'll need to use the set dir command. Simple put this before your main loop:


This would then change our huge code to:


Thus, as you can see, makes for a lot less code and a lot less hassle when trying to load multiple files.

Part 4: The...End...I guess


Well, congrats. Now you should be able to create, convert and load DirectX files into your program. Like I said I too am still quite a big noob but I hope this can help someone. If you've any questions about the code or about .X files in general you can email me at
succur@gmail.com or the_conjuror@hotmail.com
Goodluck with your future DirectXinginginginging.
- RUCCUS

Causin' RUCCUS whereva' I go.

Login to post a reply

Server time is: 2024-09-23 13:14:17
Your offset time is: 2024-09-23 13:14:17