Skip to content

Defining Distributions

Chris Adderley edited this page Oct 28, 2020 · 4 revisions

How to define distributions.

Define the Resource

SPACEDUST_RESOURCE
{
  // Name of the resource to use
  resourceName = XenonGas
  // Body to work on
  body = Kerbin
  // Set of resource bands
  ...
}

Define Bands

Resources are defined as Bands within a resource Distribution. Any number of bands can be defined, but they should have unique name fields. Breakdown of the key fields.

RESOURCEBAND
{
  // Should be unique
  name = kerbinAtmo
  // Localized UI name.
  title = #LOC_SpaceDust_Band_Atmosphere
  // Maximum and minimum abundances (variation is by game seed)
  // In t/m^3
  minAbundance = 0.00000000120
  maxAbundance = 0.00000000380
  // Scale abundances by air density
  useAirDensity = False
  // Scales abundance to pressure (in atm) 
  densityCurve
  {
      key = 0 0
      key = 1 1
      key = 12 12
  }

  // Discoverability Data
  // --------------
  // Is this discovered at game start?
  alwaysDiscovered = true
  // Is this identified at game start?
  alwaysIdentified = true
  // Are we allowed to discover this band remotely
  allowRemoteDiscovery = true
  // Are we allowed to discover this band remotely
  allowRemoteIdentification = true
  // Rate at which we discover remotely (1.0 = full speed) 
  remoteDiscoveryScale = 0.75
  // Rate at which we identify remotely (1.0 = full speed)
  remoteIdentifyScale = 0.75
  // The amount of science given from discovery. Overrides the value in SpaceDustSettings.cfg
  discoveryScienceReward = 5
  // The amount of science given from identification. Overrides the value in SpaceDustSettings.cfg
  identifyScienceReward = 10
}

Distributions

This piece specifies how the band is distributed. Currently only two types are supported: Uniform and Spherical.

Uniform

Resources that are distributed uniformly throughout the SOI. No parameters

// Distribution model to use, can be Uniform or Spherical
distributionType = Uniform

Spherical

Resources are defined in a sphere constrained by latitude. Parameters defined below.

// Distribution model to use, can be Uniform or Spherical
distributionType = Spherical
// Altitudes are in km from sea level
// Maximum altitude for a distribution
altUpperBound = 70000
// minimum altitude for a distribution
altLowerBound = 0
// altitude peak of a distribution
altPeak = 0
// maximum variation of these altitudes (variation is by game seed)
altVariability = 0
// Falloff for altitude, can be Linear or None
altFalloffType = Linear
// lats in degrees
// Maximum latitude for a distribution
latUpperBound = 90
// Minimum latitude for a distribution
latLowerBound = -90
// latitude peak of a distribution
latPeak = 0
// maximum variation of these latitudes (variation is by game seed)
latVariability = 0
// Falloff for latitude, can be Linear or None
latFalloffType = None

Example

Example distribution defining one ResourceBand of XenonGas around Kerbin

SPACEDUST_RESOURCE
{
  resourceName = XenonGas
  body = Kerbin


  RESOURCEBAND
  {
    name = kerbinAtmo
    title = #LOC_SpaceDust_Band_Atmosphere
    // Maximum and minimum abundances (variation is by game seed)
    // In t/m^3
    minAbundance = 0.00000000120
    maxAbundance = 0.00000000380


    
    // Discoverability Data
    // --------------
    alwaysDiscovered = true
    alwaysIdentified = true

    // Scale abundances by air density
    useAirDensity = False
    // Distribution model to use, can be Uniform or Spherical
    distributionType = Spherical

    // These parameters are specific to the Spherical model
    // -------
    // Altitudes are in km from sea level
    // Maximum altitude for a distribution
    altUpperBound = 70000
    // minimum altitude for a distribution
    altLowerBound = 0
    // peak of a distribution
    altPeak = 0
    // maximum variation of these altitudes (variation is by game seed)
    altVariability = 0
    // Falloff for altitude, can be Linear or None
    altFalloffType = Linear

    // lats in degrees
    // Maximum latitude for a distribution
    latUpperBound = 90
    // Minimum latitude for a distribution
    latLowerBound = -90
    // peak of a distribution
    latPeak = 0
    // maximum variation of these latitudes (variation is by game seed)
    latVariability = 0
    // Falloff for latitude, can be Linear or None
    latFalloffType = None
  }
}