-
Notifications
You must be signed in to change notification settings - Fork 809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion for section 4.5.4.1 #59
Comments
Hey, thank you. I've heard of the evaluation channels before but have never used them. I don't want to include them without a working example.
Where does that happen? |
Excellent was looking for something like this, didn't realize it was a feature that was just hidden by default. The description in those release notes is really helpful, quoting that here just because it was buried a bit:
And here's some more important snippets from source after reading into them more: Each channel gets evaluated in order, with the final result from the previous channel used as the base value for the next channel. This happens in float FAggregatorModChannelContainer::EvaluateWithBase(float InlineBaseValue, const FAggregatorEvaluateParameters& Parameters) const
{
float ComputedValue = InlineBaseValue;
for (auto& ChannelEntry : ModChannelsMap)
{
const FAggregatorModChannel& CurChannel = ChannelEntry.Value;
ComputedValue = CurChannel.EvaluateWithBase(ComputedValue, Parameters);
}
return ComputedValue;
} Note that although it's iterating a map, the order of the map is automatically managed in FAggregatorModChannel& FAggregatorModChannelContainer::FindOrAddModChannel(EGameplayModEvaluationChannel Channel)
{
FAggregatorModChannel* FoundChannel = ModChannelsMap.Find(Channel);
if (!FoundChannel)
{
// Adding a new channel, need to resort the map to preserve key order for evaluation
ModChannelsMap.Add(Channel);
ModChannelsMap.KeySort(TLess<EGameplayModEvaluationChannel>());
FoundChannel = ModChannelsMap.Find(Channel);
}
check(FoundChannel);
return *FoundChannel;
} Here's a practical example in which a character's move speed is being overridden by a Run ability, and then multiplied afterwards to apply a Slow debuff: Since all modifiers in One last visual representation of how a subset of the modifier operations within each channel are used for the above example, with 350 as an arbitrary base value:
Thanks again for this great resource 🙏🏼 |
This is really useful and great! I was about to start looking into how to modify EvaluateWithBase and really didn't want to dig into engine code to make a simple change. That fixes what I thought was a GAS shortcoming perfectly! |
At the end of the section it's suggested that devs change engine code if they want their modifiers to be multiplied or divided instead of being added before the operation. While researching this issue, I ran into the concept of evaluation channels that were added in 4.14.
All you need to do is add the section below to DefaultGame.ini and then you can keep the original behavior and multiple or divide channels together.
[/Script/GameplayAbilities.AbilitySystemGlobals]
bAllowGameplayModEvaluationChannels=true
GameplayModEvaluationChannelAliases[0]="MyChannel01"
GameplayModEvaluationChannelAliases[1]="MyChannel02"
There are 10 channels defined in GameplayEffectTypes.h (EGameplayModEvaluationChannel), and for each channel you give a name to in the ini, you'll get to select that channel in the gameplay effect.
Then you can do Attribute * MyChannel01Mod * MyChannel02Mod.
Or even Attribute * MyChannel01Mod * (MyChannel02Mod1 + MyChannel02Mod2).
Since a lot of people rely on this documentation, which is great btw, I thought I'd suggest an alternate solution.
The text was updated successfully, but these errors were encountered: