From 6ab9238c28374c867099c65d3cc064549d6bebda Mon Sep 17 00:00:00 2001 From: Laszlo Paillat Date: Fri, 5 Apr 2019 13:09:27 +0200 Subject: [PATCH] release 0.10.0 --- README.md | 36 ++++++++++++++++++++- documentation/RELEASENOTE.md | 13 ++++++++ source/DefaultEcs/DefaultEcs.Package.csproj | 3 +- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1799af5b..de29c7a0 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ![DefaultEcs](https://github.com/Doraku/DefaultEcs/raw/master/image/DefaultEcsLogo.png) DefaultEcs is an Entity Component System framework which aims to be accessible with little constraints while retaining as much performance as possible for game development. -[![NuGet](https://img.shields.io/badge/nuget-v0.9.2-brightgreen.svg)](https://www.nuget.org/packages/DefaultEcs) +[![NuGet](https://img.shields.io/badge/nuget-v0.10.0-brightgreen.svg)](https://www.nuget.org/packages/DefaultEcs) - [Requirement](#Requirement) - [Release note](./documentation/RELEASENOTE.md 'Release note') @@ -18,6 +18,7 @@ DefaultEcs is an Entity Component System framework which aims to be accessible w - [AEntitySystem](#Overview_System_AEntitySystem) - [AComponentSystem](#Overview_System_AComponentSystem) - [SystemRunner](#Overview_System_SystemRunner) + - [Command](#Overview_Command) - [Message](#Overview_Message) - [Serialization](#Overview_Serialization) - [TextSerializer](#Overview_Serialization_TextSerializer) @@ -306,6 +307,39 @@ It is safe to run a system with multithreading when: * for an AComponentSystem * each component can be safely updated separately with no dependency to an other component + +## Command +Since it is not possible to make structural modification on an Entity in a multithreading context, the EntityCommandRecorder type is provided to adress this short-coming. +It is possible de record command on entities in a thread-safe way to later execute them when those structural modifications are safe to do. +```C# +// This creates an expandable recorder with a default capacity of 1Ko +EntityCommandRecorder recorder = new EntityCommandRecorder(); + +// This creates a fixed capacity recorder of 512Ko +EntityCommandRecorder recorder = new EntityCommandRecorder(512); + +// This creates an expandable recorder with a default capacity of .5Ko which can have a maximum capacity of 2Ko +EntityCommandRecorder recorder = new EntityCommandRecorder(512, 2048); +``` + +Note that a fixed capacity EntityCommandRecorder (or one which has expanded to its max capacity) has better performance. +When needed, an expandable EntityCommandRecorder will double its capacity so it is prefered to use a power of 2 as default capacity. + +```C# +// Create a new Entity defered and give an EntityRecord to record commands on it +EntityRecord newRecord = recorder.CreateEntity(); + +// Register an Entity and give an EntityRecord to record commands on it +EntityRecord record = recorder.Record(entity); + +// EntityRecord has the same API as Entity so all action expected are available to record as command this way +newRecord.Set(true); +record.SetAsParentOf(newRecord); + +// To execute all recorded commands +recorder.Execute(world); +``` + ## Message It is possible to send and receive message transiting in a World. diff --git a/documentation/RELEASENOTE.md b/documentation/RELEASENOTE.md index 3f99b2e7..2d0328f7 100644 --- a/documentation/RELEASENOTE.md +++ b/documentation/RELEASENOTE.md @@ -1,3 +1,16 @@ +## DefaultEcs 0.9.2 +fixed double Dispose in AResourceManager +fixed reference count in AResourceManager when World is disposed +fixed Entity.CopyTo to correctly copy enabled/disabled state +fixed non unmanaged struct serialization in BinarySerializer + +added IEntitySetObserver and basic implementation EntitySetObserverEvents to get add/remove operations on EntitySet +added EntityCommandRecorder to defer structural entity changes + +breaking change: SubscribeAction renamed ActionIn + +[nuget package](https://www.nuget.org/packages/DefaultEcs/0.10.0) + ## DefaultEcs 0.9.2 added IsAlive property on Entity added With(Type[]) and Without(Type[]) on EntitySetBuilder diff --git a/source/DefaultEcs/DefaultEcs.Package.csproj b/source/DefaultEcs/DefaultEcs.Package.csproj index 53b432ba..73285107 100644 --- a/source/DefaultEcs/DefaultEcs.Package.csproj +++ b/source/DefaultEcs/DefaultEcs.Package.csproj @@ -19,11 +19,12 @@ git gamedev game-development game-engine ecs entity-component-system - 0.10.0-alpha1 + 0.10.0 fixed double Dispose in AResourceManager fixed reference count in AResourceManager when World is disposed fixed Entity.CopyTo to correctly copy enabled/disabled state +fixed non unmanaged struct serialization in BinarySerializer added IEntitySetObserver and basic implementation EntitySetObserverEvents to get add/remove operations on EntitySet added EntityCommandRecorder to defer structural entity changes