Download

Architectural Questions to Replication (of UObject)

Hi,
I have some architectural questions for my pokemon like game.

https://forums.unrealengine.com/filedata/fetch?filedataid=130343&type=thumb

The above diagram shows my actual
implementation. To have a common vocabulary, I will use some pokemon terms and names. First of all
every kind of monster (Pikachu, Raichu, etc) has it’s own class that is derived from ACharacter. This
is required because a monster is more than a skeletal mesh. It could also have some particles on
it - like the tail flame of Charmander. In fact of this, every time my monster evolves, I have do Destroy the
actual Actor and Spawn a new one of the future monster kind. This requires me to transfer my actual
monster data (attributes, name, learned attacks, etc) from one actor to another. In according to the
article about replicating
subobject (see Link 1), any
UObject that shall be replicated needs to owned by the replicating
actor. This works fine, for completly new spawned monster. I will give the NewObject() call the Actor as Outer.
But what happens, when I have to transfer these data from one monster to another. Will it still be
replicated from the new Actor? If not, is it possible to change it’s owner? Or do I really have to make a deep
copy of my monster data?

https://forums.unrealengine.com/filedata/fetch?filedataid=130345&type=thumb

At the moment my monster data is an UObject implementation, because I will need some
logic despite the raw data: gain experience, level up, check for possible evolutions, evolve, etc. A way to
get around my replication problem would be to have a struct FMonsterData, that contains all it’s data and
have another UObject UMonsterBehavior, that contains all monster logic. The UMonsterBehavior would only be
created on the server and would never be replicated. But this seems a bit like: You haven’t understood
what OOP means. And if I should do so, where would I create my object of UMonsterBehavior? I mean there are
classes, that are owned by the Server like GameState. Something that’s not replicated to my client for owning
the monster behavior.

https://forums.unrealengine.com/filedata/fetch?filedataid=130345&type=thumb

A last variant that I could imagine would be to have all kinds of one evolution chain a single character.
What I mean is, that I could derive from ACharacter as C_Pikachu. This one contains all normal character stuff
and all monster behavior. In addition to it’s derived skeletal mesh Mesh it would contain additonal
skeletal meshes for every evolution stage: for example Pikachu and Raichu. And got everything else required for
the kinds like particle systems as subcomponents of the evolutional skeletal mesh. When it evolves I could swap the
the object reference in the Mesh (derived from ACharacter) variable.

Is there a better way to achieve a clear cut between the actual rules for a monster and it’s data and
the graphical representation of it?

Best regards,
Tarek

Sorry, my images have gone lost. Here are they - I hope so.