top of page

.HOD Editing continued

4. Theory:

e. HOD Scripting

CFHodEd has a feature, which can be pretty useful at times, and can also automate (to some extent) boring tasks. To accomplish this, scripting has been implemented in CFHodEd. You can import, what is called, HOD Scripts, in to automatically create\convert all the information in them into HOD format. These scripts are called HSC (Hod SCripts). You import these scripts using File->Import->HOD Script (HSC), and CFHodEd parses them. You can use this feature for multiple purposes like:

1.      Automatically importing a large group of meshes

2.      Automatically adding a group of joints, i.e. a hierarchy of joints, which can be used to add joints with same base name, and same hierarchy (templates of joints, not in-built in CFHodEd)

3.      Automatically duplicate dockpaths with same information, which can be changed later by you (this would be useful in symmetrical ships)

4.      And so on… (The possibilities depend on usage)

 

HOD scripts are essentially like C++ source code. They follow same format as in C++

·   Comments start from “//”

·   You may keep any amount of spaces\tabs for your ease of view

·   Paths are relative to the path of the script

·   Arguments for functions are in brackets

·   Anything after a bracket close [“)”] is ignored

·   You may optionally add a “;” to denote end of sentence

 

Following are the functions that can be used and their usage:

 

Scale

To set the scale of objects that are imported AFTER call to this:

HOD__ImportScale(<X Scale>, <Y Scale>, <Z Scale>);

Ex. HOD__ImportScale(2, 2, 2);

 

To set the scale of all objects that are present TILL now:

HOD__CompleteScale(<X Scale>, <Y Scale>, <Z Scale>);

Ex. HOD__CompleteScale(2, 2, 2);

 

Textures

To add a texture (process is same for both DDS and TGA; and both need tags):

LMIP_Add(<relative path to the texture>);

Ex. LMIP_Add("\Texture[1].dds");

LMIP_Add("\Texture[1].tga");

 

Materials

To add a material:

STAT_Add(<name>, <shader name>, <number of layers (parameters));

Ex. STAT_Add("hw2Shader", "ship", 2);

STAT_Add("hw2Shader1", "background", 2);

 

To set properties of a parameter:

STAT_SetParamter(<material number, starting from 1>, <parameter number, starting from 1>, <type of parameter (4 = colour; 5 = texture)>, <colour R; value from 0-1; ignored when type is not 4>,  <colour G; value from 0-1; ignored when type is not 4>, <colour B; value from 0-1; ignored when type is not 4>, <colour A; value from 0-1; ignored when type is not 4>, <index to texture, from 1; ignored when type is not 5>, <name of this parameter, like "$diffuse", "$glow", etc; ignored when type is not 5>);

Ex. STAT_SetParamter(1, 1, 5, 1, 1, 1, 1, 1, "$diffuse");

STAT_SetParamter(1, 2, 5, 2, 1, 1, 1, 1, "$glow");

STAT_SetParamter(1, 1, 4, 1, 1, 1, 1, 0, "");

STAT_SetParamter(1, 2, 5, 1, 1, 1, 1, -1, "");

 

Geometry

To add a object:

MULT_Add(<name>, <is a goblin>, <parent Name>, <number of LoDs; 4 will give LoDs 0-3, 3 will give LoDs 0-2, 2 will give LoD 0 and LoD 1, etc; ignored when object is a goblin>);

Ex. MULT_Add("Root_mesh", "Root", 0, 4);

MULT_Add("Root_goblins", "Root", 1, 1);

 

To replace a LoD with proper geometry:

MULT_SetLoD(<geometry number, starting from 1>, <LoD number, starting from 0>, <relative path to OBJ file>);

Ex, MULT_SetLoD(1, 0, "\Root_mesh_LOD0.obj");

MULT_SetLoD(1, 0, "\Root_mesh_LOD0.obj");

MULT_SetLoD(1, 1, "\Root_mesh_LOD1.obj");

MULT_SetLoD(1, 2, "\Root_mesh_LOD2.obj");

MULT_SetLoD(1, 3, "\Root_mesh_LOD3.obj");

MULT_SetLoD(2, 0, "\Root_mesh_GOBG.obj");

 

Hardpoints

To add a joint\hardpoint:

[Note: Rotations\Axis are\is in degrees]

HIER_Add(<name>, <parent name>, <X position>, <Y position>, <Z position>, <X rotation>, <Y rotation>, <Z rotation>, <X scale>, <Y scale>, <Z scale>, <X Axis>, <Y Axis>, <Z Axis>, <Free to rotate in X Axis? >, <Free to rotate in Y Axis? >, <Free to rotate in Z Axis? >);

Ex. HIER_Add("Hardpoint1", "Root", 10.5, -15, 300, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1);

 

Battle Scar Reference Meshes

[Automatically handled by geometry import]

 

Collision Meshes

To add a collision mesh:

COLD_Add(<parent name, pointing to a joint>, <path to OBJ containing mesh>);

Ex. COLD_Add("Root", "\Root_mesh_COLD.obj");

 

Engine Trail Shape

To add a ETSH (Engine Trail SHape):

ETSH_Add(<name>, <parent name>, <path to a OBJ>);

Ex. ETSH_Add("EngineShape1", "EngineNozzle1", "\EngineShape1_ETSH.obj");

 

Engine Burn

To add a BURN (Engine BURN):

BURN_Add(<name>, <parent name>, <path to a OBJ>);

Ex. BURN_Add("EngineBurn1", "EngineNozzle1", "\EngineShape1_BURN.obj");

 

Engine Glow

To add a GLOW (Engine GLOW):

GLOW_Add(<name>, <parent name>, <level of detail>, <path to OBJ>);

Ex. GLOW_Add("EngineGlow1", "EngineNozzle1", 0, "\EngineGlow1_GLOW0.obj");

GLOW_Add("EngineGlow1_LOD1", "EngineNozzle1", 1, "\EngineGlow1_GLOW1.obj");

 

NavLights

To Add a NAV Light:

[Note: Colour is a decimal value; from 0.0 to 1.0]

NAVL_Add(<joint to which NavLight is attached>, <section>, <size>, <phase>, <frequency>, <style>, <colour (Red)>, <colour (Green)>, <colour (Blue)>, <colour (Alpha)>, <distance>, <Is Visible? >, <Cast Light On High End Systems only? >);

Ex. NAVL_Add("NavLight1", 0, 5, 0.5, 2, "default", 1, 1, 0, 1, 600, 1, 1);

 

Markers

To add a marker:

[Note: Rotations are in radians]

MRKR_Add(<name>, <parent Name>, <start Keyframe Time>, <end Keyframe Time>, <X Position>, <Y Position>, <Z Position>, <X Rotation>, <Y Rotation>, <Z Rotation>, <num. animation chunks>);

Ex. MRKR_Add("marker1", "Root", 0, 0, 15, 65, -150, 0, 45, 0, 0);

MRKR_Add("marker1", "Root", 0, 1, 15, 65, -150, 0, 45, 0, 2);

 

To set an animation chunk to a marker:

ANIM_Set(<marker number>, <animation chunk number>, <curve Name>, <num. Key Frames>, <pre Infinity>, <post Infinity>);

Ex. ANIM_Set(1, 1, "marker1_translateX", 2, 0, 0);

 

To set a keyframe for a animation chunk in a maker:

[Note: Rotations are in radians (i.e. when the "channel" is "*_rotate?"]

[Also, Scale is not applied here]

KEYF_Set(<marker number>, <animation chunk number>, <keyframe number>, <time>, <value>, <in-Tangent X>, <in-Tangent Y>, <out-Tangent X>, <out-Tangent Y>);

Ex. KEYF_Set(1, 1, 0, 0, 1, 0, 1, 0);

 

Dockpaths

To add a dockpath:

DOCK_Add(<dock path Name>, <dock path Parent name, this is "world">, <is this exit>, <is this latch>, <families that can dock>, <use animation>, <names of lined paths>, <number of keyframes, MUST BE MORE THAN 2! >);

Ex. DOCK_Add("path1", "world", 1, 1, "Utility", 0, "", 2);

 

To set Keyframe data:

DOCK_SetKeyframe(<dockpath number, starting from ONE>, <Keyframe number, starting from ONE>, <X position>, <Y position>, <Z position>,  <X rotation>, <Y rotation>, <Z rotation>, <Use Rotation>, <Point Tolerance>, <Drop Focus>, <Max Speed>, <Check Rotation>, <Force Close Behavior>, <Player Is In Control>, <Queue Origin>, <Use Clip-Plane>, <Clear Reservation>);

Ex. DOCK_SetKeyframe(1, 1, 0, 0, 0, 0, 0, 0, 0, 5, 0, 500, 0, 0, 0, 0, 0, 0);

DOCK_SetKeyframe(1, 2, 0, 0, 10, 0, 0, 0, 0, 100, 0, 500, 0, 0, 0, 0, 0, 1);

 

Boundary Vertices

To set the number of BNDVs:

BNDV_SetNumVertices(<num. Vertices);

Ex. BNDV_SetNumVertices(8);

 

To set a BNDV vertex:

BNDV_SetVertex(<vertex number>, <X position>, <Y Position>, <Z Position>);

Ex. BNDV_SetVertex(1, -50, -25, -100);

 

To auto-calculate BNDV:

BNDV_AutoCalc(<BNDV enlargement factor; this is applied EVEN after the user chooses to slightly enlarge BNDV>);

Ex, BNDV_AutoCalc(1);

 

Background Meshes

To add a background mesh:

BGMS_Add(<relative path to the mesh>, <relative path to the texture, which is to be used for colourizing the mesh>)

Ex. BGMS_Add("\Part1.obj", "\Texture.tga");

 

Lights

To add a light:

[Note: Colour\Specularity is a decimal number, with value 0.0 to 1.0]

LITE_Add(<name>, <type: Ambient Light = 0; Area Light = 1; Directional Light = 2; Point Light = 3; Spot Light = 4; Volume Light = 5>, <X position>, <Y position>, <Z position>, <R colour>, <G colour>, <B colour>, <R specularity>, <G specularity>, <B specularity>, <attenuation>, <attenuation distance>);

Ex. LITE_Add("Light0", 0, 0, 100, 0, 1, 1 1,0.5, 0.5, 0.5, 0, 0);

 

Simple\Wire-frame Meshes

To add a simple\Wireframe mesh:

SIMP_Add(<name>, <path to the mesh>);

Ex, SIMP_Add("Box", "\Box_SIMP.obj");

 

 

5. Miscellaneous information:

Incase of any feature requests, questions, bugs, errors, either post at the Relic forums (Tanis Shipyards), or e-mail me at 4E534B@gmail.com

 

You may use source code of CFHodEd to derive Homeworld2 HOD editing programs, and mentioning my name is not necessary.

You may use source code of CFHodEd to derive (non-commercial) programs from it, but you must mention the name of the author(s).

You may use SIMPLe DRAW or SIMPLe DRAW X for non-commercial purposes, but you must mention that it was made by me, 4E534B; and that it uses DirectX 8.

 

CFHodEd is provided “as is”, without any warranty, of any kind, whether express or implied, or even fitness for any\particular purpose. In no way the author(s) of this program will be responsible for any kind of indirect, incidental, consequential damage of any kind.

bottom of page