Important Message

You are browsing the archived Lancers Reactor forums. You cannot register or login.
The content may be outdated and links may not be functional.


To get the latest in Freelancer news, mods, modding and downloads, go to
The-Starport

**Tutorial** Advanced explosions

Here you find the different tutorials on editing and MODing Freelancer

Dev

Post Thu Aug 31, 2006 7:43 pm

**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.

================

Dev

Post Thu Aug 31, 2006 7:44 pm

And since it decided to cut off the bottom of the my post...

Finally, a side note on circular references. You may have noticed that explosions reference debris types, and debris types reference explosions. This raises the possibility of a single explosion generating multiple explosions; you could even run the number of explosions up to infinity if you wanted (though your game would crash first... maybe freeze, I haven't tried it). However, more modest things such as cluster bombs or a one-hit-kill missile (via a rapid-succession double explosion) are entirely possible.

Post Fri Sep 01, 2006 3:32 am

nice tut. and useful sidenote Dev, thanks

Ogu

Post Fri Sep 01, 2006 10:06 am

So, let me get this straight.

You make a missile/mine/whatever use an explosion that has debris which explodes, right? Doesn't this mean you could have more debris flying from the explosion of the first debris, creating an endless cycle?

And couldn't the debris that explodes make twice as much (or any amount of) debris, again in an endless cycle of ever increasing debris and explosions? I'm gonna have to try that.

Post Mon Sep 04, 2006 5:38 pm

>"I'm gonna have to try that. "

word LOL Check this:
Click here

@Dev: Did you actually manage to generate cluster bombs and debries that do damage?

I tried and didnt succeed
The funny thing is it seems like freelancer does not want multiple damage-explosions. When I set up the infinite debries explosion loop, the first explosion wont do any damage as well! Damn it...

Post Mon Sep 04, 2006 9:04 pm

Same here. Can't get any explosions out of debris. Would solve lotsa problems if this worked. Would be sooo handy to have an explosion triggered shortly after it's origin was killed.

Edited by - Preacher0815 on 9/4/2006 10:09:03 PM

Dev

Post Mon Sep 04, 2006 10:36 pm

Well, now that I actually try what I predicted would be possible, it would seem that debris explosions do not do damage. I will tinker with it some, but so far it doesn't look too promising. Oh well.

Edit: Here's an interesting thing I just walked across. The lifetime of an explosion determines the delay before the visual effect of the explosion is drawn, in seconds. However, damage will still be dealt immediately, so I'm not really sure how useful this could be.

Edited by - Dev on 9/4/2006 11:39:56 PM

Ogu

Post Tue Sep 05, 2006 6:05 am

Nice w0dk4 lol

Return to Freelancer Editing Tutorial Forum