0.5.0-preview.5
Pre-release
Pre-release
[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.
NetworkTimeSystemhas moved toClientInitializationSystemGroup. The SimulationSystemGroup runsGhostSpawnSystemGroup(client),GhostReceiveSystemGroupandGhostSimulationSystemGroupbeforeFixedStepSimulationSystemGroupwhere physics is running.RpcCommandRequestSystemGroup,RpcSystemandGhostSendSystem(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
GhostInputSystemGroupwhere systems adding inputs to the input buffer should run.
Fixes
Upgrade guide
- The systems adding input to the
ICommandDatabuffer needs to be moved toGhostInputSystemGroup
[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]. NetCodeConversionSettingshas 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>andCommandReceiveSystem<TCommandDataSerializer, TCommandData>) need some more code to setup the jobs. - The
ICommandDatainterface no longer takes an additional generic type. - Added a
CommandSendSystemGroupand aCommandReceiveSystemGroupwhich can be used for dependencies when generating code forICommandData. - 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
GhostPrefabCollectionComponentnow only contains a single prefab list, and theGhostPrefabBufferfor 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.CreatePredictedSpawnPrefabutility method since there is only a single prefab on the client and it requires some patching before it can be used. - When using the
GhostPrefabCollectionComponentto find a prefab to find a ghost prefab on the server you must change the code to read theGhostPrefabBufferfrom the same entity asGhostPrefabCollectionComponent. - If you are using fixed tickrate mode on the client you need to remove the creation of the
FixedClientTickRatesingleton and remove theCurrentSimulatedPositionandCurrentSimulatedRotationif 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
Tickproperty inICommandDatanow requires both a getter and a setter. - ICommandData structs no longer need serialization or implementaions of
CommandSendSystemandCommandReceiveSystemif you are using code-gen, and the interface changed fromICommandData<T>toICommandData. - When manually writing serialization code for
ICommandDatayou need to move the serialization code to a struct implementingICommandDataSerialize<T>, and theCommandSendSystemandCommandReceiveSystemimplementations 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);
}
}