• Register

X-wing starfighter is a spiritual successor to the Star Wars X-Wing/TIE-Fighter series, but for android. At later date, a more advanced version of the game will be released on PC under the name of Star Wars Squadrons.

Forum Thread
  Posts  
JSON templates for ships (Games : X-Wing Starfighter : Forum : Developer Discussion : JSON templates for ships) Locked
Thread Options
Nov 25 2016 Anchor

I have been working on a JSON templates, that will be used as a sort of blueprint to construct ships.

The template may vary a bit depending on its class, capital ship, freighter, transport, starfighter etc. The templates supports destructable ship parts and hardpoints for engines, turrets, shield generators and other various components. This format demands the ship to be modelled acoording to a loose structure defined in the JSON. An example of this is that each mesh lod level needs to and with LOD0 as specified in the JSON mesh_lod_levels.

Also each damage level needs to named after the hull part name + lod level. This mean that the MainHull hull part that has damage level specified as "MainHull_DMG0" would be named "MainHull_DMG0_LOD0" for the closest lod level.

This should not be a problem since I model all ships myself. Below is an example of the template for a Nebulon-B frigate:

{
   "name" : "Nebulon-B",
   "abbreviation" : "FRI",
   "class" : "frigate",
   "role" : "Capital",
   "armor_class" : "Capital",
   "mesh_lod_levels" : [ "LOD0", "LOD1", "LOD2", "LOD3" ],
   "max_speed" : 20.0,
   "max_roll" : 10.0,
   "max_pitch" : 10.0,
   "max_yaw" : 10.0,
   "hull_parts" : [
      {
         "name" : "EngineSection",
         "ru_rating" : 4000.0,
         "max_systems" : 1500.0,
         "mesh_undamaged" : "EngineSection",
         "mesh_light_damage" : "EngineSection",
         "mesh_moderate_damage" : "EngineSection",
         "mesh_heavy_damage" : "EngineSection",
         "mesh_destroyed" : "EngineSection",
         "hardpoints" : [
            "ShieldGenerator1",
            "PortFin",
            "StarboardFin",
            "TurboLaser1",
            "TurboLaser2",
            "TurboLaser3",
            "TurboLaser4",
            "TurboLaser5",
            "LaserCannon1",
            "LaserCannon2",
            "LaserCannon3",
            "LaserCannon4",
            "Engine1",
            "Engine2",
            "Engine3",
            "Engine4",
            "Engine5",
            "Engine6",
            "Engine7"
         ]
      },
      {
         "name" : "Neck",
         "ru_rating" : 2000.0,
         "max_systems" : 500.0,
         "mesh_undamaged" : "Neck",
         "mesh_light_damage" : "Neck",
         "mesh_moderate_damage" : "Neck",
         "mesh_heavy_damage" : "Neck",
         "mesh_destroyed" : "Neck",
         "hardpoints" : []
      },
      {
         "name" : "MainHull",
         "ru_rating" : 8000.0,
         "max_systems" : 3000.0,
         "mesh_undamaged" : "MainHull_DMG_0",
         "mesh_light_damage" : "MainHull_DMG_0",
         "mesh_moderate_damage" : "MainHull_DMG_1",
         "mesh_heavy_damage" : "MainHull_DMG_2",
         "mesh_destroyed" : "MainHull_DMG_3",
         "hardpoints" : [
            "TopCenterAntenna1",
            "TopCenterAntenna2",
            "StarboardAntenna",
            "TurboLaser6",
            "TurboLaser7",
            "TurboLaser8",
            "TurboLaser9",
            "TurboLaser10",
            "TurboLaser11",
            "TurboLaser12",
            "LaserCannon5",
            "LaserCannon6",
            "LaserCannon7",
            "LaserCannon8",
            "LaserCannon9",
            "LaserCannon10",
            "LaserCannon11",
            "LaserCannon12"
         ]
      }
   ],
   "shield_generator_templates" : [
      {
         "name" : "Serridge SEAL-III",
         "mesh" : "Nebulon-B_ShieldGenerator",
         "sbd_rating_front" : 3000.0,
         "sbd_rating_rear" : 3000.0,
         "sbd_regen" : 4.0,
         "sbd_regen_frequency" : 2.0,
         "power_drain" : 4.0
      }
   ],
   "shield_generators" : [
      {
         "template" : "Serridge SEAL-II",
         "hardpoint" : "ShieldGenerator1",
         "parent" : "EngineSection"
      }
   ],
   "power_generator_templates" : [
      {
         "template" : "Generic Power Generator",
         "mesh" : null,
         "capacity" : 2000.0,
         "regen_frequency" : 2.0,
         "regen_rate" : 40.0
      }
   ],
   "power_generators" : [
      {
         "template" : "Generic Power Generator",
         "hardpoint" : null
      }
   ],
   "turret_templates" : [
      {
         "name" : "Taim & Bak XI7",
         "type" : "TurboLaser",
         "mesh" : "Nebulon-B_TurboLaser",
         "laser_damage" : 60.0,
         "laser_speed" : 250.0,
         "laser_range" : 2000.0,
         "fire_modes" : [ "single", "dual", "quad" ],
         "default_fire_mode" : "dual",
         "fire_frequency" : 2.0,
         "base_rotate_speed" : 0.5,
         "barrel_rotate_speed" : 10.0,
         "power_bank" : 20.0,
         "power_drain" : 1.0,
         "regen_rate" : 1.0,
         "min_angle" : 15.0,
         "max_angle" : 180.0
      },
      {
         "name" : "Borstel RH8",
         "type" : "LaserCannon",
         "mesh" : "Nebulon-B_LaserCannon",
         "laser_damage" : 20.0,
         "laser_speed" : 350.0,
         "laser_range" : 1000.0,
         "fire_modes" : [ "single", "dual" ],
         "default_fire_mode" : "single",
         "fire_frequency" : 2.0,
         "base_rotate_speed" : 0.75,
         "barrel_rotate_speed" : 20.0,
         "power_bank" : 20.0,
         "power_drain" : 1.0,
         "regen_rate" : 1.0,
         "min_angle" : 0.0,
         "max_angle" : 180.0
      }
   ],
   "turrets" : [
      {
         "template" : "Taim & Bak XI7",
         "hardpoint" : "TurboLaser1",
         "hull_part" : "EngineSection"
      },
      {
         "template" : "Taim & Bak XI7",
         "hardpoint" : "TurboLaser2",
         "hull_part" : "EngineSection"
      },
      {
         "template" : "Taim & Bak XI7",
         "hardpoint" : "TurboLaser3",
         "hull_part" : "EngineSection"
      },
      {
         "template" : "Taim & Bak XI7",
         "hardpoint" : "TurboLaser4",
         "hull_part" : "EngineSection"
      },
      {
         "template" : "Taim & Bak XI7",
         "hardpoint" : "TurboLaser5",
         "hull_part" : "EngineSection"
      },
      {
         "template" : "Taim & Bak XI7",
         "hardpoint" : "TurboLaser6",
         "hull_part" : "MainHull"
      },
      {
         "template" : "Taim & Bak XI7",
         "hardpoint" : "TurboLaser7",
         "hull_part" : "MainHull"
      },
      {
         "template" : "Taim & Bak XI7",
         "hardpoint" : "TurboLaser8",
         "hull_part" : "MainHull"
      },
      {
         "template" : "Taim & Bak XI7",
         "hardpoint" : "TurboLaser9",
         "hull_part" : "MainHull"
      },
      {
         "template" : "Taim & Bak XI7",
         "hardpoint" : "TurboLaser10",
         "hull_part" : "MainHull"
      },
      {
         "template" : "Taim & Bak XI7",
         "hardpoint" : "TurboLaser11",
         "hull_part" : "MainHull"
      },
      {
         "template" : "Taim & Bak XI7",
         "hardpoint" : "TurboLaser12",
         "hull_part" : "MainHull"
      },
      {
         "template" : "Borstel RH8",
         "hardpoint" : "LaserCannon1",
         "hull_part" : "EngineSection"
      },
      {
         "template" : "Borstel RH8",
         "hardpoint" : "LaserCannon2",
         "hull_part" : "EngineSection"
      },
      {
         "template" : "Borstel RH8",
         "hardpoint" : "LaserCannon3",
         "hull_part" : "EngineSection"
      },
      {
         "template" : "Borstel RH8",
         "hardpoint" : "LaserCannon4",
         "hull_part" : "EngineSection"
      },
      {
         "template" : "Borstel RH8",
         "hardpoint" : "LaserCannon5",
         "hull_part" : "MainHull"
      },
      {
         "template" : "Borstel RH8",
         "hardpoint" : "LaserCannon6",
         "hull_part" : "MainHull"
      },
      {
         "template" : "Borstel RH8",
         "hardpoint" : "LaserCannon7",
         "hull_part" : "MainHull"
      },
      {
         "template" : "Borstel RH8",
         "hardpoint" : "LaserCannon8",
         "hull_part" : "MainHull"
      },
      {
         "template" : "Borstel RH8",
         "hardpoint" : "LaserCannon9",
         "hull_part" : "MainHull"
      },
      {
         "template" : "Borstel RH8",
         "hardpoint" : "LaserCannon10",
         "hull_part" : "MainHull"
      },
      {
         "template" : "Borstel RH8",
         "hardpoint" : "LaserCannon11",
         "hull_part" : "MainHull"
      },
      {
         "template" : "Borstel RH8",
         "hardpoint" : "LaserCannon12",
         "hull_part" : "MainHull"
      }
   ],
   "engine_templates" : [
      {
         "name" : "Kuat Galaxy-15 Ion Engine",
         "mesh" : "Nebulon-B_Engine",
         "power_drain" : 1.0,
         "power_drain_frequency" : 1.0,
         "speed" : 3.0,
         "acceleration" : 1.0,
         "roll" : 0.5,
         "pitch" : 0.5,
         "yaw" : 0.5
      }
   ],
   "engines" : [
      {
         "template" : "Kuat Galaxy-15 Ion Engine",
         "hardpoint" : "Engine1",
         "parent" : "EngineSection"
      },
      {
         "template" : "Kuat Galaxy-15 Ion Engine",
         "hardpoint" : "Engine2",
         "parent" : "EngineSection"
      },
      {
         "template" : "Kuat Galaxy-15 Ion Engine",
         "hardpoint" : "Engine3",
         "parent" : "EngineSection"
      },
      {
         "template" : "Kuat Galaxy-15 Ion Engine",
         "hardpoint" : "Engine4",
         "parent" : "EngineSection"
      },
      {
         "template" : "Kuat Galaxy-15 Ion Engine",
         "hardpoint" : "Engine5",
         "parent" : "EngineSection"
      },
      {
         "template" : "Kuat Galaxy-15 Ion Engine",
         "hardpoint" : "Engine6",
         "parent" : "EngineSection"
      },
      {
         "template" : "Kuat Galaxy-15 Ion Engine",
         "hardpoint" : "Engine7",
         "parent" : "EngineSection"
      },
      {
         "template" : "Kuat Galaxy-15 Ion Engine",
         "hardpoint" : "Engine8",
         "parent" : "EngineSection"
      },
      {
         "template" : "Kuat Galaxy-15 Ion Engine",
         "hardpoint" : "Engine9",
         "parent" : "EngineSection"
      }
   ]
}


The format of the model (FBX) would be the following (Note that lod damage levels are only created for the fore section of the ship in this example, for the final version damage levels would have to be added to the middle (Neck) and aft (Engine Section) too:

Nebulon B FBX Structure


Edited by: starwarssquadrons

Reply to thread
click to sign in and post

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.