Previewing attribute changes using GAS

I have an RPG game and I’m working on the equipment screen for my characters. Currently I use MVVM hooked with GAS attributes and everything works nicely. My equipment classes have a list of gameplay effects that are granted when equipped, and removed when unequipped.

But now I’m trying to show a preview of how attributes will change when selecting a new equipment, similarly to how old RPGs used to do it. What would be the recommended way to do so?

I was thinking of taking a snapshot of all the relevant attributes when the menu is opened, and when selecting a new equipment, quickly grant and remove attributes as the player scrolls through the equipment list, comparing them with the snapshot to show the player if attributes will increase or decrease, but that sounds a bit convoluted and inefficient.

Not to mention that usually it would happen on the client side of things and I know that ASC has some limitations with predicted attribute values

maybe another super basic actor with same attribute set as your player pawn, it’s own ASC. copy over your pawns attributes as needed. Apply/Unapply the GEs to dummy actor for your stats as you cycle thru items. Then destroy after user selects the actual item/effect to apply.

hm… I’m not sure if that would be much more efficient than adding/removing to my character’s own attribute system. But performance aside, the biggest issue I’m facing is trying to do it on the client side (I’m working on a multiplayer RPG). According to the comments I see on the code, prediction might be flaky for attribute values.

it would keep your code it tighter and keep you from changing your player pawn attributes… not really ‘efficient’, although performance wise a blank actor running an ASC would make little difference. You could keep it all local on the client, spawn the actor locally then run the applygameplayeffect functions on the local actor. I haven’t done it in practice, but I don’t see why it wouldn’t work.

GAS has limitations when it comes to what it does on client side vs server side. For a client to be able to apply effects, it needs a valid prediction key. And while I can create a scoped prediction window pretty easily, I’m going through the C++ code and the comments written by the devs themselves say that predicted attribute values might be imprecise (since applying a gameplay effect on the client is merely a prediction and the actual thing is done and corrected by the server). I don’t know however, how imprecise - maybe in my case it’s good enough for what I’m trying to do. I’m planning on doing some tests on it today.

But I guess what I’m looking for is a more straightforward way of evaluating the impacts of a gameplay effect on attributes, without really applying them. I tried following the code that handles effect application, but it’s extremely complex and not so easy to pinpoint the parts of code that really change the attributes themselves

If you spawn a local actor on client, client should have authority and not need the prediction key using ApplyGameplayEffectToTarget.

Regardless, I don’t think you need to worry about the prediction being incorrect unless you’re expecting changes to your attributes while you’re in the menu.