This Week in Fyrox #2
Fyrox is a Rust game engine with lots of out-of-box game-ready features and a full-featured editor. Second week of November is full of significant changes.
# Animation System Rework
The most significant event of this week is that animation system of the engine is being reworked. So what's wrong with the animation system of the engine so it needs to be reworked? The core of it is fine, however the fact that all animations and animation blending state machines (ABSM) lives in their own separate containers is adding a lot of headache when managing them.
The next problem is that animations and ABSMs are stored in resources. This complicates relations between scene nodes they animate and actual animations. The most significant problem is animation copying. Imagine that you have a character with a bunch of animations and a state machine that blends all these animations to get a final pose. Right now everything is stored in separate places and to create an animation, you need to create a resource (or find one in the internet) and then instantiate it. The instance itself is responsible for actual animation, while resource is just holding key frames. Now you need to clone your character... and that's where you'll get a lot of troubles. At first: you need to copy character nodes, then you need to copy all respective animations (remember - they're stored in a separate container), then you also need to copy the state machine. That's not all: next you need to ensure that animation copies works with respective node copies, the same must be done for state machines. As you can see, it is very tedious and error prone.
What's the solution to these problems? Store animations and state machines in respective scene nodes. The engine now has two new nodes:
AnimationPlayer- this node is a container for animations, it can play the animations it contains and apply them to a scene graph.
AnimationBlendingStateMachine- this node is a container for a state machine that is used to blend multiple animation into one. It uses specified
AnimationPlayernode as a source of animations.
Now to clone animated character all you need to do is to call
Graph::copy_node and the rest of work will be
done for you. The engine will copy
AnimationBlendingStateMachine nodes, remap handles
from originals to their respective copies. In addition, property inheritance will also work for these nodes,
which will allow you to create a prefab with all nodes and animations prepared and all its instances will sync
their state if the prefab is changed.
This rework is far from completion, it should be done closer to the next release of "This Week in Fyrox". Stay tuned.
# Animation Blending State Machine Editor Rework
Animation blending state machine helps you to combine multiple animations in one and apply it the scene graph. The new approach to animations mentioned in the previous sections requires significant rework of the editor. At first, the editor does not need the previewer - scene previewer will serve for this purpose. Secondly, its own inspector is also removed - it is replaced with the standard editor's inspector. Thirdly, menu is removed too as well as its own command stack.
The more significant changes has to be done in the internals of the editor. Previously, it worked with AbsmResource
which contained specific data that is then used to create animation blending state machine instances. But now
it works with
AnimationBlendingStateMachine scene nodes which has slightly different internal structure which
results in large amount of changes (opens new window).
# Animation Editor Progress
Animation editor has some improvements too. At first - it now uses tree structure to show curves. Secondly, it now has a toolbar that allows you to play/pause and stop an animation, as well as change it playback speed. The UI of the animation editor is now disabled if there's no animation selected.
Animation system rework will also change the appearance of the editor, because
Animation resource will be deleted.
The editor will work with
AnimationPlayer nodes instead.
# Editor improvements
PropertySelector widget is used to select properties from any object that implements
Reflect trait. In this week
it was improved to show types of the properties and be able to restricts types of properties that can be visible.
Also it now prevents to select "nothing" - "OK" button is now disabled until a property is selected.
# Full List of Changes in Random Order
- Removed previewer from ABSM editor.
- Removed inspector from ABSM editor - now it uses standard editor's inspector to edit ABSM entities.
- Toolbar for the animation editor.
- Save changes made in the curve editor of the animation editor.
- Preserve curve and keys ids in the
CurveEditornow sends synchronization message when new key was added.
TrackFramesContainer::newso it generates curves with unique ids all the times.
- Animation editor now shows tracks using Tree widget.
- Ability to animate real numbers and Vector2/3/4.
- Restricted types that can be animated in the animation editor (allow animating only numeric properties, prevent animating read-only properties).
- Type filtering for PropertySelector widget
fyrox-templateto make sure it generates relevant code.
If you want to support the development of the project, click one of the links below. Preferable way is to use Boosty (opens new window) - this way the money will be available for the development immediately. Alternatively you can can use Patreon (opens new window), but in this case the money will be on-hold for unknown period of time (details are here (opens new window)).