File Formats
Gamestudio and lite-C support numerous file formats for importing and exporting
artwork and data.
!! Keep file names short -
the names of entity and texture files (including extension) in WMP and WMB levels are limited to 30 characters, and texture and skin names in WAD and MDL models files are limited to 15 characters.
File names must not contain any special characters except "_" or "+".
Never, ever, use spaces in your file or path names! Many import
filters
from other editors
will not find texture files when they have spaces or exotic characters
in their name.
In the following
you'll find specific information about the
formats supported:
Image files
Image files are used for importing
textures
,
model or terrain skins, terrain heightmaps, sprites, bitmaps and fonts,
and for exporting screenshots.
Recommended image formats are TGA,
DDS, PCX and WAD.
Also supported, but not recommended are BMP, PNG and JPG images - they are read through the DirectX library and thus depend on the DirectX version, and have other
shortcomings.
The selected image format does matter
because all formats
have their specific advantages and disadvantages:
-
PCX 256 color (8-bit palettized)
images for low quality, reduced color textures are supported for compatibility reasons.
All 256 color images must share the same color palette per level, given in
WED Map Properties. The first color of the palette (color #0) must always
be black, the last color (color #255) must always be white.
Due to the many
restrictions and requirements, we do not recommend to use 256 color images
- especially for beginners who don't know about handling color palettes.
-
PCX true
color
(24-bit
RGB) images are used for
low
quality textures. They are internally
stored in either 16-bit high color or 4-bit compressed
format, depending on d3d_texdepth.
- TGA true color (24-bit RGB) and true
color
alpha
(32-bit
ARGB) images are used for high quality textures. They are internally stored
in 16-bit high color or 32-bit true color, depending on the setting of d3d_alphadepth.
32-bit ARGB images contain an alpha channel which gives a transparency value
for every single
pixel
(see also: Transparency)
.
For
creating
an alpha channel in Photoshop, open the channels window, and click
onto the small "new channel" button below. Now an alpha channel
is created, and you can paint onto it. When saving the picture, use the 32
bit TGA format.
- DDS images are used for
medium
quality textures when
video memory must be economized. They are supported in the DXT1..DXT5 sub-formats
with included mipmaps. DDS uses a compressed 4-bit texture
format for saving memory at the expense of image quality. DXT2..DXT5 textures
contain an alpha channel and are treated as transparent by the engine
(see also: Transparency). DXT1 has a 1-bit alpha channel that could be used for overlays, and is not treated as transparent.
Due
to their compressed content, DDS bitmaps
can not be altered by image manipulation
functions (like pixel_to_bmap), can not be used for textures
that contain several separate images (like animated sprites or sky
cubes),
and are not displayed by the older GXL libraries in the WED and MED editors.
They can be created with the DirectX Texture Tool, with a Photoshop Plugin,
or with ATI's Compressonator.
-
BMP
true color (24-bit RGB)
images behave like PCX images, but are uncompressed and thus have larger file sizes than PCX files. There is also a seldom used BMP 32 bit format, which can be created f.i. by taking screenshots, but is not supported by the engine and by many paint programs.
-
PNG images behave like
32 bit TGA images with alpha channel (even if the channel was not explicitly created in the pain program). They
are not recommended because they are loaded not by the engine, but by the DirectX library, and are not guaranteed to be automatically restored when the video device gets lost. This means that they can lose their content f.i. when a fullscreen application is minimized.
-
JPG images should not be used for textures in realtime games. They combine all disadvantages of the other formats, plus the additional disadvantage of slow loading, high video memory consumption, and bad texture quality. Their only advantage is small file size.
- WAD files are image collections containing several
BMP, PCX, TGA, or DDS images,
with names and included mipmaps. They are imported in WED and used for level
textures. As DDS images are not displayed by WED, they appear
as blue squares in the
WAD preview.
Some considerations about transparency:
-
All image formats that contain an alpha channel (32 bit TGA, or
DXT2..DXT5) are treated as transparent by the engine - even if the alpha
channel has no meaningful content and even if you don't know what an alpha channel
is! Transparency has consequences for sorting and rendering, so don't use
an alpha channel texture for an object that you don't want to be transparent.
- Images without alpha channel can
be used for overlays with
transparent parts.
Overlays are sorted like opaque textures. In overlay images, black parts
(RGB == 000) are totally transparent, the rest is totally opaque. For nontransparent
black
use a RGB color value of 8 or above. If d3d_autotransparency is
enabled, the transparency color is taken from the upper
left pixel of the
image. This way an arbitrary color can be used for transparency, avoiding
the dark seams around intransparent parts that are otherwise caused by
black pixel antialiasing.
Restrictions apply to image sizes:
- 3D cards have a texture size limit
-
mostly 4096, 2048, or 1024 pixels in every
direction. For supporting all 3D cards,
don't use bigger bitmaps than 1024x1024, except for images
containing several frames (for animation or sky cubes), or images with
mipmaps. The
next-lower mipmap is then automatically used when a 3D card does not
support the
image size.
- 3D cards can not render arbitrary texture sizes. Normally they require power-of-2 texture sizes (32, 64, 128, 256, 512, 1024...), like 64x128 or 128x512.
The minimum texture size normally is 8 pixels.
All invalid sizes
are
automatically
extended
by the engine to the
next power of 2, at cost of video memory, performance,
and image quality.
Invalid texture sizes on models are only possible when all skins of a model have the same size.
In some cases, f.i. for tiled textures, invalid sizes
are not possible at all.
Therefore, always use power-of-2 sizes for all level, terrain, and model textures.
Only for sprites and panels it might make sense to use different sized
textures.
Video files
Video files are used with the media_play functions
and can be played on the screen or on a texture. There are specific video formats
like MPG, DIVX or QTW, and
meta-formats like AVI. MPG files, or AVI files
with
MPEG coding can normally be played on every computer. Special
format like DIVX or Quicktime require their
filters to be installed, so they have to be included in the distribution. Check
the required license conditions
before
including such filters in your game.
Sound files
Sound files are used by the media_play and snd_play functions,
as well as for sound sources in the level. WAV, MID, OGG,
and MP3 files are
supported.
- OGG is the recommended format for snd_play and
sound
sources.
It uses Gamestudio's internal OGG player. OGG can also be used with media_play, however an media player OGG filter
(installer included in Gamestudio) must then be distributed with the game
and installed on the target machines.
- WAV and MID work
everywhere, but WAV is large in
size and MID low in quality.
- MP3 requires a license
fee and thus is not recommended
for low budget games.
Script and Effect files
Script and effect files are plain text files with the extension WDL for
scripts, and FX for shader and effect definitions.
FX files contain a standardized language (HLSL),
so external FX files can be used by
just adapting variable names. Shaders and effects can also be contained in
script material definitions, or in models.
Model files
MED
and WED
can import models in many 3D formats:
FBX,
3DS, X, ASE,
OBJ, MDL, MD2, ASC,
and Milkshape.
Additionally, terrain can be imported from heightmap images.
Further formats are supported through MEDs own import/export filters and through
Milkshape import/export
filters that can be directly plugged in MED.
- 3DS, ASE, and
OBJ files contain nonanimated
models with multiple meshes and materials, and are supported by almost all
3D packages. Some 3D editors do not use
transparency
and
set the alpha value at zero, so after importing check the material alpha
setting. Using a list of 3DS files, vertex animation can
be imported. 3DS models can also be exported for using
them in external editors.
When textures are stored externally, make sure that their format is supported by the editor - such as BMP, TGA, or DDS (see above).
-
X is the Microsoft model format. It contains multiple meshes and materials
plus bones or vertex animation.
Unfortunately, the X format evolved over time into many different, incompatible variants that can normally only be read with the same editor that exported them. Gamestudio can import all X files that are compatible to the Microsoft X format. You can find out compatibility issues with the Microsoft Mesh Viewer that comes with the DirectX SDK. If your model looks and animates correctly in the Mesh Viewer, it will also be correctly imported in Gamestudio.
X bones animation can be inconsistent when different versions of coordinate transformation systems are used (even within the same file). To be on the safe side, use only bones rotation - no movement and scaling - when you want to export the model to Gamestudio or to other tools.
-
FBX is the standard platform independent model exchange format. Exporters are available for by all major editors, such as MAX® or MAYA®. Unfortunately, the FBX format is not compatible to itself; there's a difference between FBX models saved with the 2005 or earlier FBX version,
and saved with newer versions (2006 or above). If you are not sure which FBX version is exported, try both. For not animated models, always leave Convert to Points Animation checked in the import dialog. For importing bones, the same restrictions apply as mentioned for X models.
The following issues were reported with FBX exporters
from other editors: MAX® only exports bones that are assigned to at least one vertex. Cinema 4D® properly exports to FBX only when the textures are stored in .TGA format. Milkshape® FBX export was reported to export wrong bones animation. Some editors use a deformation object (such as the Bulge object in Cinema 4D®); make sure that the model is exported without attached deformation objects.
- Milkshape is a popular model editor that supports many
formats through external filters. Milkshape filters can be used by MED,
and models in Milkshape
ASCII format can be directly imported, including bones animation.
- MDL and MD2 files are vertex animated models with a single texture, used
for the Quake game series by id software.
- ASC is a nontextured mesh format for importing raw 3D
data.
Gamestudio files
Gamestudio's editors produce several internal files for images, levels, models,
and terrains (see also Entities
and Internal File Formats):
- WMP files are created by WED and contain the level lighting, textures and
geometry, plus references to additional files for models, terrain, sprites,
and sound
source.
Once
they
are compiled they become WMB files that can be read by the engine.
- WAD files are created by WED and contain texture collections.
External WAD files from Quake and Halflife can be imported.
- MDL files are created by MED and used for animated models.
They support bones and vertex animation, multiple meshes and textures, materials
and shaders. They are not identical with Quake MDL files,
although the engine also accepts models in the Quake
MDL format.
- HMP files are created by MED and used for terrain. They contain the height
values and the terrain textures.
► latest
version online