CFG File Documentation
This page or section is in need of being brought up to date. Please help Kerbal Space Program Wiki by fixing inaccurate or outdated information.
|
This tutorial will walk through the individual parts of the configuration file by building a dummy part file that will behave exactly like a real one, only lacking models, sounds, and textures.
Contents
- 1 Basic Part Making Guidelines
- 2 Part file creation
- 3 General Parameters
- 4 Part Modules
- 5 Asset Parameters
- 6 Node Definitions
- 7 FX definitions
- 8 Sound FX definition
- 9 Editor Parameters
- 10 Attachment rules
- 11 Standard Part Parameters
- 12 Resources
- 13 Dummy CFG
- 14 Specific Part Parameters
- 15 Conclusion
- 16 Dummy part.cfg file completed
- 17 More Example?
Basic Part Making Guidelines
Ensure that the model itself will not break the game on loading:
- The file must be a .dae file.
- Every—even the collision mesh—mesh must have a material.
- The parts must be correctly named; e.g., the collision mesh should always be called "node_collider"
Ultimately KSP will need a .mu file to load the file into the Game Database. Unity contains a .mu exporting function with the KSP Part Tools.
Part file creation
Save an empty notepad file, which will become the .cfg, in the directory of your addon—usually "../KerbalSpaceProgramDirectory/Parts/yourAddon".
This empty file will become the .cfg
Config file order
PART { // Title // Name of your part // // --- general parameters --- // --- asset parameters --- // --- node definitions --- // --- FX definitions --- // --- Sound FX definition --- // --- editor parameters --- // --- attachment rules: stck, srfAttach, allowStack, allowSrfAttach, allowCollision --- // --- standard part parameters --- // --- specific part parameters --- MODULE { // ---specific module parameters --- } // --- other MODULEs --- }
The slashes before each title indicate that the line thereof has been commented out; the program ignores such lines.
Title
Atop most part files are a couple of lines that resemble the ones below:
// Kerbal Space Program - Configuration file // My super awesome engine that can go at a kajillion miles per hour, lol
These lines are useful when others want to learn from your part file.
The first line states that this file is a part file for KSP; the second states its name.
// Kerbal Space Program - Part CFG file // Mark V Rocket Engine
Onwards!
General Parameters
// --- general parameters ---
This section follows the title and describes several properties of all parts. Below is a list of what goes under General Parameters:
name = solidBooster //Leave this next line as is unless you have a reason module = Part author = Il Carnefice
- name
- It can be anything that is unique, one word, and without an underscore; it's not commented out because KSP will internally (the user will not see this name) thus refer to the part.
- module
- This used to describe the specific part class behavior but now this is handled by the Module tags later in the file. Set it to Part.
- author
- Author name
Below is an example:
// Kerbal Space Program - Part CFG file // Mark V Rocket Engine // --- General Parameters --- name = LiquidThrusterV module = Part author = YourName
Parts
Part Name | Description |
---|---|
SolidRocket | Resembles a solid rocket booster - a continually burning rocket that lacks thrust control and cannot be deactivated once lit. |
LiquidEngine | Resmebles an orbital maneuvering system - a rocket engine with controllable thrust. |
FuelTank | Contains fuel. |
CommandPod | Contains crew and a control system. |
SASModule | Holds course. |
SASModule2 | ??? |
Strut | Connects rocket parts. Has no special abilities. |
Decoupler | Connects rocket parts and can jettison itself and the parts it's connected to. |
RadialDecoupler | Connects and can jettison parts much as does a Decoupler, but radially. |
Parachutes | Deploys a parachute. |
ControlSurface | Movable wing-like surface. Can act as a rudder, aileron, elevator, canard or other aerodynamic control surface - function depends on placement on a ship. |
WarpEngine | A warp engine. Not functional as of 0.15.2. |
Winglet | A fixed, lifting part. |
Stabilizer | Similar to ControlSurface (recommend to not use) |
StrutConnector | ??? |
RCSFuelTank | A RCS tank. |
RCSModule | A RCS thruster. |
AtmosphericEngine | Atmospheric engine with air flow parameters. |
AdvSASModule | An SAS-type module that alters user input allowing for control of RCS, pod torque, gimballing engines and control surfaces. |
DecouplerGUI | A normal decoupler that can be disconnected via the right-click GUI. |
DockingPort | An unfinished docking port? |
FuelLine | Transfers fuel. |
FuelTankGUI | A fuel tank with a right-click GUI to disable flow. |
LandingLeg | A moving landing leg, using .cfg parameters to move. |
HLandingLeg | A moving landing leg, using animations to move. |
HParachutes | An animated parachute module? |
LandingGear | Wheeled, animated landing gear for spaceplanes. |
SatELight | A flash-light module. |
LiquidFuelEngine | A liquid fuel engine that uses Thrust and Isp, rather than Thrust and fuel units. |
Part Modules
Please read: "0.15 code update - PartModule, KSPField, KSPEvent, ConfigNode and PartResource"
Module Name | Description |
---|---|
ModuleEngine | Engine? |
ModuleAnimateHeat | ??? |
ModuleLandingGear | Animated landing gear module? |
ModuleCommand | Command module? |
ModuleGenerator | Used by RTG, input/output resources. |
ModuleResourceIntake | Generic resource "intake" module, to add to or take away from resource |
ModuleAnimateGeneric | Animation? |
ModuleScienceExperiment | Scientific experiment? |
ModuleWheel | Rover wheel |
ModuleLandingGear | Landing Gear |
ModuleSteering
|
Adds steering to wheel |
ModuleLight
|
Adds light to wheel |
Category | Description |
---|---|
Pods | Command pods and cockpits go here |
Propulsion | Engines, Fuel Tanks, RCS Tanks, etc. |
Control | SAS modules, RCS Thrusters, etc. |
Structural | Struts, decouplers, adapters, etc. |
Aero | Wings, Control Surfaces and nose cones. |
Utility | Parachutes, Escape towers, heat shields, lights, landing gear/legs, ladders, batteries, solar panels, generators, etc. |
Science | Sensors, Antennae, Satellite Dishes, etc. |
- subcategory
- No use yet. Set it to 0
- title
- What do you want your part to be called in the rocket editor?
- manufacturer
- Who built your part?
- description
- Describe your part here. (Do not use linebreaks. KSP breaks lines automatically in the part's tooltip. A linebreak will cause your description to appear truncated)
And that's that. Updating the dummy cfg file now:
// Kerbal Space Program - Part CFG file // Mark V Rocket Engine // --- General Parameters --- name = LiquidThrusterV module = LiquidEngine author = YourName // --- Asset Parameters --- mesh = myMesh.dae scale = 0.1 texture = awesometexture.png specPower = 0.5 rimFalloff = 3 alphaCutoff = 0 // --- Node Definitions --- node_stack_bottom = 0.0, -3.5, 0.0, 0.0, 1.0, 0.0, 1.0 *'''// --- FX Definitions --- fx_exhaustFlame_blue = 0.0, -10.0, 0.0, 0.0, 1.0, 0.0, active fx_exhaustLight_blue = 0.0, -10.0, 0.0, 0.0, 0.0, 1.0, active // --- Sound FX definition --- sound_vent_medium = activate sound_rocket_hard = active sound_vent_soft = deactivate // --- editor parameters --- cost = 120 category = Propulsion subcategory = 0 title = Mark V Rocket Engine manufacturer = Awesomely Terrible Spaceship Engines Inc. description = This part will now get you to space with 60% less limb loss than the mark IV engine.
Attachment rules
This defines how your part attaches to other parts.
- // attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision
- attachRules = 1,1,1,1,1
The rules correspond to the numbers below - 1 is allow, 0 is prevent. The tags are:
stack - Can your part be stacked on others?
SrfAttach - Can your part be placed onto a surface?
allowStack - Will you allow other parts to be stacked on your part?
allowSrfAttach Can other parts be placed on the surface of yours?
allowCollision - A special one: Can your part be placed if part of it is intersecting another part?
Note that you can also force parts attached to this part to attach in a specific symmetry.
- // symmetry rules: 0=1x, 1=2x, 2=3x, 3=4x and so on...
- stackSymmetry = 3
Easy enough, right? Adding to dummy file and continuing.
// Kerbal Space Program - Part CFG file // Mark V Rocket Engine // --- General Parameters --- name = LiquidThrusterV module = LiquidEngine author = YourName // --- Asset Parameters --- mesh = myMesh.dae scale = 0.1 texture = awesometexture.png specPower = 0.5 rimFalloff = 3 alphaCutoff = 0 // --- Node Definitions --- node_stack_bottom = 0.0, -3.5, 0.0, 0.0, 1.0, 0.0, 1.0 // --- FX Definitions --- fx_exhaustFlame_blue = 0.0, -10.0, 0.0, 0.0, 1.0, 0.0, active fx_exhaustLight_blue = 0.0, -10.0, 0.0, 0.0, 0.0, 1.0, active // --- Sound FX definition --- sound_vent_medium = activate sound_rocket_hard = active sound_vent_soft = deactivate // --- editor parameters --- cost = 120 category = Propulsion subcategory = 0 title = Mark V Rocket Engine manufacturer = Awesomely Terrible Spaceship Engines Inc. description = This part will now get you to space with 60% less limb loss than the mark IV engine. // attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision attachRules = 1,1,1,1,0
Standard Part Parameters
This defines how your part performs in the air and its limits. Note that not all of these parameters need to be defined. If they're left out of the cfg file, KSP will use a default value for them.
- mass =
- dragModelType = default
- maximum_drag =
- minimum_drag =
- angularDrag =
- crashTolerance =
- breakingForce =
- breakingTorque =
- maxTemp =
- heatConductivity =
- heatDissipation =
- stageOffset =
- childStageOffset =
- fuelCrossFeed =
- NoCrossFeedNodeKey =
mass - How much does your part weigh? (Or, for parts that also specify a dryMass parameter, how much does it weigh when full?)
dragModelType - Leave this as default.
maximum_drag - What's the maximum amount of drag on your part? (Usually under 1.) Generally drag when part's direction of travel is along its y-axis.
minimum_drag - The minimum amount of drag your part will encounter. (Usually under 1 and lower than maximum_drag) (this value is unused if dragModelType is set to default) Generally drag when the part's direction of travel is perpendicular to its y-axis.
angularDrag - how much angular drag is there/resistance to turning? (Also usually under 1.)
crashTolerance - How good is your part at surviving crashes? The higher the number the more durable. Numbers are approximately maximum impact speed in m/s.
breakingForce - How much will the attachment between this part and the part it's connected to resist to linear forces?
breakingTorque - How much will the attachment resist rotational forces?
maxTemp - The maximum temperature your part can experience before exploding.
heatConductivity - How good is your part at conducting heat? Defaults to 0.08, CFG values are used in 0.13.3, but not in 0.15.2.
heatDissipation - How good is your part at dissipating heat from the ship? Defaults to 0.08, CFG values are used in 0.13.3, but not in 0.15.2.
stageOffset and childStageOffset - Can be 0, 1, etc. defines whether this part will create a new stage before or after itself, or both (as do decouplers). This only applies for the automatically generated staging sequence. These replace stageBefore and stageAfter.
fuelCrossFeed - Will the part crossfeed fuel between parts attached to it?
NoCrossFeedNodeKey - if set to bottom will keep fuel from flowing FROM bottom nodes (avoiding some stack imbalances and partially mitigating the 0.15 bug of engines generating fuel). Used with parts with multiple bottom nodes, such as the TVR-1180C Mk1 Stack Tri-Coupler.
There you go, another section down.
Resources
Some parts contain a resource, such as SolidFuel.
RESOURCE { name = SolidFuel amount = 433 maxAmount = 433 }
The value entered in the RESOURCE node is what will appear in the in-game UI, but does not necessarily reflect a mass or volume. The game uses the resource's density defined in files with RESOURCE_DEFINITION nodes to calculate the mass of that resource in the given part. As an example, Squad's RT-10 Solid Fuel Booster's cfg defines its mass as 0.5, and the resource node says it hold 433 SolidFuel. The density of SolidFuel is defined by Squad as being 0.0075. Therefore:
Mass of RT-10+(resource amount*resource density)=0.5+(433*0.0075)=3.7475 tonne
which matches the in-game mass for this part.
The above is important to remember when making a part that will contain resources in that, if you set a resource's density first and want a part to hold a specific amount, you need to calculate the amount and not just enter the tonnes you want in the RESOURCE node. Regardless of how much mass that resource is, the in-game resource UI will always show the value in the RESOURCE node.
If using the default liquid fuel and the volume of the tank is known, the amounts of fuel and oxidizer can be calculated as follows (to agree with the amounts used in the default fuel tanks):
liquid fuel amount=(2,655,406*v)/27775 oxidizer amount=(86920*v)/1111 where v is the volume of the fuel tank in m^3. If the tank is a cylinder, v=pi/4*diameter^2*height
This was determined by solving the following system of equations,where x is the amount of oxidizer and y is the amount of liquid fuel:
mass of fuel=y*.005
mass of oxidizer=x*.005
moxidizer/mfuel=2.2/1.8=1.22
(x*.005)/(y*.005)=1.22
equation 1: .005x-.00611y=0
equation 2: x+y=v*173.84
In order to agree with the amounts used in the default fuel tanks, the volume has to be multiplied by 173.84. The system of equations was solved using wolframalpha.com.
Dummy CFG
Dummy CFG:
// Kerbal Space Program - Part CFG file // Mark V Rocket Engine // --- General Parameters --- name = LiquidThrusterV module = LiquidEngine author = YourName // --- Asset Parameters --- mesh = myMesh.dae scale = 0.1 texture = awesometexture.png specPower = 0.5 rimFalloff = 3 alphaCutoff = 0 // --- Node Definitions --- node_stack_bottom = 0.0, -3.5, 0.0, 0.0, 1.0, 0.0, 1.0 // --- FX Definitions --- fx_exhaustFlame_blue = 0.0, -10.0, 0.0, 0.0, 1.0, 0.0, active fx_exhaustLight_blue = 0.0, -10.0, 0.0, 0.0, 0.0, 1.0, active // --- Sound FX definition --- sound_vent_medium = activate sound_rocket_hard = active sound_vent_soft = deactivate // ---Editor parameters --- cost = 120 category = Propulsion subcategory = 0 title = Mark V Rocket Engine manufacturer = Awesomely Terrible Spaceship Engines Inc. description = This part will now get you to space with 60% less limb loss than the mark IV engine. // --- Standard part parameters --- mass = 1.5 dragModelType = default maximum_drag = 0.4 minimum_drag = 0.2 angularDrag = 0.2 crashTolerance = 5 maxTemp = 2500
Specific Part Parameters
We're almost finished, a complete part is almost at our hands and you should know almost everything you need to create a part.cfg file. However, remember back when we were setting types? Well each type has an individual set of specific part parameters that change depending on what type of part it is.
You cannot mix and match parameters from different module types - it doesn't work.
These specific parameters are actually public variables defined in the Part classes themselves. The standard parameters are declared in the Part base class, and the specific ones in each Part extension (i.e., Modules)
For example, if your part type (module) was SolidRocket, your specific part parameters would be composed of:
- thrust = 130
- dryMass = 0.36
- heatProduction = 550
- fuelConsumption = 4
- internalFuel = 100
- fullExplosionPotential = 0.8
- emptyExplosionPotential = 0.1
- thrustCenter = 0, -0.5, 0
- thrustVector = 0, 1, 0
Time to go through and see what special parameters each module can have.
Liquid Engine
A liquid engine has the following special parameters:
- maxThrust =
- minThrust =
- heatProduction =
- fuelConsumption =
Looks pretty easy, and everything is pretty much what you'd expect. By now, you should be able to work out what they all mean, but just in case:
maxThrust - The maximum thrust of the liquid engine.
minThrust - The minimum thrust. Usually 0, unless you want a rocket that can't fully be turned off.
heatProduction - How much heat your rocket puts out.
fuelConsumption - How much fuel your rocket uses.
Solid Rocket Booster
- thrust =
- dryMass =
- heatProduction =
- fuelConsumption =
- internalFuel =
- fullExplosionPotential =
- emptyExplosionPotential =
- thrustCenter = x, y, z
- thrustVector = angx, angy, angz
A lot of those values look pretty similar to the liquid engine parameters, right?
thrust - The thrust of the solid rocket booster. Note how there is no minimum thrust because it can not be turned off once lit.
dryMass - How much the SRB weighs when empty.
heatProduction - Exactly the same as the liquid rocket, how much heat your rocket puts up.
fuelConsumption - How much fuel the rocket uses per second.
internalFuel - How much fuel does the SRB hold inside it?
fullExplosionPotential - The potential for explosion when the rocket is full of fuel
emptyExplosionPotential - And the potential when it's empty.
thrustCenter - Where the thrust comes from.
thrustVector - And which direction it goes.
Fuel Tank
Fuel tanks are a bit different, seeing as they have no thrust parameters.
- fuel =
- dryMass =
- fullExplosionPotential =
- emptyExplosionPotential =
If you've read above, you should know exactly what those parameters do, and so I won't explain them to you again.
SAS Module
- maxTorque =
maxTorque - The maximum amount of torque the module can apply to halt the ship's rotation.
Ki, Kd and Kp - These parameters allow for tuning of the internal workings of the SAS module. If you're not experienced in working with PID controllers, just leave them as they are.
Winglets
- dragCoeff =
- deflectionLiftCoeff =
dragCoeff - The drag co-efficiency of the wings.
deflectionLiftCoeff - How much lift the wings generate.
Control Surfaces
- dragCoeff =
- deflectionLiftCoeff =
- ctrlSurfaceRange =
- ctrlSurfaceArea =
ctrlSurfaceRange - How far off centre the control surface (rudder / aileron etc.) can move under control
ctrlSurfaceArea - The effective surface area of the control surface - the bigger the surface, the bigger the surface area must be set to
Decouplers
- ejectionForce =
ejectionForce - How hard it separates on stage ejection.
Note, decouplers also add two lines to Standard Part Parameters, "stageAfter = True" and "stageBefore = True"
Parachutes
- useAGL =
- autoDeployDelay =
- minAirPressureToOpen =
- deployAltitude =
- closedDrag =
- semiDeployedDrag =
- fullyDeployedDrag =
useAGL - Whether or not the parachute opens at the set altitude above ground level, instead of above sea level.
autoDeployDelay - Time before parachutes attached to jettisoned parts are activated.
minAirPressureToOpen - The minimum air pressure required before the chute will activate.
deployAltitude - At what altitude the parachute deploys fully once activated.
closedDrag - The drag when the parachute is closed.
semiDeployedDrag - The drag when it's semi-deployed
fullyDeployedDrag - And finally, the drag when it's entirely deployed.
Conclusion
There you go then. By now, you should know the ins and outs of the part.cfg file, and how to create one, edit one, play around with one, etc. All sorts of cool stuff like that. The final dummy part.cfg file will be after this, with the special part parameters added in.
Anyway, that's that, now you know, now go make some cool addons like FTL drives and newton-defying inertial dampeners.
Dummy part.cfg file completed
// Kerbal Space Program - Part CFG file // Mark V Rocket Engine // --- General Parameters --- name = LiquidThrusterV module = LiquidEngine author = YourName // --- Asset Parameters --- mesh = myMesh.dae scale = 0.1 texture = awesometexture.png specPower = 0.5 rimFalloff = 3 alphaCutoff = 0 // --- Node Definitions --- node_stack_bottom = 0.0, -3.5, 0.0, 0.0, 1.0, 0.0, 1.0 // --- FX Definitions --- fx_exhaustFlame_blue = 0.0, -10.0, 0.0, 0.0, 1.0, 0.0, active fx_exhaustLight_blue = 0.0, -10.0, 0.0, 0.0, 0.0, 1.0, active // --- Sound FX definition --- sound_vent_medium = activate sound_rocket_hard = active sound_vent_soft = deactivate // ---Editor parameters --- cost = 120 category = Propulsion subcategory = 0 title = Mark V Rocket Engine manufacturer = Awesomely Terrible Spaceship Engines Inc. description = This part will now get you to space with 60% less limb loss than the mark IV engine. // --- Standard part parameters --- mass = 1.5 dragModelType = default maximum_drag = 0.4 minimum_drag = 0.2 angularDrag = 0.2 crashTolerance = 5 maxTemp = 2500 // --- Special Part Parameters --- maxThrust = 150 minThrust = 0 heatProduction = 360 fuelConsumption = 7
More Example?
// KSP - Parts // Chemi Ion engine , using normal fueltank :D // Mark I Ion engine // // --- general parameters --- name = ChemiIonEngine module = LiquidEngine author = Chemi | G-min // --- asset parameters --- mesh = CIonengMK1.dae scale = 0.1 texture = hotsurf.png specPower = 0.5 rimFalloff = 4 alphaCutoff = 0 // --- node definitions --- node_stack_bottom = 0, 0, 0, 0, -1.0, 0, 1 node_stack_top = 0, 0.2, 0, 0, 1.0, 0, 1 // --- FX definitions --- fx_exhaustFlame_yellow = 0, -0.05, 0, 0, 1.0, 0, active fx_exhaustLight_yellow = 0, -0.05, 0, 0, 0, 0, active fx_smokeTrail_medium = 0, 0, 0, 0, 1.0, 0, active // --- Sound FX definition --- sound_chemiionengine.wav = activate sound_chemiionengine.wav = active sound_vent_soft = deactivate // --- editor parameters --- cost = 1000 category = Propulsion subcategory = 0 title = Chemi Ion engine MK1 manufacturer = Chemi Jet Propulson Laboratory / G-min Parts design description = The great Ion engine :D // attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision attachRules = 1,1,1,1,0 // --- standard part parameters --- mass = 1.22 dragModelType = default maximum_drag = 0.399 angularDrag = 0.4 crashTolerance = 29.16 breakingForce = 1024 breakingTorque = 567 maxTemp = 3100 heatConductivity = 3.6 heatDissipation = 0.014 // --- specific part parameters --- maxThrust = 369 minThrust = 0 heatProduction = 58 fuelConsumption = 0.009 // end!