The *real* HODs and ship patching questions thread

  1. I’m looking at the old Vaygr carrier HOD in CFHODED, and the new Vaygr carrier HOD in HWRM. Did these get mirrored/flipped at some point? Because in CFHODED the comm tower is on one side of the ship, and in HWRM it is on the other side of the ship.

  2. I’m trying to patch some new hardpoints into the HWRM Vaygr carrier model and have achieved some success. The new production modules appear in the correct positions. However, they are skewed/squished/rotated terribly. I made sure to enter the Direction, Position and Rest values exactly as seen in CFHODED. Should I be entering them differently? Does it matter if the Direction and Rest nodes are not nested inside the Position node?

Here is the old HW2C ship:

Here is the new HWRM ship that I’m having trouble with:

Any help would be appreciated.

@BitVenom

Here are the contents of my hardpoints.lua.

Patch_Priority = 3.0
Patch_Exclusive = 0
Patch_Ops = {
  hp_def = {        -- force the joints to understand change...
    root = "Root",
    name = "NavLightLimit1",
    pos = { 0, 127.1599, 150.0582 },
    rot = { 0, 0, 0 },
    axis = { 0, 0, 0 },
  },

  hp_0 = {
    root = "Root",
    name = "HardPoint_Production2_Position",
    pos = { 39.29835, -73.43829, -103.9631 },
    rot = { 0, 0, 0 },
    axis = { 90.000, -1.469, 0.000 },
  },
  hp_1 = {
    root = "HardPoint_Production2_Position",
    name = "HardPoint_Production2_Direction",
    pos = { 31.7192, -1.041359, 14.83499 },
    rot = { 0, 0, 0 },
    axis = { 0.000, 0.000, 134.275 },
  },
  hp_2 = {
    root = "HardPoint_Production2_Position",
    name = "HardPoint_Production2_Rest",
    pos = { 1.276599, 49.78736, 1.831868E-15 },
    rot = { 0, 0, 0 },
    axis = { -90.000, 0.000, -1.469 },
  },

  hp_3 = {
    root = "Root",
    name = "HardPoint_Production3_Position",
    pos = { -39.27179, -73.4791, -105.6596 },
    rot = { 0, 0, 0 },
    axis = { 90.000, 0.754, 180.000 },
  },
}

Here is a screenshot of the misaligned production hardpoint.

It’s not squished in this pic, because I changed the root of the “HardPoint_Production2_Direction” and “HardPoint_Production2_Rest” nodes to something other than “Root”. If I set it to “Root”, then the module is flattened and skewed at a weird angle.

Oh! It will be skewed because your script is manually stating the rest/direction - and look at those values - they aren’t spatially orthogonal… your are ‘bending’ that object with a bad matrix.

Remember, the Dir/Rest are children of the Position, meaning they are declared relative to it.

Direction is usually up, Rest is forward. So instead just try:

0, 10, 0 for Direction’s pos
0, 0, 10 for Rest’s pos

If you need to orient it beyond that, the base position’s ‘rot’ isn’t working for that?

Honestly, you shouldn’t need Dir/Rest at all…

  1. I’m copying the values straight from CFHODED, so I don’t know how to correct them manually. Should I subtract the parent coordinates from the child coordinates in order to get the delta?

  2. In “hardpoints.lua”, what values for the “root” parameter should I use for the child nodes? Are the values I posted above correct?

Right - and I’m telling you that for Direction/Rest, Direction is ‘up’ (positive Y), and Rest is ‘forward’ (positive Z) - shouldn’t require any magic or difficult math. Frankly you shouldn’t need them - you can just rotate Position…

How do I determine the correct rotation values? I don’t have a modeling program and I don’t know how to model.

Okay, I tried rotating like this:

hp_0 = {
  root = "Root",
  name = "HardPoint_Production2_Position",
  pos = { 39.29835, -73.43829, -103.9631 },
  rot = { 0, 45, 0 },
  axis = { 0, 0, 0 },
},

However, I see no difference in the game. Do I need to specify an axis too? Do I use radians or degrees?

Degrees, I think.

Lemme screw around with it and get you a solid example - but it won’t be until tomorrow, I am out of office now.

I can confirm that this patch system use radians.
And when I was trying to use it, I found that I have to set up Direction/Rest point, or the Rot value of the Position point won’t take effect?

Well, that’s what I get for talking without source code handy :wink:

So - that should still mean you can use basic direction (0,1,0)/rest (0,0,1) - and rotate the position, I think…

So here is the example I write for our team. I’ve translated those comments into English.

        -------------------------------------------------------------
        ------patch001.lua-------2016/6/9---------
        --By 9CCNMOD Team Lone_wolf
        --Add three hardpoints to hgn_minelayercorvette for FXMOD hgn_multiguncorvette
        -------------------------------------------------------------
        -------------------------------------------------------------

        Pi=3.1415927	--Patch file use radians, so we set a Pi here

        Patch_Priority = 3.0	--Priority
        Patch_Exclusive = 0	--not really useful for us
        Patch_Ops = 		--add hardpoints in this table
        { 
        	hp_0 = 		--hardpoint uses"hp_"+num as their names

        	{
        		root = "Root",		--these values should be easy to understand
        		name = "Hardpoint_TurretTop_Position",
        		pos = { 0.0, 6.2082, -3.627227 },
        		rot = { 0.0, 0.0, 0.0 },
        		axis = { 0.0, 0.0, 0.0 },
        	},
        	--notice that after this update, we do not need Rest and Direction if the position doesn't need rot.
        	--but if we need to use rot for the Position point, it seems that we still have to set up the Rest and Direction point
           --so here we only omit Rest and Direction for the point for the turret at the top of the ship 
        	-----------------------------------------
        	hp_1 = 
        	{
        		root = "Root",
        		name = "Hardpoint_TurretLeft_Position",
        		pos = { 8.212759, 3.735897,-12.44839 },
        		rot = { 0.0, 0, -16.779*Pi/180},	--attention, radians here
        		axis = { 0.0, 0.0, 0.0 },
        	},
        	hp_4 = 		--Pay attention to this number. I've found that it seems
    --numbers of "Child Points" like Position and Rest must bigger than all those 
    --"Upper Points", so I use hp_4 instead of hp_2 here
        	{											
        		root = "Hardpoint_TurretLeft_Position",
        		name = "Hardpoint_TurretLeft_Rest",
        		pos = { 0, 0, 10 },
        		rot = { 0.0, 0.0, 0},
        		axis = { 0.0, 0.0,0},
        	},
        	hp_5 = 
        	{
        		root = "Hardpoint_TurretLeft_Position",
        		name = "Hardpoint_TurretLeft_Direction",
        		pos = { 0, 10, 0 },
        		rot = { 0.0, 0.0, 0},
        		axis = { 0.0, 0.0,0},
        	},
        	---------------------------------------------
        	hp_2 = 
        	{
        		root = "Root",
        		name = "Hardpoint_TurretRight_Position",
        		pos = { -8.213, 3.736, -12.448 },
        		rot = { 0.0, 0.0, 16.779*Pi/180},
        		axis = { 0.0, 0.0,0},
        	},
        	hp_6 = 
        	{
        		root = "Hardpoint_TurretRight_Position",
        		name = "Hardpoint_TurretRight_Rest",
        		pos = { 0, 0, 10 },
        		rot = { 0.0, 0.0, 0},
        		axis = { 0.0, 0.0,0},
        	},
        	hp_7 = 
        	{
        		root = "Hardpoint_TurretRight_Position",
        		name = "Hardpoint_TurretRight_Direction",
        		pos = { 0, 10, 0 },
        		rot = { 0.0, 0.0, 0},
        		axis = { 0.0, 0.0,0},
        	},
        	---------------------------------
        	hp_3 = 		--and I have to add a point that already exist in the HOD 
    				--to make all my patch work take effect														
        	{																							
        		root = "Root",															
        		name = "Hardpoint_TurretBottom_Position",			
        		pos = { 0.0, -4.1154, 0.3430557 },						
        		rot = { 0.0, 0, Pi},
        		axis = { 0.0, 0.0, 0.0 },
        	},
        }
2 Likes

Okay, I am now using this:

Patch_Priority = 3.0
Patch_Exclusive = 0
Patch_Ops = {
  hp_0 = {        -- force the joints to understand change...
    root = "Root",
    name = "NavLightLimit1",
    pos = { 0, 127.1599, 150.0582 },
    rot = { 0, 0, 0 },
    axis = { 0, 0, 0 },
  },

  hp_1 = {
    root = "Root",
    name = "HardPoint_Production2_Position",
    pos = { 39.29835, -73.43829, -103.9631 },
    rot = { rad(45), rad(45), rad(45) },
    axis = { 0, 0, 0 },
  },
  hp_3 = {
    root = "HardPoint_Production2_Position",
    name = "HardPoint_Production2_Rest",
    pos = { 0, 0, 10 },
    rot = { 0, 0, 0 },
    axis = { 0, 0, 0 },
  },
  hp_4 = {
    root = "HardPoint_Production2_Position",
    name = "HardPoint_Production2_Direction",
    pos = { 0, 10, 0 },
    rot = { 0, 0, 0 },
    axis = { 0, 0, 0 },
  },

  hp_2 = {
    root = "Root",
    name = "HardPoint_Production3_Position",
    pos = { -39.27179, -73.4791, -105.6596 },
    rot = { 0, 0, 0 },
    axis = { 90.000, 0.754, 180.000 },
  },
}

But the module is still isn’t affected.

That’s weird. It should work…

But, anyway I think there’s always something weird about this patch system…

These pics were when we were trying to add a subsystem (a resource container) to the resource collector…

Notice that we used the exact same code, but the pos and rot of this subsystem varied each time we start a new match…
@BitVenom
We finally understand that we can omit Rest and Direction here, and we must add a point that already in the HOD file. But anyway I’m just curious about why it will become a random thing?

These were the codes we used:

Pi=3.1415927	

Patch_Priority = 3.0	
Patch_Exclusive = 0
Patch_Ops = 	 
{ 
hp_0 = 	 

{
root = "Root",	
name = "Hardpoint_Container_Position",
pos = { 0.0, 0.0, 0.0 },
rot = { 0.0, 0.0, 0.0 },
axis = { 0.0, 0.0, 0.0 },
},
hp_1 = 	
{	 
root = "Hardpoint_Container_Position",
name = "Hardpoint_Container_Rest",
pos = { 0, 0, 10 },
rot = { 0.0, 0.0, 0},
axis = { 0.0, 0.0,0},
},
hp_2 = 
{
root = "Hardpoint_Container_Position",
name = "Hardpoint_Container_Direction",
pos = { 0, 10, 0 },
rot = { 0.0, 0.0, 0},
axis = { 0.0, 0.0,0},
},
}

--in ship file
StartShipHardPointConfig(NewShipType,"HP_Container","Hardpoint_Container","System","Innate","Ship","dtm4_hw2container","","","","","","","","");

I got flat, skewed stuff too when I set the child nodes to use “Root” as the root.

CFHodEd has always been mirrored when compared to in-game.

I tidied up the code a bit, and tried configuring the second module.

Patch_Priority = 3.0
Patch_Exclusive = 0
Patch_Ops = {
  hp_0 = {        -- force the joints to understand change...
    root	= "Root",
    name	= "NavLightLimit1",
    pos		= { 0, 127.1599, 150.0582 },
    rot		= { 0, 0, 0 },
    axis	= { 0, 0, 0 },
  },
  hp_1 = {
    root	= "Root",
    name	= "HardPoint_Production2_Position",
    pos		= { 39.27179, -73.4791, -105.6596 },
    rot		= { rad(45), rad(45), rad(45) },
    axis	= { 0, 0, 0 },
  },
  hp_2 = {
    root	= "Root",
    name	= "HardPoint_Production3_Position",
    pos		= { -39.27179, -73.4791, -105.6596 },
    rot		= { rad(45), rad(45), rad(45) },
    axis	= { 0, 0, 0 },
  },

--------------------------------------------------------------------------------
  hp_3 = {
    root	= "HardPoint_Production2_Position",
    name	= "HardPoint_Production2_Rest",
    pos		= { 0, 0, 10 },
    rot		= { 0, 0, 0 },
    axis	= { 0, 0, 0 },
  },
  hp_4 = {
    root	= "HardPoint_Production2_Position",
    name	= "HardPoint_Production2_Direction",
    pos		= { 0, 10, 0 },
    rot		= { 0, 0, 0 },
    axis	= { 0, 0, 0 },
  },

--------------------------------------------------------------------------------
  hp_5 = {
    root	= "HardPoint_Production3_Position",
    name	= "HardPoint_Production3_Rest",
    pos		= { 0, 0, 10 },
    rot		= { 0, 0, 0 },
    axis	= { 0, 0, 0 },
  },
  hp_6 = {
    root	= "HardPoint_Production3_Position",
    name	= "HardPoint_Production3_Direction",
    pos		= { 0, 10, 0 },
    rot		= { 0, 0, 0 },
    axis	= { 0, 0, 0 },
  },
}

The result is that the first module remains unaffected in its default state, but the second module is oriented properly. I don’t see any differences that would account for this.

My guess is that LUA is changing the order of these when parsing them… I’m going to have to look at this, which I can do shortly, after Monday stuff in the office :slight_smile:

2 Likes

you meant Meetingday ? ^^

The reason for the oddness has been found, edited, and a new patch_preview build is underway… I’ll update the thread for it elsewhere.

The item related to this though, is that LUA parses tables, but doesn’t retain order unless the entries are numbered - which because we use naming, they aren’t.

So, instead it is now possible to nest tables of edits inside of each other…

Patch_Priority = 3.0
Patch_Exclusive = 0
Patch_Ops = {
    hp_1 = {
        root    = "Root",
        name    = "HardPoint_Production2_Position",
        pos        = { 39.27179, -73.4791, -105.6596 },
        rot        = { rad(45), rad(45), rad(45) },
        axis    = { 0, 0, 0 },

        subs = {
            hp_3 = {
                root    = "HardPoint_Production2_Position",
                name    = "HardPoint_Production2_Rest",
                pos        = { 0, 0, 10 },
                rot        = { 0, 0, 0 },
                axis    = { 0, 0, 0 },
            },
            hp_4 = {
                root    = "HardPoint_Production2_Position",
                name    = "HardPoint_Production2_Direction",
                pos        = { 0, 10, 0 },
                rot        = { 0, 0, 0 },
                axis    = { 0, 0, 0 },
            },
        },
    },
    hp_2 = {
        root    = "Root",
        name    = "HardPoint_Production3_Position",
        pos        = { -39.27179, -73.4791, -105.6596 },
        rot        = { rad(45), rad(45), rad(45) },
        axis    = { 0, 0, 0 },

        subs = {
            hp_5 = {
                root    = "HardPoint_Production3_Position",
                name    = "HardPoint_Production3_Rest",
                pos        = { 0, 0, 10 },
                rot        = { 0, 0, 0 },
                axis    = { 0, 0, 0 },
            },
            hp_6 = {
                root    = "HardPoint_Production3_Position",
                name    = "HardPoint_Production3_Direction",
                pos        = { 0, 10, 0 },
                rot        = { 0, 0, 0 },
                axis    = { 0, 0, 0 },
            },
        },
    },
}

Notice that the ‘edit existing thing’ entry is gone - it isn’t required for patch_preview.

2 Likes