Modding, Mission Design, and Coding > Test Builds

Actions system test builds

(1/3) > >>

My original idea for the content of this post was a drawing of one of the Blue Planet ships which showed it venting some kind of steam after firing a beam. Unfortunately, I cannot find that image anymore...
I guess the in-universe reason for that was venting of some cooling agent but I just thought it looked quite nice.

So, my obvious next question was, how do I make that possible in-engine for FSO?

The result was this:

I know it uses retail assets and it also doesn't look like steam but I am a coder, not an artist :p

In that video I set up the two effects with what I call the "Action System". That is a fancy name for a system which allows a modder to specify simple sequences of "actions" that are executed in-sequence by the engine to produce whatever effect a modder wants. I wanted this system to be as flexible as possible to allow maximum freedom for whatever things this might be useful for.

As an example, the effect in the video above was produced by this table:

--- Code: (actions-shp.tbm) ---
#Ship Classes

$Name:                          GTC Fenris
$Subsystem:                     turret02, 3, 5.0
$Default PBanks: ( "SGreen" )
; This demonstrates how this feature could be used for simulating an effect where a cooling system kicks in after a beam has been fired
; The visual appearance is not perfect since retail does not have a "vapor" effect built-in
$On Beam Warmdown: ; This defines a "program" to run once a beam weapon has finished firing
; Timing for effects is important so this allows to delay the execution of the remaining actions by 5 (in-mission) seconds
+Wait: 5

; Some actions simply update some internal data which can be used by later actions
; This data will be kept until it is set again and can be used by an unlimited number of actions
+Set Position: (8 0 0)
+Set Direction: (1 -1 1)

; All positions and directions are local to the attached subobject (turret02 in this case) and will respect animations

; These actions actually cause some external "thing" by using the previously set "local" data
+Start Particle Effect: Beam Warmdown Effect
+Play 3D Sound: 18

+Wait: 3

; Programs are attached to the object that triggered them so if the object dies before this can run then the sound will not be played
; The position is still (8, 0, 0) from the previous setting so no need to set it here again
+Play 3D Sound: 19 ; Actions can be used multiple times with different parameters
; Multiple independent programs on the same condition are also possible if necessary
; Both these programs will be triggered at the same time and run "concurrently"
$On Beam Warmdown:
+Wait: 5

+Set Position: (-8 0 0) ; Relative position to beam turret subobject
+Set Direction: (-1 -1 1) ; Direction for the particle effect
+Start Particle Effect: Beam Warmdown Effect
+Play 3D Sound: 18

+Wait: 3
+Set Position: (-8 0 0) ; Relative position to beam turret subobject
+Play 3D Sound: 19


--- End code ---
(I also attached a small mod with the relevant particle table and a test mission)

This contains all the actions that are currently supported. In case you are still reading and want to test this out for yourself, here are some test builds which support this feature:

Test Builds:
Windows 64-bit

Windows 32-bit


The code is in a state I would call "ready" but if you want to give some feedback now on the usability, I would be glad to hear it.

[attachment deleted by admin]

The first thought I have is that this is very cool, thanks for this!

My second thought is that for effects of this sort it is very very useful to be able to 'attach' the effects to different joints/subobjects. For instance if I have a modeled multi-apart beam turret, I might want a shower of sparks from the arm object, an immediate spray of steam or other particles from some part of the turret body, and/or another, less intense spray from some vent on the body of the ship itself.

EDIT: Further thinking about the events system in Homeworld 2 and Remastered, which accomplishes similar things in similar ways, if you're able to attach effects to arbitrary objects/points on the ship, it'd be useful to be able to add special named effect anchor points(with orientations) to pofs to be referenced here, and it'd further be useful to be able to specify a list of said points to pick randomly between when playing an effect.

Interesting use case. Subobject attachment is already a thing in the system (the positions in the table above are relative to the beam turret).

How would you expect attaching to different sub-objects to work?

I could very simply implement actions that basically say "set the current subobject to the parent subobject", or "set the current subobject to child subobject <name>".

Would that already be sufficient?

Ah, saw the anchor point edit too late.

That will probably require some changes to the model reading code but we could probably reuse the glowpoint functionality for that. We would only need to have a name for a glow point bank and an option to turn off rendering to make them invisible.

Once that is done, the actions system would only need to go to the right glow bank, pick a point and that is it.

This looks fantastic!


[0] Message Index

[#] Next page

Go to full version