GMF

From RA2Wiki
Jump to navigation Jump to search

The GMF (Gabriel Meta File) is a 3D geometry and physics properties format used by GI in it's games. It derivates from the ASE file format. It is closely tied to 3dsmax and havok, but can also be edited using notepad, a paper and a pencil. It can either be used to describe a component, arena or even a the max_sphere.gmf file.

These files can be either compiled or uncompiled. In the uncompiled form, it's an easily editable, ASCII file conating vertex coordinates, faces and face normals. To convert between these two formats, you can use Dummee's GMF compiler/decompiler.

Structure of ASCII GMF file

The ASCII GMF File is very strict, as the only program that is able to read and compile them is dummee's GMF Compiler, which will throw exceptiosn if the file is badly formatted.

Header

GMA
*GABRIEL_ASCIIEXPORT	3
*MODEL_TYPE	Basic Model


The header contains information about the version (always 3) nad model type (Basic Model)

Scene Info

*SCENE
{
	*SCENE_FILENAME	airtank_4x1.max
	*SCENE_FIRSTFRAME	0
	*SCENE_LASTFRAME	100
	*SCENE_FRAMESPEED	30
	*SCENE_TICKSPERFRAME	160
	*SCENE_BACKGROUND_STATIC	0xFFFFFF
	*SCENE_AMBIENT_STATIC	0x191919
}

Thsi contains information about the 3dsmax scene the GMF was exported from, including name and basic lighting.

Material List

The material list first stats with:

*MATERIAL_LIST
{
	*MATERIAL_COUNT	2
	*MATERIAL
	{

Which is the beggining of the list of materials, and contains the number of them.

Then, each material is listed like this:

		*MATERIAL_REF_NO	0
		*MATERIAL_NAME	airtank
		*MATERIAL_CLASS	Standard
		*MATERIAL_AMBIENT	0x6B9DD4
		*MATERIAL_DIFFUSE	0x6B9DD4
		*MATERIAL_SPECULAR	0xCEFF88
		*MATERIAL_SHINE	0.100000
		*MATERIAL_SHINESTRENGTH	0.640000
		*MATERIAL_TRANSPARENCY	0.000000
		*MATERIAL_WIRESIZE	1.000000
		*MATERIAL_SHADING	Blinn
		*MATERIAL_XP_FALLOFF	0.000000
		*MATERIAL_SELFILLUM	0.000000
		*MATERIAL_FALLOFF	Other
		*MATERIAL_XP_TYPE	Filter

This is pretty self-explanatory, jsut basic material information.

Each material can (and probably has) a texture list attached to it:

		*TEXTURE_LIST
		{
			*TEXTURE_COUNT	1
			*TEXTURE
			{
				*MAP_NAME	Map #0
				*MAP_CLASS	Bitmap
				*BITMAP	airtank.bmp
				*MAP_AMOUNT	1.000000
				*MAP_DIFFUSE
				*MAP_TYPE	Screen
				*UVW_U_OFFSET	0.000000
				*UVW_V_OFFSET	0.000000
				*UVW_U_TILING	1.000000
				*UVW_V_TILING	1.000000
				*UVW_ANGLE	0.000000
				*UVW_BLUR	1.000000
				*UVW_BLUR_OFFSET	0.000000
				*UVW_NOISE_AMT	1.000000
				*UVW_NOISE_SIZE	1.000000
				*UVW_NOISE_LEVEL	1
				*UVW_NOISE_PHASE	0.000000
				*BITMAP_FILTER	Pyramidal
				*BITMAP_MAP_CHANNEL	1
			}
		}

Which is has a very similar syntax to the material list / material enumeration.

After listing all the materials, we end the material list with:

}

Object List

Here comes the main part of the GMF file, the object list. It starts like this:

*OBJECT_LIST
{
	*OBJECT_COUNT	5

which tells us how much objects there is, and ends like so:

}

Between these two snippets we can find any object type that is listed below.

GEOMOBJECT

The GEOMOBJECT is a 3D mesh with it's texture coordinates data, and position in space. It starts with:

	*GEOMOBJECT
	{
		*NODE_NAME	airtank_display
		*NODE_SHADEVERTS	0

Here we find the name of the mesh, and the the NODE_SHADEVERTS property (unknown). After this, comes a transformation matrix (TM), which positions and orientates the object using a 3x4 matrix:

		*NODE_TM
		{
			*NODE_NAME	airtank_display
			*TM_ROW0 1.000000	0.000000	0.000000
			*TM_ROW1 0.000000	1.000000	0.000000
			*TM_ROW2 0.000000	0.000000	1.000000
			*TM_ROW3 0.000000	0.000000	0.000000
		}

Which has the same name as the mesh. Bold text Next, we have the MESH object, which starts like so:

*MESH
		{
			*TIMEVALUE	0
			*MESH_NUMVERTEX	29
			*MESH_NUMFACES	54

and ends like so:

			*BACKFACE_CULL	1
			*MATERIAL_REF	0
		}

The first part contains the number of vertices (points in space) and faces, which are then described in lists of type:

  • MESH_VERTEX_LIST (number of vertex, x, y and z coordinates)
  • MESH_FACE_LIST (three vertex id's combined in a triangle)
  • MESH_FACENORMALS (with each FACENORMAL containing three VERTEXNORMALS, more information abotu normals can be found in 3D game programming manuals)
  • MESH_TFACE (confusing, contains infomartion about texture mapping)
  • MESH_TVERT (confusing, contains infomartion about texture mapping)
  • MESH_CFACE (unknown)
  • MESH_CVERT (unknown)

GMID_ATTACHMENTPT

This is an attachment point (in components) or a starting point (in arenas). The structure follows:

	*GMID_ATTACHMENTPT
	{
		*NODE_NAME	Point01
		*NODE_TM
		{
			*NODE_NAME	Point01
			*TM_ROW0 -1.000000	0.000000	-0.000000
			*TM_ROW1 0.000000	-0.000000	-1.000000
			*TM_ROW2 -0.000000	-1.000000	0.000000
			*TM_ROW3 0.000000	-0.045408	0.000000
		}
		USER DATA	type = attach
id = 1
attach = base_F
	}

There are three main parts in this snippet:

  • The name of the point.
  • The transformation matrix of the point.
  • The USER DATA of the point.

GMID_HAVOK_SIMOBJECT

This contains ifnromation about the simulation. The property names are pretty self-explanatory:

	*GMID_HAVOK_SIMOBJECT
	{
		*NODE_NAME	(null)
		*GRAVITY	0.000000 -9.809980 0.000000
		*WORLDSCALE	39.369999
		*SIMTOLERANCE	0.100000
		*RESOLVER	3
		*INCLUDE_DRAG	0
		*LINEAR_DRAG	0.000000
		*ANGULAR_DRAG	0.000000
		*INCLUDE_DEACTIVATOR	1
		*SHORTFREQ	5.000000
		*LONGFREQ	0.100000
		*USE_FAST_SUBSPACE	1
		*UPDATES_PER_TIMESTEP	1.000000
		*NUM_COLLISION_PAIRS	0
	}

GMID_HAVOK_RBCOLLECTION

A RBCollection (or Rigid Body Collection) is a list of objects that take part in the physical simulation of the game, paired with it's physical porperties (mass, collision, etc).

The header of the RBCollection is:

	*GMID_HAVOK_RBCOLLECTION
	{
		*NODE_NAME	RBCollection01
		*NUM_DISABLED_PAIRS	0
		*SOLVER_TYPE	0
		*COUNT	1

It includes the number of RBodies.

Then comes a list:

		*GMID_HAVOK_RIGIBODY_LIST
		{
			*COUNT	1
			{

Which AGAIN contains the number of RBodies.

The structure of a RBody is as follows:

			*GMID_HAVOK_RIGIDBODY
			{
				*NODE_NAME	airtank_display
				*MASS	10.000000
				*ELASTICITY	0.300000
				*FRICTION	0.300000
				*OPTIMIZATION_LEVEL	0.500000
				*UNYIELDING	0
				*SIMULATION_GEOMETRY	3
				*GEOMETRY_PROXY_NAME	airtank_collision
				*USE_DISPLAY_PROXY	0
				*DISABLE_COLLISIONS	0
				*INACTIVE	0
				*DISPLAY_PROXY_NAME	(null)
				*NODE_TM
				{
					*NODE_NAME	airtank_display
					*TM_ROW0 1.000000	0.000000	0.000000
					*TM_ROW1 0.000000	1.000000	0.000000
					*TM_ROW2 0.000000	0.000000	1.000000
					*TM_ROW3 0.000000	0.000000	0.000000
				}
				*HAVOK_GEO_TYPE	Standard
				*NUMBER_OF_CHILDREN	0
			}

The most important properties are:

  • NODE_NAME which is the name of the mesh we are describing
  • MASS which is the mass of the object
  • SIMULATION_GEOMETRY which is an integer value that decides if the collision data comes from the convex mesh (1), the concave mesh (2), a proxy concave mesh (3) or a proxy convex mesh (4)
  • GEOMETRY_PROXY_NAME is the name of the collision mesh if SIMULATION_GEOMTRY was 3 or 4.
  • DISPLAY_PROXY_NAME is the name of display proxy/mesh, if the NODE_NAME is a collision mesh.
		}
	}


For arenas only

Arena start location

The info is in the arena's gmf. After you decompile it, just 'search' for the below text ""GMID_ATTACHMENTPT" (there are 4 starting points, below is starting point 1):

   *GMID_ATTACHMENTPT
   {
   *NODE_NAME Point01
   *NODE_TM
   {
   *NODE_NAME Point01
   *TM_ROW0 0 0 -1
   *TM_ROW1 0 1 0
   *TM_ROW2 1 0 0
   *TM_ROW3 -17 1 12   <-- This ROW X Y Z
   }
   USER DATA type = startpoint
   id = 1
   }

Just edit the X and Z positions (center is Y) until you get it to start where you want.

(PS: the indenting in the gmf must be kept as is)


to change how high the robot starts just adjust the Y parameter in the said triad.