Effects in multiplayer

Hello,

I’m trying to figure out how to handle adding buffs to a character in multiplayer. The two thoughts i have on it right now is that the character has an array of 1) effect objects or 2) an array of effect object references.

If we use #1 then any thing that causes an AOE will create a unique instance of the effect object on every single character and if the effect ends when the source is removed then every one of the characters that was effected needs to remove the instance of that effect. I can imagine this would get costly.

However, if we use #2 then the issue is what happens if the source was a player and that player disconnects? Do all of the reference objects now point to invalid areas in memory? Would we have to remove every effect reference from the source? If this was a buff/debuff i don’t want it to go away when the player logs out.

Any idea’s on this would be helpful,
Thank you!

Save via the SaveGame class on the server side?

The issue was that if player A uses an ability that puts an effect on player B and player B stores the effect as an effect object reference to the effect object created by A, then the reference would point to an invalid point in memory if player A disconnected from the server (logged off or what not) correct? Or would the savegame class keep an instance of the effect object that player A created persistent while player A was offline?

Save the effect class instead of the link and create it again later