Fx System Tutorial
{{under construction|This tutorial is being overhauled, the later parts of this tutorial are still in-process, and more screenshots are still needed.
Caution: This page may contain information which is Hero's Journey-specific! |

- This is an intermediate-level tutorial, on how to work with the Fx System. For a basic overview tutorial, see Creating an Fx
The Fx System is used to combine particle effects, lights, sounds, and other effects such as lightning, mirrors, and flares, and combine them all together into an amazing "Fx".
Definitions
An Fx is an instanced node, created from an Fx template or an "Fx spec". When designing an Fx, you are actually designing an Fx spec, which will be the template from which the Fx nodes are created. For the purpose of this tutorial "Creating an Fx" means "creating an Fx spec", which is the same as "designing" an Fx spec.
To create an Fx spec, you will use the Spec Oracle editor. There are multiple Spec Oracles in HeroEngine, for other things than just Fxs. Each Spec Oracle can be thought of as a container for individual specs.
The Spec Oracle editor for Fxs, is called the "Fx Browser".
Open the Fx Browser
To access the Spec Oracle editor:
- Open up your HotSpot Menu (Ctrl-Shift-Click in the upperleft corner of the viewport), click on the Tools tab, look under Spec Oracles, and select "Fx", the Fx Spec Oracle.
This provides a list of every Fx Spec Oracle that has been created in your current world. The list may be long or short, depending on current development. This tutorial is written from the expectation that you are in an "empty" Clean Engine world. If you access the Fx Spec Oracle in Hero's Journey Reference, or in a world which has already been undergoing development from your company, you may see many Spec Oracles.
The list can be sorted by SpecKey, Name, or Description, by clicking on the headers.
- Click on "Add" to create a new Fx.
Fx ToolBar Icons
- You should now see multiple controls, such as:
- An FxToolbar with several icons along the top of the viewport
- The Fx Task Browser, which should currently list one container group: fxgNewFxGroup
- A Preview panel with buttons
- An "Edit Spec Data" window
Icons 2 through 4 on the FxToolbar are toggle icons. Click on them to turn panels on and off:
-
- Toggles the Spec Data panel on and off, where you enter a name and description for the Fx
-
- Toggles the Fx Task Browser panel on and off.
-
- Toggles the Preview panel on and off
Hovering over the other icons will give you a tip as to what they are for:
- Emitter: For adding Particle effects to your Fx
- Zap: For adding Lightning
- Model: For adding a model asset
- Light
- 3D Sound
- Flare
- Mirror
- Sound (non-3D)
- Attacher Tool
- Transformer Tool
- TransformArc Tool
- ModelFader Tool
- AnimationCommand Tool
- ScriptCall Tool
- Fx container tool
FxTasks and FxGroups
Every Fx you create may have one or more 'FxTasks'. An FxTask is something that can happen. There are two types:
- 3D instance task (those that create 3D instances, via an instantiated node)
- Tool tasks (those that do stuff to other stuff)
All these tasks are held in the main Fx container, called an FxGroup. In your task browser and the Fx Toolbar, this is the FxBox icon, that has the letters "Fx" over an open box.
- In the Fx Task browser, click fxgNewFxGroup to activate the FxGroup Properties panel (also called the Properties sheet).
- In the property sheet, you can rename the Fx, change its type, set how long it will run, and when it will stop. You can also specify a script name that lets you further extend the system.
- For now in this tutorial, leave the property settings as-is.
Add a particle effect FxTask to the FxGroup
To add an FxTask, such as a particle effect, click the icon of what you want to add in the FxToolbar, and drag it on top of the fxgNewFxGroup
- Grab the particle effect (it may be called an "emitter"), and drag it onto the FxGroup
- A line with NewEmitter should appear in the list
- The Save button (picture of the floppy) should now light up in the FxToolbar, telling you that you have made changes.
- On the right, you should see the FxEmitter Properties sheet
- Specify a particle effect to use
- In the property sheet next to ResourceName, there is a grey button on the right with "...". Click on it to get a selector, and then navigate to \Engine\CleanGame\GlobalParticles\HE_Logo.prt
- Be careful to choose "HE_Logo" and not "HE_Logo_p". The first is the emitter, the second is the actual particles.
- Click OK
Specify a location for the FxTask
Now you'll specify where the particle effect that you've chosen should appear.
- Adjust your view in the viewport so that you can see your character
- In the property sheet, in the Fx3dController section, change StartLoc to CASTER (this is from fantasy RPGs, as in "spellcaster")
In the FxSystem panel:
- CASTER is equivalent to the Target 1 that is specified in HSL
- TARGET is equivalent to the Target 2 that is specified in HSL
Preview different locations
- Click the Preview button in your Control panel
- If you can see your character's feet, you should see the Fx for 5 seconds. In Clean Engine this will look like large HeroEngine logos moving through the ground.
In the FxEmitter Properties sheet, StartLocBone just under StartLoc lets you specify a bone name. If your CASTER is a character, and has a bone of the name you specified, the particle effect will appear there.
- Change the StartLocBone property, by typing in: Bip01 Head
- Click the Preview button
- The particle effect should now appear at the level of your character's head.
StartLocOffset lets you specify an exact position away from the start location.
- In StartLocOffset, type in (0,0.1,0)
- Preview, and the particle effect should now be above your character's head
- In the Fx Task Browser, click your FxGroup (fxNewFxGroup) and then in the FxGroup Properties, change the duration (FireRate) from 5 seconds to 20 (0:00:20.000)
Note: Anytime you make a change in a textbox, hitting ENTER, TAB or ESCAPE or just clicking away should save the change
- Click Preview, and notice how the Fx now lasts 20 seconds.
- Set the FireRate back to 5 seconds (0:00:05.000)
Save the Fx
- In the Edit Spec Data window, type a name for your Fx, such as "Joe's Test Fx" (using your name)
- In the "Description" field, enter something relevant, such as, "Fx being used for the wiki tutorial"
- Click on the "Save" button in the Fx Toolbar (the picture of the floppy)
- You should get a popup window saying, "The server has updated the spec", and the floppy icon should grey out, until you make your next change.
Attachment
Next, we'll add a model asset that can be held by the character.
- From the FxToolbar, drag a model (the cube) to the Fx Task Browser.
- In the FxModel Properties sheet, choose a ResourceName. One option in CleanEngine is \Engine\CleanGame\Resources\Common\utility_sphere_white01
- Change StartLoc to Caster
- Change StartLocBone to Bip01 L Hand
- This puts it in the right place but it is not attached
- Click on Preview
- Walk your character forward a few steps (W-key) and notice how the asset stays in place.
- Change AttachTo to CASTER
- Notice that AttachBone now appears
- Note that the property sheet hides fields that don't make sense to set at this time. You won't need AttachBone unless you have specified a character in CASTER or TARGET.
- Add Bip01 L Hand to Attachbone, and preview
- Walk your character around and observe the effect.
- Change the Scale to (.5,.5,.5)
- Preview
Note: AttachTo always overrides StartLoc. This is because it attaches it immediately after placing it.
Every 3dInstance task, such as particle effects, zaps, models, lights, 3dsounds, mirrors, and flares, can work the same way, with a starting location and then attaching.
Attachment delays
attachDelay means wait that amount of time before attaching (you may need to scroll down in the FxModel Properties sheet to see this option).
- Set AttachDelay to 0:00:02.000
- Click Preview, and walk your character forward.
- The model should stay in place for two seconds, and then snap to your character's hand.
Events
An Event is 'when something happens'. Most things you can add to an Fx can Start and stop, therefore, they have an ONFXSTART and ONFXSTOP event.
In our current tutorial, we have two things:
- The FxGroup which controls everything
- The particle emitter
Each one will Start and stop. When they do, they tell everything else that they did so.
- Select NewEmitter (if it isn't already selected)
- In the FxEmitter Properties sheet, in the FxEvent section, click the WhenToStart dropdown
- This displays every possible kind of event.
- The two most important ones are ONFXSTART and ONFXSTOP
- Close the dropdown, which should be at the default of ONFXSTART
- Change the StartDelay to 1 second: 00:00:01.000
- When Previewed, the model should appear right away, but the particle effect will wait one second before it starts
- Click on NewModel in the FxTaskBrowser
- Set the AttachTo dropdown box to CASTER
- Set AttachBone to Bip01 Head
- Set AttachPosition to (0.05,0,0)
- Ensure that AttachDelay is at zero: 0:00:00.000
- Preview
FxZaps
- Next, drag a Lightning bolt (also called an "FxZap") into the browser. It should show up as NewZap
- Note that unlike particle effects, lightning bolts are all specified right in the property sheet, which should now say FxZap Properties.
- Set TextureRepeat 1
- Divisions 1
- LightningWidth 0.1
- Deformation_X 1
- Deformation_Y 1
- In the DiffuseColor section, you can click the ... button to get the Color Picker GUI.
- Note: If the Color Picker doesn't show up right away, try widening your window.
- Choose a color
- Preview
- You can specify a texture, or if none is selected, the system colors a blank poly
The Fx will appear, but probably will not look like lightning yet, depending on your current view. This is because if you do not specify a target, it targets 0,0,0 in your immediate area.
- Change TargetName to Target
- Select some other object in your area by clicking on it (you should see a bounding box around it)
- In the Preview panel, change the Target from SELF to SELECTION
- Make sure you change both places. In the FxZap Properties sheet under "FxZap", ensure that TargetName is set to Target
- In the Fx3DController section, set StartLoc to CASTER
- Click "Preview" and you should see a simple lightning bolt stretch from the caster to your selected object
- Select a different object, and click "Preview", and you will see that the bolt will go from the caster towards whatever is selected
Continuation
- This section is in-process, and may not work properly
Add another particle emitter:
- Drag the particle effect icon from the FxToolbar to the Fx Task Browser, where it will probably show up as "NewEmitter1"
- Name your emitters:
- Click on the first emitter ("NewEmitter") and in the FxEmitter Properties sheet, under "Name", change it to "HeroEngine particles", and press Enter
- The name should now change in the Fx Task Browser
- Click on the second emitter (NewEmitter1) and in the Properties sheet, change its name to "SparkBall"
- Click on the first emitter ("NewEmitter") and in the FxEmitter Properties sheet, under "Name", change it to "HeroEngine particles", and press Enter
Next, we will take the sparklies and make them fall out of our particle effect no matter where it goes. To do that, we tell them to attach to the particle effect.
- Click on "SparkBall"
- In the Properties sheet, in the Fx3DController section, select the AttachTo dropdown
- Notice that the dropdown box lists the current names of everything in your Fx Task Browser
- Set it to "HeroEngine particles"
- Change the SparkBall back to AttachTo NOTHING
- Add back StartLocBone Bip01 Head and StartLocOffset (0,0.1,0)
The spark ball should now appear above your head with the sparklies falling below
Chasing a target
To have the SparkBall chase a target:
- Select the SparkBall
- Under the FxEmitter section, change TargetName to Target
Speed
The Fx will not go anywhere unless it has a speed.
- Change Speed to 1
- With Target = Selection in Preview, and something selected, give it a try
- Ensure that sparklies are attached to sparkball, otherwise they appear at 0,0,0
- Change Sparklies properties:
- WhenToStart to ONFXSTART
- StartFxName to Sparkball (instead of fxgNEwFxGroup)
Note that particle effects cannot target a bone, they can only target an instance. The way to work around this, is to attach something invisible to the bone you want to target, and then have the chaser target that. One method is to create some "invisible" particle effects, such as a particle effect that emits an empty polygon once every 10 seconds, and call it PlaceHolder. Or make an invisible particle effect that rotates, and then attach something to id.
To edit your own particle effects, see Copying particle effects. Add a copy of the one you want to change in your area, then click Copy Particle Asset Chain, which makes a new one in your area which should be editable.
Sound
There are three types of Sound:
- "Sound", which just plays a file on the stereo channel
- "3DSound", which is actually added to the world and thus becomes 3D
- "3DSoundFMOD", which is a 3d sound leveraging FMOD
To add a sound to the Sparkball:
- Drag a 3dsound Fx into the browser
- Ensurce that you are dragging "3DSound" and not "Sound"!
- The sound resource is \world\segment\demoland\resources\audio\combat\cbt_scorchchase_loop.sgt
- Change the sound's StartFxName to the Sparkball
- Have it attachTo sparkball
- Change StartFxName to Sparkball
- Change AttachTo to Sparkball, otherwise the sound appears at 0,0,0 and will not be audible.
- Under your Filter Menu in HeroBlade, ensure that Audio is visible, by clicking on the "Eye" icon. This make the Audio visible when it is added.
Finale
- On the far right, drag an Fx into the Fx Browser
- Drag two particle effects on top of NewFx and one 3DSound
The new tasks will appear under NewFx, instead of fxgNewFxGroup
If you run into trouble, click one of the other tasks and change its name. This will make it rebuild, and may help.
- Make one emitter \world\segment\demoland\test_area\jeff_ukarbandcamp\sample_boom.prt
- Make the other emitter \world\segment\demoland\test_area\jeff_ukarbandcamp\sample_splashsparks.prt
- Make the 3DSound \world\segment\demoland\resources\audio\combat\cbt_spell_magichit1_flat.sgt
We want all 3 of these new tasks to happen at the same time and at the same place.
- Set each WhenToStart to be NewFx (actually it should already be set if you dropped in on top of NewFx)
- Set each StartLoc to Target
- Change NewFx to WhenToStart ONTARGETACHIEVED
- Set StartFxName to Sparkball (this means it will wait till it detects sparkball reaching its start and then start)
- Preview
Note: You may have to go out of character mode to click something. It should work for either type of selection, game mode where you click a creature and get the circly thing, or edit mode and you have the edit tools
- For the two emitters boom and splash:
- TargetName should be NOTARGET
- StartLoc should be TARGET
- Sparkball should have TargetName = TARGET
Exit
To exit the FxGUI, click the X button on your control bar. That is how you exit the system. When it says Exit without Saving click Yes
Debug as needed, and don't be afraid to experiment! To add your own Fx, just click Add. Once you have a new empty Fx, click the Spec Button on your control bar, and change the name to something that you will remember. Also add a description.
Naming conventions
For testing, it can be useful to use your own character name in the title.
Most of the existing ability fxs start with fx, but that was when we were limited to one name space.
Deletion
To delete an item, click and hold down the mouse and drag it off the browser. You will get a popup: "Are you sure you want to delete?" Click "OK".
Tips
As you tweak an Fx, you can definitely preview it, but it is not saved to the server until you click SAVE
Example
Open ASampleFx to see a saved version.
Fx Tool Tasks
- Main page: Fx Tool Tasks
Fx Tool Tasks, are utilities which do their work on other tasks
FxAttacher
An Attacher is used to attach one instance to another instance or character. With most 3d instance tasks, when it starts you can also choose to attach it to something. An FxAttacher is used when you need to attach something to something, at a time other than when it started.
Example
- Open up the FxSpecOracleEditor
- Sort by display name
- Look for SampleAttacher, and open it for preview
Working correctly, a glowy particle effect should appear, and get attached to a different character bone on your character every 2 seconds.
- Click on AttachToHead in the Fx browser
It is fairly straightforward to setup. Specify AttachThis as the thing to attach, and AttachTo as the thing you want to attach it to
Note that an Attacher only has a WhenToStart event, no WhentoStop. This is because it does its job instantaneously
If you set AttachRelative to true, then the object that will be attached maintains its current position relative to the thing it is about to be attached to. So if you had an eyeball on the ground behind your character, and attached it to your character with AttachRelative to true, then the eyeball would remain behind your character as you run around, instead of changing positions to match my current position
To Detach something, use an Attacher and set its AttachTo to DEFAULT which means attach to nothing.
Note: If you try to attach something to a thing, but it's already attached to something else, the system automatically detaches it for you.
Transformers
When you want to change the position, rotation or scale of something over time, you use a Transformer
- Open up your FxSpecOracleEditor
- Sort by display name
- Look for SampleTransformer, and open it for preview
Transformers can appear complex, because they have many options.
- Click TransformAll in the browser, to examine its properties
In the FxTransformer section, you specify what you are going to transform. This will be any 3d instance you've added to your Fx, or the special CASTER and TARGET names.
CASTER and TARGET are special. They can refer to any instance that your script system chooses to pass in to the Fx System, so they don't specifically mean your character and the character you have clicked on.
Transformations can be applied to caster or target.
Note that if you attempt to transform your own character, you'll get varied success, since the Fx System is entirely client-side, and some update come from the server:
- Scale transform works reliably
- Rotation transform works sometimes
- Position transform is unpredictable, since its updates come from the server
So it is good to keep in mind that anything which the Fx System is moving around, is taking place only on the client. Things such as spells which appear on everyone's client, do so because we send a command to everyone's client to play that effect.
Note that if specify a Start Loc and a TargetLoc, these refer to the Position, and will be ignored if rotating or scaling. For an example, a developer could create two Tennis Rackets, and then create a tennis ball and transform the ball from StartLoc Racket1 to TargetLoc Racket2.
If either Loc is left at DEFAULT, then the Fx System uses StartPosition and TargetPosition.
Transform3D
This is where all the work happens.
- Skip Curvetype for the moment
- Delay means when it starts, as in "delay that amount of time before actually doing anything"
- Duration is how long to take to go from Start to Target
- RepeatCount is how many times to do it, 1 being default
- Reverse means when it reaches the Target, turn around and go back to Start
There are three Ignore settings:
- IgnorePosition
- IgnoreRotation
- IgnoreScale
They are there simply to help simplify things. Click each of them to TRUE, to see how they work. IgnorePosition for example, when TRUE, means it will not change the position of the instance at all. It hides any fields that have to do with Position in the Transform3D section.
- Curvetype.
- LINEAR: Use if you want something to move from point A to point B and take 10 seconds to do so AND move at an exact even speed all the way across
- EASE_OUT: If you would rather have something start moving slowly and speed up, while still maintaining 10 seconds from A to B.
- EASE_IN: The reverse, causing something to move quickly and then slow down as its reaches its target (like "easing a car into the garage")
- SMOOTH: Combination of EASE_OUT and EASE_IN
- TWIST: The reverse of SMOOTH
- HOLD: Doesn't move at all
- SQUARE: Steeper versions of ease_in and ease_out
- Set UseOneCurveType to FALSE
- This allows you to specify a different curve for every axis being modified, which allows some rather complex movements
TransformArc
TransformArc is a specialized version of Transform3D, specifically made to move something in an Arc above the ground. You specify a start and target position, then tell it how high you want it to go, and that is all that's needed.
Fading
Faders can be used for effects like making floating skulls fade in and out
Whenever adding a Model, you have the option to change StartMethod to FadeIn and StopMethod to FadeOut
FadeIn will begin when the mesh starts
Fadeout will begin when the mesh stops
If you need to change the alpha (aka fade) of a mesh at any other time other than start or stop, you use a MeshFader
Drag a Fader from the Fx Toolbar down on top of Maiden to see its settings. It is similar to Transformer, because you can specify a curve, duration, repeatcount, reverse, and so far.
Animations
The FxAnimationCmd tool allows you to send a Behave command to a character. A Behave command makes a character play a particular animation, such as waving a sword, or yawning.
- Open up SampleAnimCmd and preview it
- Click HitGround in the browser to see our AnimCmd
- Specify CASTER or TARGET which will contain a character (or else nothing happens)
Most animations that can be played are linked to a MODE that the character is in. For example, to play the SpellcastGroundImpact anim, the character has to be in Combat mode, otherwise nothing happens.
- Specify the mode the character needs to be in
- Then specify the command string to send to the character
There are various ways to learn which animation commands are possible. One technique is:
- Open up the script editor
- CTRL SHIFT S (Open Server Script)
- In the filter box at the bottom, type in "Human"
- Select the script BaseHumanLike and open it. This script has all the functionality that builds the right-click popup menu
- Around line 423, you should see the commands that are being sent to perform a particular menu option
- Around line 494, look for SpellCastGroundPOund
- Copy the command and add it to AnimCmd section in the Fx
(check line numbers)
Synching special effects with an animation
Here, since we already known how to play an animation, we will cover how to synchronize special effects with certain parts of an animation, such as in our example when the character hits the ground.
- In the Fx browser, look at Asplode
- It is set to start ONANIMATIONNOTE
- Its StartAnimator is CASTER.
- This means it will listen to the character specified in CASTER and wait for it to send it a matching Sequence and Note
Animation notes
Animation notes are little text notes that the Animator adds to the animation, to denote a particular significant point within the animation.
For instance a LeftFootDown note might appear in the walking animation. This would allow the sound developer to play a footstep sound at exactly that point
In the SpellCastGroundPoint animation, there is a note at the part of the animation when the fist is at its lowest point: *NOTE GROUND SLAM
To find out what notes exist in an animation:
- There are always *BEGIN and *END
- For other notes, a separate utility is required.
- (Note: If you are in an area with other characters, this may generate a lot of messages)
- In the console, type CALL QUILL ANIMDEBUGON
- You should start seeing debug output in the console, which will change every time you perform an animation
- Once its on, right-click your character and choose an animation to play
- You should see a *BEGIN and *END and maybe some notes in between
- From this output, you can get the exact text for Sequences and notes that you will need to use the ONANIMATIONNOTE event
- To turn it off, in the console type: CALL QUILL ANIMDEBUGOFF
(the quill method has been deprecated, use the right-click menu as listed in Animation notes)
Extending the Fx System
To add Fx functionality which does not yet exist, any Fx can be linked to a separate control script.
- Click fxgNewFxGroup in the browser
- At the top, specify a ControlScript
- Add any script of your own creation. That script will receive all the events from your Fx, and on any particular event, you can run any code that you want.
- With the Script editor, open up the Client script _FxControlScript to see the two functions you can add to your scripts to interface with your Fx's
The EventOccurance shared function is the one that gets all the events. From there you could fire off more Fx's or many other things, based on the events from your Fx
The OnFxGroupPreStart function gets called before the Fx is played, passing in the Fx object with all the data about the Fx. There, you can make on the fly changes to alter the behavior of your Fx, basically allowing you to do anything else that has not already been added to the Fx system
See also
Caution: This page may contain information which is Hero's Journey-specific! |
- HJ:HJCharacterBones contains all the (human) bone names.
http://hjwiki.play.net/hjwiki/index.php/HJCharacterBones
This can also be done with:
CALL QUILL BONES;IDofacharacter
to get a list of bones for that character