Ship/Missile/Object Structures

So I’m formulating a list of Space Object structures, and here is what I have discovered so far:

(psuedocode)

class SobStatic {
    ????    alternativeHyperspaceA
    float?  alternativeHyperspaceTime
    ????    alternativeHyperspaceV
    ????    alwaysInRenderList
    string  ArmourFamily
    string  AttackFamily
    float   AttackPriorityMultiplier
    string  AutoFormationFamily
    string  AvoidanceFamily
    float   battleScarBudetNext, // take note of the spelling (Budet in the structure vs Budget in the ship files; bug?)
    float   battleScarBudgetLow
    float   battleScarCoverage
    string? blobName
    float?  blobNamePriority
    string  BuildFamily
    float   canBlink
    float   canHaveFog
    float   canHaveShadows
    string  CollisionDamageFamily
    string  CollisionFamily
    float   deadSobFadeTime
    float?  detailLevel
    string  displayedName
    string  DisplayFamily
    string  DockFamily
    float   dotRenderLimit
    float   downLOD
    float   goblinsOff
    float   goblinsStartFade
    float   healthBarStyle
    float   maxFalloffDamage
    float   maxFalloffDamageDist
    float   maxhealth
    float   meshRenderLimit
    float   minFalloffDamageDist
    float   minimumZoomFactor
    float   minLOD
    float   minRegenTime
    float   mouseOverMaxFadeSize
    float   mouseOverMinFadeSize
    float   nlips
    float   nlipsFar
    float   nlipsFarRange
    float   nlipsRange
    float[]? pixelColour
    float   pixelSize
    float   preciseATILimit
    float   preciseSelectionLimit
    float   regentime
    float   relativeMoveFactor
    float   selectionLimit
    float   selectionPriority
    float   selectionSizeMax
    float   selectionSizeMin
    float?  SMFadeDistance
    float?  SMFadeMinAlpha
    float?  SMHighlightDistMax
    float?  SMHighlightDistMin
    float?  SMPixelSize
    string  SMRepresentation
    float   sobDescription
    float   sobDieTime
    float   TODistanceDisappear0
    float   TODistanceDisappear1
    float   TODistanceDisappear2
    float   TODistanceFade0
    float   TODistanceFade1
    float   TODistanceFade2
    float   TOGroupMergeSize
    float   TOGroupScale
    string  TOIcon
    float   TOScale
    string  UnitCapsFamily
    string  UnitCapsShipType
    float   upLOD
    float   visibleInSecondary
}

class SobRigidBodyStatic extends SobStatic {
    float   mass
}

class SobPointMassStatic extends SobStatic {
    float   mass
}

class SobWithMeshStatic extends SobRigidBodyStatic {
    float   accelerationAngle
    float   mainEngineAccelTime
    float   mainEngineBrakeTime
    float   mainEngineMaxSpeed
    float   rotationAccelTime
    float   rotationBrakeTime
    float   rotationMaxSpeed
    ????    shadowType
    float   thrusterAccelTime
    float   thrusterBrakeTime
    float   thrusterMaxSpeed
    float   tumbleDynamicX
    float   tumbleDynamicY
    float   tumbleDynamicZ
    float   tumbleSpecialDynamicX
    float   tumbleSpecialDynamicY
    float   tumbleSpecialDynamicZ
    float   tumbleStaticX
    float   tumbleStaticY
    float   tumbleStaticZ
}

class ResourceStatic extends SobRigidBodyStatic {
    float   angularFriction
    float   blobRadius
    float   linearFriction
    float   maxAngularVelocity
    float   maxVelocity
    float   pixelColourDepleted
    float   resourceValue
}

class SalvageStatic extends ResourceStatic {
    float   salvageSpeedFraction
}

class DustCloudStatic extends ResourceStatic {
    float   chargeable
    string  chargedLightningEffectName
    float   damageMultiplier
    string  lightningEffectName
}

class MissileStatic extends SobWithMeshStatic {
    float   accelerationAngle
    float   clusterAngle
    float   clusterDistance
    float   detectionDistance
    float   launchTime
    float   lifeTime
    float   noCollisionTime
    float   numberSubMunitions
    float   proximityDetonationDist
    float   slowdownFactor
    float   spiralsPerSecondMax
    float   spiralsPerSecondMin
    string  subMunitionName
    float   targetAngle
    float   trackingSpeedMultiplier
    float   tumbleSpeed
    string  weaponName
}

class SubSystemStatic extends SobRigidBodyStatic {
    float   activateHealthPercentage
    float   collateralDamage
    float   costToBuild
    float   damageOverflowFactor
    float   inactiveTimeAfterDamage
    float   innate
    float   isResearch
    float   timeToBuild
    string  type
    string  typeString
    float   visible
}

class PebbleStatic extends SobStatic {}

class AsteroidStatic extends ResourceStatic {}

class NebulaStatic extends ResourceStatic {
    float   damageMultiplier
}

class CloudStatic extends SobStatic {}

class WeaponStatic {}

class ShipStatic extends SobWithMeshStatic {
    string  aggressiveFormation
    float   alliesCanAttack
    float   allowScuttle
    float   antiCorvetteValue
    float   antiFighterValue
    float   antiFrigateValue
    float   buildCost
    float   buildPriorityOrder
    float   buildTime
    float   canAttackAllies
    float   canBeDockForSalvageCapture
    float   chanceOfSpecialDeath
    float   collisionMultiplier
    string  controllerType
    float   corvetteValue
    string  defensiveFormation
    float   descendPitch
    float   detectionStrength
    string  dockFormation
    float   dockNrOfShipsInDockFormation
    float   dockQueueSelectionOccupiedMultiplier
    float   dockQueueSelectionQueueMultiplier
    float   dockTimeBeforeStart
    float   dockTimeBetweenTwoFormations
    float   dontDockWithOtherRaceShips
    float   dustCloudDamageTime
    float   fighterValue
    float   formationSpacing
    float   frigateValue
    float   goalReachEpsilon
    float   ignoreRaceWhenDocking
    float   isTransferable
    string  launchFormation
    float   launchNrOfShipsInDockFormation
    float   launchTimeBeforeStart
    float   launchTimeBetweenTwoFormations
    float   maxBankingAmount
    float   militaryUnit
    string  MinimalFamilyToFindPathAround
    string  mirrorAboveManeuver
    float   mirrorAngle
    string  mirrorBelowManeuver
    float   nbRestrictedHardpoints
    float   nebulaDamageTime
    float   neutralValue
    string  paradeData
    string  passiveFormation
    float   prmSensorRange
    string  queueFormation
    float   rearArmourDamage
    float   retaliationDistanceFromGoal
    float   retaliationRange
    float   secondaryTurnAngle
    float   secSensorRange
    float   shipHoldActive
    float   sideArmourDamage
    float   slideMoveRange
    float   sobSpecialDieTime
    ????    spawnShipOnDeath
    float   specialDeathSpeed
    string  specialTurnDownManeuver
    string  specialTurnLeftManeuver
    string  specialTurnRightManeuver
    string  specialTurnUpManeuver
    float   SquadronSize
    float   swayBobbingFactor
    float   swayOffsetRandomX
    float   swayOffsetRandomY
    float   swayOffsetRandomZ
    float   swayRotateFactor
    float   swayUpdateTime
    float   targetRandomPointXMax
    float   targetRandomPointXMin
    float   targetRandomPointYMax
    float   targetRandomPointYMin
    float   targetRandomPointZMax
    float   targetRandomPointZMin
    float   thrusterUsage
    float   unavailableWhenCaptured
    float   useTargetRandom
    float   visualRange
}

Note: Lua doesn’t actually differentiate between floats, integers, or booleans; it just calls them a number

These fields are set by calling New<SubSystem/Ship/Resource>Type.<fieldName> = value


Some interesting functions:

  • addMagneticField
  • printShipsFile
  • import
  • p_import
  • p_setpath
  • setMagneticFieldPenetration
  • setConcurrentBuildLimit (Ship scope?)

StartAsteroidConfig returns a pointer to a class of type AsteriodStatic
StartCloudConfig returns a pointer to a class of type CloudStatic
StartDustCloudConfig returns a pointer to a class of type DustCloudStatic
StartMissileConfig returns a pointer to a class of type MissileStatic
StartNebulaConfig returns a pointer to a class of type NebulaStatic
StartPebbleConfig returns a pointer to a class of type PebbleStatic
StartSalvageConfig returns a pointer to a class of type SalvageStatic
StartShipConfig returns a pointer to a class of type ShipStatic
StartSubSystemConfig returns a pointer to a class of type SubSystemStatic
StartWeaponConfig just creates a new class of type WeaponStatic, which is then internally modified by the relevant weapon configuration functions

3 Likes

I’m curious, how did you generate those lists ?

I think has been broken since classic, would be interesting to have it work

set concurrent build limit allows multiple queue for building (used on taiidan and kushan motherships)

magnetic field was added as part of a patch to fix field frigates and defenders

addMagneticField(NewShipType,<fieldname>, <radius>, <missile block percent>, <missile blocked effect>, <bullet block percent>, <bullet blocked effect>, <instant block percent>, <instant block effect>, <field effect>)

Yeah, I can’t find any references to it in the game files.

Yeah, I knew about that, I just wanted to point it out. As far as I can tell, there isn’t any upper bound on acceptable values – not that I’ve extensively tested it, though.

I should have though to look there, lol. Thanks.


In the .ship file, PrintTable(globals()), where PrintTable is a function defined by the following:

function PrintTable(t, indent)
    if (indent == nil) then
        indent = ""
    end
    if (type(t)=="table") then
        for key,val in t do
            if (type(val)=="table") then
                print(indent..key.." = {")
                PrintTable(val,indent.."  ")
                print(indent.."}")
            elseif (type(val)=="string") then
                print(indent..key..' = "'..val..'",')
            elseif (type(val)=="number") then
                print(indent..key.." = "..tostring(val)..",")
            else
                print(indent..key..", --"..tostring(val))
            end
        end
    else
        print(indent..tostring(t))
    end
end

Then with a little understanding of Lua, and HW2/RM Lua, I theorized how the C(++) class/struct implementation would look like behind the scenes.


This at least gives us a list of what actual values can be modified in a missile/ship/resource/etc file.

I have yet to test which functions are (technically) allowable for which static type.

1 Like

(disclaimer: I have no idea what this all is, what I’m looking at, what’s this thread about.)

I used spawnShipOnDeath, when I played with debris:

I would guess the mods that let the Pride of Hiigara to spawn a hyperspace core used it too.
It’s not working in HWRM you say? That’s kind of sad.

No disrespect, but I WISH it was anywhere near this simple ‘behind the scenes’. Oy Vey.

None taken, and no, I never assumed as much. Am I correct in my assumption that the code is written in C (or has that already been stated somewhere else)?

Anyways, I merely meant it as a top-level overview, not nitty-gritty detail-level.

C++/C - Across 15+ years of compilers, styles of syntax, structure, etc… It is really, really crazy stuff. And I won’t even attempt to claim we’ve made it ‘better’ - because we’re really just yet another group of cooks in the stew.

1 Like

I can imagine…

Cooks don’t normally get in the stew… but maybe that’s just how committed you guys were :wink:

1 Like

@Dom2: like this? lol

1 Like

Screw the navy and engineering… I want THAT job.