ParticleEffect

From Space Engineers Wiki
Jump to navigation Jump to search

Found in Particles_B.sbc and Particles_Weather.sbc.

A set of particle and light emitters that can be spawned by various objects (some configured in their definitions) or even by mod scripts and VST.

Needs guide or editor

Warning this definition is quite complex and not really designed to be edited manually.

While you can do it manually with the help of the Particle Effects tutorial, there's also the Particle Editor plugin which allows for realtime changes and it has docs built-in as tooltips.

Elements

ParticleId

<ParticleId>
Type: Int32Default0
Required to be a unique number globally.
One way to have some level of uniqueness (although not guaranteed) is to use the hashcode of your subtypeId, which can be done at https://dotnetfiddle.net/AJXz2i - replace the string in the code and press run. This is the same way the Particle Editor generates this number.

Loop

<Loop>
Type: BooleanDefaultFalse
Whether this effect should loop forever.

DistanceMax

<DistanceMax>
Type: SingleDefault0
Only used if <Loop> is false, the particle will not spawn if the camera is further away than this many meters from the spawn point.

DurationMin

<DurationMin>
Type: SingleDefault0
Duration will be random on every playback between this and <DurationMax>, unless max is smaller than min in which case the min value is used.

DurationMax

<DurationMax>
Type: SingleDefault0
See <DurationMin>.

Priority

<Priority>
Type: SingleDefault1
Determines the importance of this particle's emitters when the game reaches its 1024 limit on emitters.

Distance to camera is multiplied by this, then used to sort emitters incrementally, then only the first 1024 of that sorted list are rendered.
Recommended to be left at 1 for most particles. Only gigantic (moon+ sized) should use lower values, down to 0.

Note: it's stored squared in a float field, therefore should not be less than -1e19 or more than 1e19.

ParticleGenerations

<ParticleGenerations>
Type: List<ParticleGeneration>Defaultnull
List of particle generators, the meat of the effect.

Each <ParticleGeneration> can contain:

Name (attribute[1])Type: stringDefault(empty)
Name only for your own organizing and the game mentioning the generator in logs or debugging contexts.

GenerationType

<GenerationType>
Type: stringDefaultCPU
Must be set to GPU because the default CPU one is no longer supported and the game will say this in the log too.
<Properties>Type: List<GenerationProperty>Defaultnull
Properties for this generator, this is where it gets dicey.

Each <Property> can have:

Name (attribute[1])Type: stringDefaultnull
The property name, must be one of the internal values:
  • Enabled (Bool) - Whether this generator is to be used.
  • Array size (Vector3) - Only X and Y are used to divide the texture into smaller segments for animated playback.
  • Array offset (Int) - Start from this cell in the divided texture.
  • Array modulo (Int) - Amount of cells to use from the starting point in the divided texture.
  • Animation frame time (Float) - Used only if using animated/atlas/array texture feature. This controls framerate, time between each frame, lower means it cycles faster.
  • Color (Vector4) - Color of particle. Transparency is set with alpha component of the color.
  • Color intensity (Float) - HDR intensity multiplier.
  • Bounciness (Float) - Defines how much velocity is left in particle after it bounced. 1 = same velocity, 0 = zero velocity.
  • Emitter size (Vector3) - Emitter size in local x,y,z coordinates. Emittor volume is ellipsoid.
  • Emitter inner size (Single) - Size multiplier which defines inner emitter volume where no particles are created.
  • Direction (Vector3) - Local starting direction of the particle.
  • Velocity (Single) - Initial velocity of the particle.
  • Velocity var (Single) - Variation of initial velocity of the particle.
  • Direction inner cone (Single) - Multiplier of direction cone defining inner cone where no particles are created.
  • Direction cone (Single) - Size of emittor cone defined around local z axis in degrees.
  • Acceleration (Vector3) - Acceleration direction of created particle in local x,y,z coordinates.
  • Acceleration factor [m/s^2] (Float) - Acceleration multipler for created particles.
  • Rotation velocity (Float) - Starting angular velocity of particle desgrees per second.
  • Radius (Float) - Particle radius in meters.
  • Life (Float) - Life of particle in seconds.
  • Soft particle distance scale (Float) - Distance/depth of fading/fogging when particle intersects geometry. 0 will make it intersect/clip sharply, like a normal solid geometric face. Very high values will effectively render the particle always under anything. NOTE: High color values, intensity or emissivity affects this setting's ability to fade them out.
  • Streak multiplier (Float) - Count of particle ghosts in direction of velocity.
  • Particles per second (Single) - Defines how many new particles are created per second.
  • Material (String) - Name of transparent material defined in game definitions used for particle atlas texture.
  • OIT weight factor (Float) - Transparency weighted function factor: to help accommodate for very bright particle systems shining from behind other particle systems, default: 1, lesser value will make the particle system shine through less.
  • Collide (Bool) - Enables particles to collide and bounce off environment. Does not use physics engine, instead it uses screen depth buffer and can be very inaccurate.
  • SleepState (Bool) - Particle is not killed after it reached maximum bounces.
  • Light (Bool) - Particle is being lit by light sources.
  • VolumetricLight (Bool) - Particle is casting and receiving shadows
  • Target coverage (Float) - Does not seem to be used.
  • Gravity (Float) - Nearby total gravity (natural and artificial) is multiplied by this value and added to the particle's velocity.
  • Offset (Vector3) - Offset from emitter center.
  • Rotation velocity var (Float) - Variation of rotation velocity in degrees per second.
  • Hue var (Float) - Random hue variation for particle color.
  • Rotation enabled (Bool) - Enables angular velocity of particles.
  • Motion inheritance (Float) - Multiplier to define how much motion particle inherits when whole effect is moved.
  • Life var (Float) - Variation of particle life in seconds.
  • Streaks (Bool) - Create particle ghosts in velocity direction to emulate streaks.
  • Rotation reference (Int) - Relative source axis to which particles rotate.
  • Angle (Vector3) - Initial angle of created particle in degrees.
  • Angle var (Vector3) - Initial angle variation of created particle in degrees.
  • Thickness (Float) - Width multiplier of particle size.
  • Particles per frame (Single) - Defines how many particles per frame is created.
  • Camera bias (Float) - Meters by which to move the emitter towards the camera.
  • Emissivity (Float) - Intenstity of the particle in the darkness.
  • Shadow alpha multiplier (Float) - Accentuate alpha in shadow (0 - particle gets invisible in shadow, 1 - alpha is the same in shadow as outside, > 1 - make particle more visible in shadow).
  • Use Emissivity Channel (Bool) - Does not seem to be used.
  • Use Alpha Anisotropy (Bool) - Makes particles transparent when you see sprite/billboard from the sides. Only seems to work if 'Rotation reference' is set to Local.
  • Ambient light factor (Float) - Strength of Diffuse Ambient (from environment map); 0 - no ambient, 1 - standard, >1 - stronger ambient.
  • Radius var (Float) - Variation of particle radius is meters.
  • Rotation velocity collision multiplier (Float) - Defines how much angular velocity is left in particle after it bounced. 1 = same velocity, 0 = zero velocity.
  • Collision count to kill particle (Int) - Particle is killed when it is bounced for defined times.
  • Distance scaling factor (Float) - Factor changing relation of distance to particle size (= 0 same as 3d geometry, > 0 makes particles scale down slower).
  • Motion interpolation (Bool) - Interpolates particle emitter positions between update ticks to form a more continuous line when particle's parent moves at high speeds. Also enables Motion Inheritance slider to work.
  • Camera Soft Radius (Float) - Safe radius around camera, where the particles will have 0 opacity.

Type

Type (attribute[1])
Type: stringDefaultnull
The data type of this property, which influences which <Value*> element to read.

Available values: Float, Vector3, Vector4, Bool, Int, String, MyTransparentMaterial.

All case-sensitive.

AnimationType

AnimationType (attribute[1])
Type: PropertyAnimationTypeDefaultConst
Available values:
  • Const
  • Animated
  • Animated2D

ValueFloat

<ValueFloat>
Type: SingleDefault0

ValueBool

<ValueBool>
Type: BooleanDefaultfalse

ValueInt

<ValueInt>
Type: Int32Default0

ValueString

<ValueString>
Type: StringDefault(empty)

ValueVector3

<ValueVector3>
Type: Vector3Default0,0,0

ValueVector4

<ValueVector4>
Type: Vector4Default0,0,0,0

Keys

<Keys>
Type: List<AnimationKey>Defaultnull
List of <Key> elements:

Time

<Time>
Type: SingleDefault0
<ValueFloat>Type: SingleDefault0
<ValueBool>Type: BooleanDefaultfalse
<ValueInt>Type: Int32Default0
<ValueString>Type: StringDefault(empty)
<ValueVector3>Type: Vector3Default0,0,0
<ValueVector4>Type: Vector4Default0,0,0,0
<Value2D>Type: Generation2DPropertyDefaultnull
This contains another list of <Keys> of the same type as this one.

ParticleLights

<ParticleLights>
Type: List<ParticleLight>Defaultnull
Optional list of Lights.

Each <ParticleLight> can contain:

Name

Name (attribute[1])
Type: stringDefault(empty)
Not used by anything, useful for organizing though.
<Properties>Type: List<GenerationProperty>Defaultnull
The exact same syntax as <ParticleGenerations>'s <Properties> but different property names available:
  • Position (Vector3) - Position of the light relative to the effect position.
  • Position var (Vector3) - Random variation of the position.
  • Color (Vector4) - Color of the light.
  • Color var (Single) - Light color random multiplier.
  • Range (Single) - Radius of the light.
  • Range var (Single) - Random variabily of light radius.
  • Intensity (Single) - Intensity strength of the light.
  • Intensity var (Single) - Random variablity of the intensity.
  • Enabled (Bool) - Light enabled or disabled.
  • Gravity Displacement (Float) - Light position offset in gravity direction. This only works if effect is not parented.
  • Falloff (Float) - The range from full light to non lit distance.
  • Variance Timeout (Float) - Time between variance properties randomizing again.

(Top) | From DefinitionBase:

Common

Id

<Id>
Type: SerializableDefinitionIdDefault(invalid)
The type and subtype combined make up a unique identifier for this definition.

If two definitions use the same Type+Subtype (Subtypes are only unique per Type), then the last to load will override the first one(s). For more details see Things to know about SBC.

<TypeId>Type: stringDefault(invalid)
Must be an existing type with or without the "MyObjectBuilder_" prefix.

Some types require an xsi:type, refer to the vanilla files for the exact pairing.

TypeId vs xsi:type
<SubtypeId>Type: stringDefault(empty)
This can be invented and only needs to be unique per TypeId.

Vanilla game re-uses some subtypes over multiple types (e.g. Iron is used for Ore type and Ingot type).

An empty value is also a valid subtype (which vanilla also uses on at least 5 blocks).
Type (attribute[1])Type: stringDefault(invalid)
Same behavior as <TypeId>, do not define both.
Subtype (attribute[1])Type: stringDefault(empty)
Same behavior as <SubtypeId>, do not define both.
Example:
<Id>
  <TypeId>CubeBlock</TypeId>
  <SubtypeId>FancyTable</SubtypeId>
</Id>

Because it has attribute alternatives it can also be declared as:

<Id Type="CubeBlock" Subtype="FancyTable" />

DisplayName

<DisplayName>
Type: StringDefaultnull
If the object defined here is visible anywhere in the game GUI, this would be the name shown for it. In cases where it is used, it is very much required.

Can be plain-text.
If the text contains DisplayName_ then:

Description

<Description>
Type: StringDefaultnull
Optional. If the object defined here is shown with a description in the game GUI (Hotbar/G-menu, HUD, etc) then this is the place to write it.

Can be plain-text.
If the text contains Description_ then:

If the final text (plain, localized or variable-replaced) contains {0}, {1}, etc, then they will replaced by kb&m control binds defined in <DescriptionArgs>.

DescriptionArgs

<DescriptionArgs>
Type: StringDefaultnull
Optional. A comma-separated list of control IDs which are referenced in <Description> by {number} tags, which then get replaced by the keyboard or mouse bind that the viewer has for those controls.
Example:
<Description>Press {0} to fire, {1} to change color, {2} to interact.</description>
<DescriptionArgs>PRIMARY_TOOL_ACTION,CUBE_COLOR_CHANGE,USE</DescriptionArgs>

And each player will see their current binds for those actions.

The control IDs can be found in your %appdata%/SpaceEngineers/SpaceEngineers.cfg at the ControlsButtons section.

Icon

<Icon>
Type: String[]Defaultnull
Icon(s) for the definition which may or may not be used depending on the definition type.

Path to a .dds or .png file relative to current mod's folder. Falls back to game folder if not found in current mod. Referencing assets in other mods

Can be declared multiple times which will stack icons on top of eachother, however it will not work for all definitions.

Known definitions to work or not work with multiple icons
  • Working: Blocks, BlockVariantGroups and component items seen in G-menu, BlockInfo (HUD right side) and toolbars; Blueprints in terminal production tab; Blocks and PhysicalItems in gamepad HUD.
  • Partial: Blocks seen in terminal.
  • Not working: HandItems (uses PhysicalItem's icon instead); Blocks and BlockVariantGroups seen in build planner, radial menu and some economy GUIs; PhysicalItems in economy GUIs and stores; Prefabs in stores; BlueprintClass (tabs) in terminal production tab; BankingSystemDefinition (Game\BankingSystem.sbc); Emotes (both kinds of definitions) in gamepad HUD; Block skins; RespawnShips.
  • Special cases: Economy contracts, FactionIcons Definition.

DLC

<DLC>
Type: String[]Defaultnull
Optional. The DLC subtypeId that this definition will require.

For the IDs, refer to <SE>\Content\Data\Game\DLCs.sbc.
Can be declared multiple times to require multiple DLCs.

Most definition types won't check for this, the ones that do: blocks, emotes and possibly anything else that can be placed in the toolbar.

AvailableInSurvival

<AvailableInSurvival>
Type: BooleanDefaulttrue
Depends on the definition if it uses this, and if it does then this determines whether it can be accessible in survival game mode.

Currently known definitions that do use this:

Public

<Public>
Type: BooleanDefaulttrue
If the definition is visible or accessible in some cases.
For blocks, this only hides them and they can still be built using projectors and other means.

Enabled

Enabled (attribute[1])
Type: BooleanDefaulttrue
If set to false it will remove the definition after it's been loaded.
Example usage:
<Definition Enabled="false">

The "Definition" above is the opening element that for the entire definition, not an inner node like <DisplayName> is.

The opening node can have a different name for other definitions, some examples <Component>, <Blueprint>, etc.

xsi:type

xsi:type (attribute[1])
Type: stringDefaultnull

Name of an object that this definition will be deserialized as.
Sometimes required, depends on the definition. The wiki page for any given definition will mention at the top what xsi:type it requires, if any. The game's sbc files are also a reference on what xsi:types are required for a given definition.

This attribute is available on all elements and comes from the XML specification. This game relies on this attribute to change which sub-definition object is used to deserialize that element's contents. It's what allows, for example, a thruster to have unique elements (such as <MinPlanetaryInfluence>) that no other block definitions have.

For more details on how this relates to the TypeId, and usage examples, see: Things to know about SBC - TypeId vs xsi:type.

Obsolete Elements

Elements that exist in the game code or vanilla SBC, but do nothing

Note: this list only contains root-level from this definition only, nothing from inherited ones.

<Length>Type: SingleDefault10
Not used by the game, it's likely for Keen's own particle editor.
<LowRes>Type: BooleanDefaultFalse
Not used.
<Preload>Type: SingleDefault0
Not used.
<Version>Type: Int32Default0
Not used.