Skip to content

0.5.0-preview.5

Pre-release
Pre-release

Choose a tag to compare

@marwie marwie released this 29 Oct 23:10

[0.5.0] - 2020-10-01

New features

  • Added RpcSystem.DynamicAssemblyList which can be used to delay the checksums for RPCs and ghost components when the set of assemblies are different on the client and server.
  • Added to RPC and Command the possiblity to send Entity reference from both client and server.

Changes

  • Change the system ordering to be compatible with latest physics. NetworkTimeSystem has moved to ClientInitializationSystemGroup. The SimulationSystemGroup runs GhostSpawnSystemGroup (client), GhostReceiveSystemGroup and GhostSimulationSystemGroup before FixedStepSimulationSystemGroup where physics is running. RpcCommandRequestSystemGroup, RpcSystem and GhostSendSystem (server) is running at the end of the frame, after all simulation code. Other systems has been moved into one of the groups.
  • Created a new GhostInputSystemGroup where systems adding inputs to the input buffer should run.

Fixes

Upgrade guide

  • The systems adding input to the ICommandData buffer needs to be moved to GhostInputSystemGroup

[0.4.0] - 2020-09-10

New features

  • Code gen support for ICommandData, serialization for command data can now be generated instead of hand-written. You can opt out of code generation by adding [NetCodeDisableCommandCodeGen].
  • NetCodeConversionSettings has a new Client And Server mode, which makes it possible to build a single standalong build supporting both client and server.
  • There is a new static method to generate predicted spawn version of a prefab, GhostCollectionSystem.CreatePredictedSpawnPrefab.

Changes

  • When not using code-gen for rpcs or commands the systems for registering them (the ones extending RpcCommandRequestSystem<TActionSerializer, TActionRequest>, CommandSendSystem<TCommandDataSerializer, TCommandData> and CommandReceiveSystem<TCommandDataSerializer, TCommandData>) need some more code to setup the jobs.
  • The ICommandData interface no longer takes an additional generic type.
  • Added a CommandSendSystemGroup and a CommandReceiveSystemGroup which can be used for dependencies when generating code for ICommandData.
  • Moved the GameObjects used for authoring to a separate assembly.
  • Fixed tickrate on the client is no longer supported. This also means that the render interpolation has been removed.
  • Using multiple rendering clients in the editor is no longer supported, thin clients are still supported.
  • The GhostPrefabCollectionComponent now only contains a single prefab list, and the GhostPrefabBuffer for it is attached to the same entity.

Deprecated

  • Deprecated ConvertToClientServerEntity, please use the sub-scene conversion workflow instead.

Fixes

  • Fixed a compile error in the generated code for components containing multiple ghosted Entity references.
  • Fixed a bug where predicted spawn ghosts were not destroyed on mis-prediction.
  • Fixed a bug where data for child entities on predicted ghosts could be corrupted.

Upgrade guide

  • The predicted spawn code must switch to using the new GhostCollectionSystem.CreatePredictedSpawnPrefab utility method since there is only a single prefab on the client and it requires some patching before it can be used.
  • When using the GhostPrefabCollectionComponent to find a prefab to find a ghost prefab on the server you must change the code to read the GhostPrefabBuffer from the same entity as GhostPrefabCollectionComponent.
  • If you are using fixed tickrate mode on the client you need to remove the creation of the FixedClientTickRate singleton and remove the CurrentSimulatedPosition and CurrentSimulatedRotation if using them.
  • If you are using "Num Clients" in the PlayMode tools you need to move to using "Num Thin Clients" instead.
  • RPCs not using code-gen needs to add more code to the RpcCommandRequestSystem. The new implementation should look like this:
class MyRequestRpcCommandRequestSystem : RpcCommandRequestSystem<MyRequestSerializer, MyRequest>
{
    [BurstCompile]
    protected struct SendRpc : IJobEntityBatch
    {
        public SendRpcData data;
        public void Execute(ArchetypeChunk chunk, int orderIndex)
        {
            data.Execute(chunk, orderIndex);
        }
    }
    protected override void OnUpdate()
    {
        var sendJob = new SendRpc{data = InitJobData()};
        ScheduleJobData(sendJob);
    }
}
  • The Tick property in ICommandData now requires both a getter and a setter.
  • ICommandData structs no longer need serialization or implementaions of CommandSendSystem and CommandReceiveSystem if you are using code-gen, and the interface changed from ICommandData<T> to ICommandData.
  • When manually writing serialization code for ICommandData you need to move the serialization code to a struct implementing ICommandDataSerialize<T>, and the CommandSendSystem and CommandReceiveSystem implementations need code to schedule the jobs like this:
public class MyCommandSendCommandSystem : CommandSendSystem<MyCommandSerializer, MyCommand>
{
    [BurstCompile]
    struct SendJob : IJobEntityBatch
    {
        public SendJobData data;
        public void Execute(ArchetypeChunk chunk, int orderIndex)
        {
            data.Execute(chunk, orderIndex);
        }
    }
    protected override void OnUpdate()
    {
        var sendJob = new SendJob{data = InitJobData()};
        ScheduleJobData(sendJob);
    }
}
public class MyCommandReceiveCommandSystem : CommandReceiveSystem<MyCommandSerializer, MyCommand>
{
    [BurstCompile]
    struct ReceiveJob : IJobEntityBatch
    {
        public ReceiveJobData data;
        public void Execute(ArchetypeChunk chunk, int orderIndex)
        {
            data.Execute(chunk, orderIndex);
        }
    }
    protected override void OnUpdate()
    {
        var recvJob = new ReceiveJob{data = InitJobData()};
        ScheduleJobData(recvJob);
    }
}