**Tutorial** Advanced explosions
Explosions are typically defined in either explosions.ini (such as for ship death explosions) or weapon_equip.ini (for missile explosions). As far as I know you can cross-reference these definitions as much as you want; for example, you can have a missile use an explosion defined in explosions.ini without any problems.
Explosions are defined with an [Explosion block, like so:
[Explosion
nickname = explosion_ISD_primary
lifetime = 0.000000, 0.000000
process = shatter
effect = gf_explosion_li_battleship_mainexpbig
debris_impulse = 150
debris_type = debris_large_capship_piece_explode, 1.0
innards_debris_start_time = 0.0
innards_debris_num = 8
innards_debris_radius = 300
innards_debris_object = simple_debris_large01
innards_debris_object = simple_debris_large03
innards_debris_object = simple_debris_medium02
innards_debris_object = simple_debriszone_med01
strength = 100
radius = 1800
hull_damage = 500000
energy_damage = 0
impulse = 100
A look at what the parameters mean:
- nickname = <name>
This is how the explosion is referenced, be it by weapons, ships or fuses.
- lifetime = <time>, <time>
To be perfectly honest, I have not seen this influence anything. There may be a function, but if so I don't know what it is. As a guess, I imagine it works like it does for fuses and debris, where you specify the duration of the fuse/debris in seconds; so, the range of values would give a range of durations for the explosion. However, the duration of an explosion is not something that is well-defined, so I still don't know why it would matter (except for innards_debris_start_time, perhaps). You can always get away with using 0, 0.
- process = <process type>
The two process types are "shatter" and "disappear". Again, I really have not observed any difference between the two; I would guess that if there is a difference it relates to how the debris from the explosion is thrown, but that has no experimental basis.
- effect = <effect_name>
This is a reference to an [Effect, defined in effects.ini or one of the other effect files. In this particular case, the definition looks like this:
[Effect
nickname = gf_explosion_li_battleship_mainexpbig
effect_type = EFT_EXPLOSION_LARGE
vis_effect = gf_explosion_li_battleship_mainexpbig
The vis_effect is a reference to a [VisEffect in explosions_ale.ini:
[VisEffect
nickname = gf_explosion_li_battleship_mainexpbig
alchemy = fx\explosions\gf_explosion_li_battleship.ale
...other stuff...
The alchemy file is what actually specifies how the effect is drawn. .ale files can be modified given some patience, but it is difficult to do anything sophisticated and in any event that's not what this tutorial is about. Anyway, back to the explosion...
- debris_impulse = <number>
This is how hard the debris generated by the explosion is thrown outward. This works directly against the mass of the debris; if the debris is too light for the impulse you give it, you may not see any debris at all because it will fly off screen instantly.
- debris_type = <type>, <relative weight>
The <type> is a reference to a [Debris definition, which I will get to later. A single explosion may have multiple debris_type lines, in which case the game will randomly choose one of them for each piece of debris thrown, with the odds for each given by the relative weight.
- innards_debris_start_time = <time>
This is how long from the start of the explosion the debris will be thrown. If explosions work like fuses, the range of this value will be from 0 to 1, with 0 being the start of the explosion and 1 being the end of the explosion (the duration of the explosion being defined by lifetime). I always set the debris start time to 0.
- innards_debris_num = <quantity>
How many parts will be thrown by the explosion.
- innards_debris_radius = <distance>
The debris generated by the explosion will spawn at random positions inside a sphere of this radius, centered on the point where the explosion occurs.
- innards_debris_object = <name>
You can specify as many of these as you want; the game will randomly pick from these each time it creates a debris piece for the explosion. The name is a reference to a [Simple defintion, which will be explained later.
- strength = <value>
100 seems to be pretty common. At one point I thought this was tied into a function that reduces explosion damage as the distance from the explosion center increases, but I could never definitively confirm that. It may also relate to impulse rather than damage, but again, no conclusive evidence.
- radius = <distance>
Anything within this distance from the center of the explosion will take damage.
- hull_damage = <value>
The explosion will do this much hull damage.
- energy_damage = <value>
And this much energy damage.
- impulse = <value>
This is the impulse delivered to ships that are within the blast radius. It works just like it does with debris_impulse, so the mass of the ship that gets hit will affect how far it gets thrown.
----------
Now to get back to debris types, specified by [Debris
[Debris
nickname = debris_large_capship_piece_explode
death_method = exploding
lifetime = 0.5, 1.5
linear_drag = 5
angular_drag = 1, 1, 1
rotation_inertia = 100000, 100000, 100000
explosion = explosion_large_capship_piece
trail = gf_explosion_debris_trail01
- nickname = <name>
Referenced by debris_type in the explosion definition.
- death_method = <type>
The two death methods are "exploding" and "vanishing"; a debris set to "vanishing" will just sort of go away when its lifetime expires. "Exploding" debris will trigger an explosion at the end of lifetime.
- lifetime = <time1>, <time2>
The debris will last between time1 and time2 seconds before disappearing or exploding.
- linear_drag = <value>
This works just like it does for ships; why it is defined here rather than in the [Simple definitions for the actual debris pieces I don't know.
- angular_drag = <value>, <value>, <value>
Just like for ships.
- rotation_inertia = <value>, <value>, <value>
Just like for ships.
- explosion = <explosion_name>
This is a reference to an explosion, defined by an [Explosion.
- trail = <effect>
This is a reference to an [Effect definition, in effects.ini or other effect files. The trail effect is drawn at the origin of the debris for its lifetime.
-----------
Lastly, the debris pieces themselves, defined by [Simple.
[Simple
nickname = simple_debris_large01
DA_archetype = Solar\asteroids\models\debris_large01.3db
material_library = solar\ast_debris.mat
mass = 10000
- nickname = <name>
As referenced by the explosion.
- DA_archetype = <file>
The model file for the debris piece.
- material_library = <file>
The file where the textures of the debris piece are stored; as with any model in Freelancer, you can specify any number of material_libraries if the model in question draws from more than one (or none).
- mass = <value>
Works like it does for ships. Again, I don't know why mass is specified here but linear drag, angular drag and rotational inertia are specified by the debris type.
================
Explosions are defined with an [Explosion block, like so:
[Explosion
nickname = explosion_ISD_primary
lifetime = 0.000000, 0.000000
process = shatter
effect = gf_explosion_li_battleship_mainexpbig
debris_impulse = 150
debris_type = debris_large_capship_piece_explode, 1.0
innards_debris_start_time = 0.0
innards_debris_num = 8
innards_debris_radius = 300
innards_debris_object = simple_debris_large01
innards_debris_object = simple_debris_large03
innards_debris_object = simple_debris_medium02
innards_debris_object = simple_debriszone_med01
strength = 100
radius = 1800
hull_damage = 500000
energy_damage = 0
impulse = 100
A look at what the parameters mean:
- nickname = <name>
This is how the explosion is referenced, be it by weapons, ships or fuses.
- lifetime = <time>, <time>
To be perfectly honest, I have not seen this influence anything. There may be a function, but if so I don't know what it is. As a guess, I imagine it works like it does for fuses and debris, where you specify the duration of the fuse/debris in seconds; so, the range of values would give a range of durations for the explosion. However, the duration of an explosion is not something that is well-defined, so I still don't know why it would matter (except for innards_debris_start_time, perhaps). You can always get away with using 0, 0.
- process = <process type>
The two process types are "shatter" and "disappear". Again, I really have not observed any difference between the two; I would guess that if there is a difference it relates to how the debris from the explosion is thrown, but that has no experimental basis.
- effect = <effect_name>
This is a reference to an [Effect, defined in effects.ini or one of the other effect files. In this particular case, the definition looks like this:
[Effect
nickname = gf_explosion_li_battleship_mainexpbig
effect_type = EFT_EXPLOSION_LARGE
vis_effect = gf_explosion_li_battleship_mainexpbig
The vis_effect is a reference to a [VisEffect in explosions_ale.ini:
[VisEffect
nickname = gf_explosion_li_battleship_mainexpbig
alchemy = fx\explosions\gf_explosion_li_battleship.ale
...other stuff...
The alchemy file is what actually specifies how the effect is drawn. .ale files can be modified given some patience, but it is difficult to do anything sophisticated and in any event that's not what this tutorial is about. Anyway, back to the explosion...
- debris_impulse = <number>
This is how hard the debris generated by the explosion is thrown outward. This works directly against the mass of the debris; if the debris is too light for the impulse you give it, you may not see any debris at all because it will fly off screen instantly.
- debris_type = <type>, <relative weight>
The <type> is a reference to a [Debris definition, which I will get to later. A single explosion may have multiple debris_type lines, in which case the game will randomly choose one of them for each piece of debris thrown, with the odds for each given by the relative weight.
- innards_debris_start_time = <time>
This is how long from the start of the explosion the debris will be thrown. If explosions work like fuses, the range of this value will be from 0 to 1, with 0 being the start of the explosion and 1 being the end of the explosion (the duration of the explosion being defined by lifetime). I always set the debris start time to 0.
- innards_debris_num = <quantity>
How many parts will be thrown by the explosion.
- innards_debris_radius = <distance>
The debris generated by the explosion will spawn at random positions inside a sphere of this radius, centered on the point where the explosion occurs.
- innards_debris_object = <name>
You can specify as many of these as you want; the game will randomly pick from these each time it creates a debris piece for the explosion. The name is a reference to a [Simple defintion, which will be explained later.
- strength = <value>
100 seems to be pretty common. At one point I thought this was tied into a function that reduces explosion damage as the distance from the explosion center increases, but I could never definitively confirm that. It may also relate to impulse rather than damage, but again, no conclusive evidence.
- radius = <distance>
Anything within this distance from the center of the explosion will take damage.
- hull_damage = <value>
The explosion will do this much hull damage.
- energy_damage = <value>
And this much energy damage.
- impulse = <value>
This is the impulse delivered to ships that are within the blast radius. It works just like it does with debris_impulse, so the mass of the ship that gets hit will affect how far it gets thrown.
----------
Now to get back to debris types, specified by [Debris
[Debris
nickname = debris_large_capship_piece_explode
death_method = exploding
lifetime = 0.5, 1.5
linear_drag = 5
angular_drag = 1, 1, 1
rotation_inertia = 100000, 100000, 100000
explosion = explosion_large_capship_piece
trail = gf_explosion_debris_trail01
- nickname = <name>
Referenced by debris_type in the explosion definition.
- death_method = <type>
The two death methods are "exploding" and "vanishing"; a debris set to "vanishing" will just sort of go away when its lifetime expires. "Exploding" debris will trigger an explosion at the end of lifetime.
- lifetime = <time1>, <time2>
The debris will last between time1 and time2 seconds before disappearing or exploding.
- linear_drag = <value>
This works just like it does for ships; why it is defined here rather than in the [Simple definitions for the actual debris pieces I don't know.
- angular_drag = <value>, <value>, <value>
Just like for ships.
- rotation_inertia = <value>, <value>, <value>
Just like for ships.
- explosion = <explosion_name>
This is a reference to an explosion, defined by an [Explosion.
- trail = <effect>
This is a reference to an [Effect definition, in effects.ini or other effect files. The trail effect is drawn at the origin of the debris for its lifetime.
-----------
Lastly, the debris pieces themselves, defined by [Simple.
[Simple
nickname = simple_debris_large01
DA_archetype = Solar\asteroids\models\debris_large01.3db
material_library = solar\ast_debris.mat
mass = 10000
- nickname = <name>
As referenced by the explosion.
- DA_archetype = <file>
The model file for the debris piece.
- material_library = <file>
The file where the textures of the debris piece are stored; as with any model in Freelancer, you can specify any number of material_libraries if the model in question draws from more than one (or none).
- mass = <value>
Works like it does for ships. Again, I don't know why mass is specified here but linear drag, angular drag and rotational inertia are specified by the debris type.
================