FlowNode Substitutions

Overview

Flow Graph is the most important tool for level designers to create gameplay with. On the code side it has been progressed from many directions and over multiple projects, which also caused some general problems. Flow Graph is made up by relatively few game-specific flownodes, which can be changed or removed without conflicting with other projects. But most of the flownodes were created in CryAction and are shared between all teams and projects. To remove or to change them usually means that everybody has to be aware of the change and fix all levels using these flownodes.

For Crysis 2 we introduced massive changes with the implementation of the component system. Many engine-wide flownodes were then outdated and made useless. At the same time we needed a cleanup of Flow Graph, to keep it usable and maintainable and also easy to understand for new designers.

This conflict was solved by creating a project-specific blacklist, which removes or renames flownodes without actually changing their implementation. This blacklist can be found in GameSDK/Libs/FlowNodes/FlownodeBlacklist.xml. It's altering the Flow Graph at load time and can be used in conjunction with the Substitutions.xml, found in the same folder, to completely change the representation of the flownodes without altering the code, while preserving backwards compatibility and compatibility to other projects.

Usage

Usage of the Substitutions.xml is fairly straight forward. You input the existing (code-side) data and output the newly requested (script-side) data.

<Node OldClass="entity:MissionObjective" NewClass="entity:MissionObjective">
    <InputPort  OldName="DisableObjective" NewName="Deactivate" />
    <InputPort  OldName="EnableObjective"  NewName="Activate" />
    <OutputPort OldName="DisableObjective" NewName="Deactivated" />
    <OutputPort OldName="EnableObjective"  NewName="Activated" />
</Node>
  • OldClass is the name of the existing Node. If you don't want to change the name of the node, simply repeat the name in the NewClass parameter.
  • InputPort refers to the Input ports of the node which you can rename. These are separated from the OutputPorts which can sometimes be the same name on code side.

If you want to simply change the name of a Node but keep the ports in tact, that can be done as well, without the need for mapping the ports:

<Node OldClass="entity:HumanGrunt" NewClass="entity:Human" />

Notes

Substitutions will only work in Editor and they are intended to patch existing flowgraphs in levels. If a change has been made, you need to open the level in the Editor, save and re-export the level to properly "fix" any changes.

FlownodeBlacklist is intended to rename new instances of a node to be used in flowgraphs, without having to change engine/gamecode.

Example

As an example, let's rename a node from Time:TimeOfDay to Environment:DayTime in the FlownodeBlacklist:

<Ren class="Time:TimeOfDay" newClass="Environment:DayTime"/>

The change you've made here is where the node will appear in the flowgraph nodes list, and of course, the name of the node. It will now appear in the Environment folder and is able to be used without a problem for new flowgraphs.

However, when you load a level which already uses the Time:TimeOfDay node, Sandbox will give you an error saying that it cannot find the node and the Launcher will completely discard the flowgraph.

Next step is to add the following codeblock to the Substitutions:

<Node OldClass="Time:TimeOfDay" NewClass="Environment:DayTime" />

This will fix existing flowgraphs referencing the Time:TimeOfDay node and update them to use the Environment:DayTime node, but only in Sandbox. Simply save and re-export the level to fix it for use in Launcher as well.