Get ReplicaChunk on proxy system component

Hello,

I’am stuck at my system component. I want to implement some Replica for my system component, but don’t know how the proxy get the ReplicaChunk. For Components the function “SetNetworkBinding” is called if client is connected. Unfortunately it is not called (in my case) on my system component.
How could it be done or how I can access the proxy ReplicaChunk?

Joerg

Wow, 2 days and nobody can say anything about GridMate Replica.
So I got it to work now. But it confuses me at first, because the proxy calls “GetNetworkBinding” before calling “SetNetworkBinding”.

I would think that you would have better luck asking over on lumber yards discord. Seems like there’s more activity there than on this form.

Networking features are not supported in system components, only game components can be network replicated.

Hi, for what reason is the function AddMaster there? It gets called behind the scene on game components.

It is part of internal networking logic. Do you have a specific question on it? Are you modifying our internal networking library?

No, I don’t want to modify the engine at all. If I do that, I have to do it again on next update. I want to learn how to use Lumberyard and at the moment I’ll try to check the best way to do multiplayer.

On my first tries, I made it like it is described in the documentation. Binding a Replica to the Session Replica Manager. But this is not necessary. The documentation should be updated.

Sorry you are having troubles with the documentation. Can you send documentation feedback on the specific page(s)?

At the bottom of every page should be a " [Provide feedback ]" link where you can provide feedback. Our docs team should then pick up the changes.

Thanks

I have send feedback to the page mentioned.

@MrOleksandr

Maybe you could clear some things specific to replicas.

  1. On Host, the engine calls the function “GetNetworkBinding()” of the component where the replica chunk is created and returned. So, the binding of the replica chunk to the replica and then the attaching of the replica to the session replica manager is behind the scene. How should it be done to attach additional replica chunks to the replica. I aasume that it should be done after this function is called and access the replica or the session replica manger tgrough the replica chunk you have created.

  2. Does the proxy creates additional replica chunks automatically? I think it must be the case, because I don’t find how it should be done.

  3. It would be nice if it will be possible to create replicas with system components. Is there a chance that this will be coming?

Thank you,
Joerg

  1. Yes, GetNetworkBinding is called on the server. SetNetworkBinding is called on clients.

I don’t understand what you mean by attaching additional replicas chunks to the replica?
This is done for you when you mark your components as networkable and provide GetNetworkBinding/SetNetworkBinding implementation.

  1. What do you mean by additional chunks? On client the copies of your network entities will be created for you and they will be given chunks to mimic the server.

  2. You can re-route your logic from system component to the components on the level instead. System components are very special components and applying network replication to them is too design prone. I’m not aware of the future plans, though.

What are the challenges you are seeing?

Replica Chunks

Every replica holds a collection of user-defined ReplicaChunk objects that are synchronized with all the peers in the current session. A replica chunk is a container for user-defined DataSet objects and Remote Procedure Calls (RPCs). Any change to a DataSet object or a call to an RPC causes the replica to synchronize its state across the session.

Limitations

Replica chunks have the following limitations:

  • Each replica can contain only 32 chunks.
  • Chunks can be attached or detached only when a replica is not bound to a replica manager.

I want to know how to attach up to 32 replica chunks to a replica. I don’t get the replica in the GetNetworkBinding function. I have to create the chunk in this function and return the created chunk. So the attaching is executed in the engine. But the documentation say I can attach more chunks to one replica. How is this done?

Why the documentation explaines how to add additional replicas to the replica Manager if it only could be used on game components that gets automatically bound.

Is there a possible design problem with replicas? If I attach a replica to the replica manager, I will get a replica id, with this id i can get my replica from the replica manager. With the current system I get no replica id because I never see the replica itself. I create a replica chunk in GetNetworkBinding and return this chunk to the calling function. In SetNetworkBinding I get a chunk as parameter, never see the replica.

One thing that is not mentioned in the documentation. If the proxy connects it calls at first GetNetworkBinding. Then, afetr this call it calls SetNetworkBinding. This makes no sense, because I create and set up the replica chunk in GetNetworkBinding.

If you mark your components as NetBindable and attach 32 such components to a game entity, then your replica will have 32 chunks.

Are you looking to create a custom replica without any connection to components? Or are you looking to synchronize game components?

If you are not looking to synchronize game components then you can indeed build replicas yourself and then you don’t need to worry about SetNeworkBinding/GetNetworkBinding.

Are you saying you are having issues building replicas with your chunks? Are you using Replica::AttachReplicaChunk? If you search the code base you will find unittests that show you how to do that.

See dev\Code\Framework\GridMate\Tests\ReplicaSmall.cpp