channeldorg / channeld-ue-plugin

Enables distributed simulation with Unreal Engine's dedicated servers. 为虚幻引擎专用服务器提供分布式模拟能力的开源插件.
Apache License 2.0
132 stars 38 forks source link

Customizable Channel Data Message #2

Closed indiest closed 1 year ago

indiest commented 1 year ago

What

As of v0.5, the genereated Channel Data Message (named DefaultChannelData in the proto file) contains ALL the replication states that used the project. A typical DefaultChannelData mesage looks like this:

message DefaultChannelData {
    map<uint32, channeldgenpb.BP_TestRepPlayerController_CState> bP_TestRepPlayerController_CStates = 1;
    map<uint32, channeldgenpb.BP_TestRep_CState> bP_TestRep_CStates = 2;
    channeldgenpb.BP_RepGameState_CState bP_RepGameState_CStates = 3;
    map<uint32, channeldgenpb.BP_TestNPC_CState> bP_TestNPC_CStates = 4;
    map<uint32, unrealpb.SceneComponentState> sceneComponentStates = 5;
    map<uint32, unrealpb.CharacterState> characterStates = 6;
    map<uint32, unrealpb.ControllerState> controllerStates = 7;
    unrealpb.GameStateBase gameStateBase = 8;
    map<uint32, unrealpb.PawnState> pawnStates = 9;
    map<uint32, unrealpb.PlayerControllerState> playerControllerStates = 10;
    map<uint32, unrealpb.PlayerState> playerStates = 11;
    map<uint32, unrealpb.ActorComponentState> actorComponentStates = 12;
    map<uint32, unrealpb.ActorState> actorStates = 13;
}

In a project that uses the Global and Spatial channel, the Global channel data should only contains the GameStateBase and derived state; the Spatial channel data should only contains the Character, PlayerController, PlayerState, and other spatial-related states:

message GlobalChannelData {
    channeldgenpb.BP_RepGameState_CState bP_RepGameState_CStates = 1;
    unrealpb.GameStateBase gameStateBase = 2;
}

message SpatialChannelData {
    map<uint32, channeldgenpb.BP_TestRepPlayerController_CState> bP_TestRepPlayerController_CStates = 1;
    map<uint32, channeldgenpb.BP_TestRep_CState> bP_TestRep_CStates = 2;
    map<uint32, channeldgenpb.BP_TestNPC_CState> bP_TestNPC_CStates = 3;
    map<uint32, unrealpb.SceneComponentState> sceneComponentStates = 4;
    map<uint32, unrealpb.CharacterState> characterStates = 5;
    map<uint32, unrealpb.ControllerState> controllerStates = 6;
    map<uint32, unrealpb.PawnState> pawnStates = 7;
    map<uint32, unrealpb.PlayerControllerState> playerControllerStates = 8;
    map<uint32, unrealpb.PlayerState> playerStates = 9;
    map<uint32, unrealpb.ActorComponentState> actorComponentStates = 10;
    map<uint32, unrealpb.ActorState> actorStates = 11;
}

Why do we need this feature

How to use this feature

An In-editor UI should be provided to specified which state should be generated for which channel type's data message(s).