Skip to content

Commit

Permalink
release 0.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Doraku committed Feb 23, 2020
1 parent 4f8a453 commit 5be82c2
Show file tree
Hide file tree
Showing 177 changed files with 1,867 additions and 735 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ This is the current strategy used to version DefaultEcs: v0.major.minor
<a name='Overview_World'></a>
## World
The World class act as a manager to create entity, get a selection of specific entities, get a family of component or publish and subscribe to messages that can be used to communicate in a decoupled way between the different elements.
Multiple World objects can be used in parallel, each instance being thread-safe from one an other but operations performed on a single instance and all of its created items should be thought as non thread-safe but depending on what is done, it is still possible to process operations concurrently to optimise performance.
Multiple World objects can be used in parallel, each instance being thread-safe from one another but operations performed on a single instance and all of its created items should be thought as non thread-safe. Depending on what is done, it is still possible to process operations concurrently to optimise performance.

Worlds are created as such
```csharp
Expand Down
44 changes: 44 additions & 0 deletions documentation/RELEASENOTE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,47 @@
## DefaultEcs 0.14.0
breaking change:
removed World.MaxEntityCount, obsolete
removed World.SetMaximumComponentCount, obsolete
removed World.GetMaximumComponentCount, obsolete
removed World.GetAllComponents, obsolete
removed World.GetAllEntities, obsolete
removed World.EntityDisposed
removed EntitySet.EntityAdded
removed EntitySet.EntityRemoved
removed AEntityBufferedSystem.EntityAdded
removed AEntityBufferedSystem.EntityRemoved
removed AEntitySystem.EntityAdded
removed AEntitySystem.EntityRemoved
renamed EntitySetBuilder to EntityRuleBuilder
renamed EntitySetBuilderExtension to EntityRuleBuilderExtension
renamed ActionIn to MessageHandler

fixed BinarySerializer and TextSerializer serialization of multi generic types
fixed World multi Dispose

added World.Optimize to sort entities and their components so accessing them through EntitySet always move forward in memory
added World.SubscribeEntityCreated to be called back when an entity is created
added World.SubscribeEntityEnabled to be called back when an entity is enabled
added World.SubscribeEntityDisabled to be called back when an entity is disabled
added World.SubscribeEntityDisposed to be called back when an entity is disposed
added World.SubscribeComponentAdded to be called back when a component is added on an entity
added World.SubscribeComponentChanged to be called back when a component is changed on an entity
added World.SubscribeComponentRemoved to be called back when a component is removed from an entity
added World.SubscribeComponentEnabled to be called back when a component is enabled on an entity
added World.SubscribeComponentDisabled to be called back when a component is disabled on an entity
added EntityRuleBuilder.With with a Predicate parameter
added EntityRuleBuilder.AsPredicate to get a predicate to validate the composition of an entity
added EntityRuleBuilder.AsMap to get a mapping of entities by their component value
added EntityRuleBuilder.AsMultiMap to get a mapping of entities by their component value
added Entity.NotifyChanged to defer the notification that a component has changed
added EntityRecord.NotifyChanged to defer the notification that a component has changed
added AoTHelper to help the generic code generation for AoT compilation
added EntityMap to have a one for one mapping between a component value and an entity
added EntitiesMap to have a one to many mapping between a component value and entities
added WithPredicateAttribute attribute to decorate ComponentPredicate methods in AEntitySystem and AEntityBufferedSystem to automatically build the underlying EntitySet with the predicate

[nuget package](https://www.nuget.org/packages/DefaultEcs/0.14.0)

## DefaultEcs 0.13.1
added minEntityCountByRunnerIndex parameter to AEntitySystem constructors
added minComponentCountByRunnerIndex parameter to AComponentSystem constructor
Expand Down
17 changes: 0 additions & 17 deletions documentation/api/DefaultEcs-ActionIn-T-(T).md

This file was deleted.

12 changes: 12 additions & 0 deletions documentation/api/DefaultEcs-AoTHelper-RegisterComponent-T-().md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#### [DefaultEcs](./index.md 'index')
### [DefaultEcs](./DefaultEcs.md 'DefaultEcs').[AoTHelper](./DefaultEcs-AoTHelper.md 'DefaultEcs.AoTHelper')
## AoTHelper.RegisterComponent&lt;T&gt;() Method
Registers the type [T](#DefaultEcs-AoTHelper-RegisterComponent-T-()-T 'DefaultEcs.AoTHelper.RegisterComponent&lt;T&gt;().T') so it can freely be used in [ComponentAttribute](./DefaultEcs-System-ComponentAttribute.md 'DefaultEcs.System.ComponentAttribute').
```csharp
public static void RegisterComponent<T>();
```
#### Type parameters
<a name='DefaultEcs-AoTHelper-RegisterComponent-T-()-T'></a>
`T`
The type of component.

12 changes: 12 additions & 0 deletions documentation/api/DefaultEcs-AoTHelper-RegisterMessage-T-().md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#### [DefaultEcs](./index.md 'index')
### [DefaultEcs](./DefaultEcs.md 'DefaultEcs').[AoTHelper](./DefaultEcs-AoTHelper.md 'DefaultEcs.AoTHelper')
## AoTHelper.RegisterMessage&lt;T&gt;() Method
Registers the type [T](#DefaultEcs-AoTHelper-RegisterMessage-T-()-T 'DefaultEcs.AoTHelper.RegisterMessage&lt;T&gt;().T') so [SubscribeAttribute](./DefaultEcs-SubscribeAttribute.md 'DefaultEcs.SubscribeAttribute') can freely be used on method like the delegate [MessageHandler&lt;T&gt;(T)](./DefaultEcs-MessageHandler-T-(T).md 'DefaultEcs.MessageHandler&lt;T&gt;(T)') to automatically subscribe when using [IPublisherExtension](./DefaultEcs-IPublisherExtension.md 'DefaultEcs.IPublisherExtension') on a [World](./DefaultEcs-World.md 'DefaultEcs.World') instance.
```csharp
public static void RegisterMessage<T>();
```
#### Type parameters
<a name='DefaultEcs-AoTHelper-RegisterMessage-T-()-T'></a>
`T`
The type of message.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#### [DefaultEcs](./index.md 'index')
### [DefaultEcs](./DefaultEcs.md 'DefaultEcs').[AoTHelper](./DefaultEcs-AoTHelper.md 'DefaultEcs.AoTHelper')
## AoTHelper.RegisterUnmanagedComponent&lt;T&gt;() Method
Registers the unmanaged type [T](#DefaultEcs-AoTHelper-RegisterUnmanagedComponent-T-()-T 'DefaultEcs.AoTHelper.RegisterUnmanagedComponent&lt;T&gt;().T') so it can freely be used in [ComponentAttribute](./DefaultEcs-System-ComponentAttribute.md 'DefaultEcs.System.ComponentAttribute') and by [Set&lt;T&gt;(T)](./DefaultEcs-Command-EntityRecord-Set-T-(T).md 'DefaultEcs.Command.EntityRecord.Set&lt;T&gt;(T)').
```csharp
public static void RegisterUnmanagedComponent<T>();
```
#### Type parameters
<a name='DefaultEcs-AoTHelper-RegisterUnmanagedComponent-T-()-T'></a>
`T`
The type of component.

12 changes: 12 additions & 0 deletions documentation/api/DefaultEcs-AoTHelper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#### [DefaultEcs](./index.md 'index')
### [DefaultEcs](./DefaultEcs.md 'DefaultEcs')
## AoTHelper Class
Provides a set of methods to help the generation of generic code for AoT compilation.
```csharp
public static class AoTHelper
```
Inheritance [System.Object](https://docs.microsoft.com/en-us/dotnet/api/System.Object 'System.Object') &gt; [AoTHelper](./DefaultEcs-AoTHelper.md 'DefaultEcs.AoTHelper')
### Methods
- [RegisterComponent&lt;T&gt;()](./DefaultEcs-AoTHelper-RegisterComponent-T-().md 'DefaultEcs.AoTHelper.RegisterComponent&lt;T&gt;()')
- [RegisterMessage&lt;T&gt;()](./DefaultEcs-AoTHelper-RegisterMessage-T-().md 'DefaultEcs.AoTHelper.RegisterMessage&lt;T&gt;()')
- [RegisterUnmanagedComponent&lt;T&gt;()](./DefaultEcs-AoTHelper-RegisterUnmanagedComponent-T-().md 'DefaultEcs.AoTHelper.RegisterUnmanagedComponent&lt;T&gt;()')
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#### [DefaultEcs](./index.md 'index')
### [DefaultEcs.Command](./DefaultEcs-Command.md 'DefaultEcs.Command').[EntityRecord](./DefaultEcs-Command-EntityRecord.md 'DefaultEcs.Command.EntityRecord')
## EntityRecord.NotifyChanged&lt;T&gt;() Method
Notifies the value of the component of type [T](#DefaultEcs-Command-EntityRecord-NotifyChanged-T-()-T 'DefaultEcs.Command.EntityRecord.NotifyChanged&lt;T&gt;().T') has changed on the corresponding [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity').
This command takes 9 bytes.
```csharp
public void NotifyChanged<T>();
```
#### Type parameters
<a name='DefaultEcs-Command-EntityRecord-NotifyChanged-T-()-T'></a>
`T`
The type of the component.

#### Exceptions
[System.InvalidOperationException](https://docs.microsoft.com/en-us/dotnet/api/System.InvalidOperationException 'System.InvalidOperationException')
Command buffer is full.
1 change: 1 addition & 0 deletions documentation/api/DefaultEcs-Command-EntityRecord.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public readonly ref struct EntityRecord
- [Dispose()](./DefaultEcs-Command-EntityRecord-Dispose().md 'DefaultEcs.Command.EntityRecord.Dispose()')
- [Enable()](./DefaultEcs-Command-EntityRecord-Enable().md 'DefaultEcs.Command.EntityRecord.Enable()')
- [Enable&lt;T&gt;()](./DefaultEcs-Command-EntityRecord-Enable-T-().md 'DefaultEcs.Command.EntityRecord.Enable&lt;T&gt;()')
- [NotifyChanged&lt;T&gt;()](./DefaultEcs-Command-EntityRecord-NotifyChanged-T-().md 'DefaultEcs.Command.EntityRecord.NotifyChanged&lt;T&gt;()')
- [Remove&lt;T&gt;()](./DefaultEcs-Command-EntityRecord-Remove-T-().md 'DefaultEcs.Command.EntityRecord.Remove&lt;T&gt;()')
- [RemoveFromChildrenOf(DefaultEcs.Command.EntityRecord)](./DefaultEcs-Command-EntityRecord-RemoveFromChildrenOf(DefaultEcs-Command-EntityRecord).md 'DefaultEcs.Command.EntityRecord.RemoveFromChildrenOf(DefaultEcs.Command.EntityRecord)')
- [RemoveFromParentsOf(DefaultEcs.Command.EntityRecord)](./DefaultEcs-Command-EntityRecord-RemoveFromParentsOf(DefaultEcs-Command-EntityRecord).md 'DefaultEcs.Command.EntityRecord.RemoveFromParentsOf(DefaultEcs.Command.EntityRecord)')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#### [DefaultEcs](./index.md 'index')
### [DefaultEcs](./DefaultEcs.md 'DefaultEcs')
## ComponentAddedHandler&lt;T&gt;(DefaultEcs.Entity, T) Delegate
Represents the method that will called when a component of type [T](#DefaultEcs-ComponentAddedHandler-T-(DefaultEcs-Entity_T)-T 'DefaultEcs.ComponentAddedHandler&lt;T&gt;(DefaultEcs.Entity, T).T') is added on an [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity').
```csharp
public delegate void ComponentAddedHandler<T>(in DefaultEcs.Entity entity, in T value);
```
#### Type parameters
<a name='DefaultEcs-ComponentAddedHandler-T-(DefaultEcs-Entity_T)-T'></a>
`T`
The type of the component added.

#### Parameters
<a name='DefaultEcs-ComponentAddedHandler-T-(DefaultEcs-Entity_T)-entity'></a>
`entity` [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity')
The [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity') on which the component was added.

<a name='DefaultEcs-ComponentAddedHandler-T-(DefaultEcs-Entity_T)-value'></a>
`value` [T](#DefaultEcs-ComponentAddedHandler-T-(DefaultEcs-Entity_T)-T 'DefaultEcs.ComponentAddedHandler&lt;T&gt;(DefaultEcs.Entity, T).T')
The value of the component.

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#### [DefaultEcs](./index.md 'index')
### [DefaultEcs](./DefaultEcs.md 'DefaultEcs')
## ComponentChangedHandler&lt;T&gt;(DefaultEcs.Entity, T, T) Delegate
Represents the method that will called when a component of type [T](#DefaultEcs-ComponentChangedHandler-T-(DefaultEcs-Entity_T_T)-T 'DefaultEcs.ComponentChangedHandler&lt;T&gt;(DefaultEcs.Entity, T, T).T') is removed from an [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity').
```csharp
public delegate void ComponentChangedHandler<T>(in DefaultEcs.Entity entity, in T oldValue, in T newValue);
```
#### Type parameters
<a name='DefaultEcs-ComponentChangedHandler-T-(DefaultEcs-Entity_T_T)-T'></a>
`T`
The type of the component removed.

#### Parameters
<a name='DefaultEcs-ComponentChangedHandler-T-(DefaultEcs-Entity_T_T)-entity'></a>
`entity` [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity')
The [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity') on which the component was removed.

<a name='DefaultEcs-ComponentChangedHandler-T-(DefaultEcs-Entity_T_T)-oldValue'></a>
`oldValue` [T](#DefaultEcs-ComponentChangedHandler-T-(DefaultEcs-Entity_T_T)-T 'DefaultEcs.ComponentChangedHandler&lt;T&gt;(DefaultEcs.Entity, T, T).T')
The previous value of the component.

<a name='DefaultEcs-ComponentChangedHandler-T-(DefaultEcs-Entity_T_T)-newValue'></a>
`newValue` [T](#DefaultEcs-ComponentChangedHandler-T-(DefaultEcs-Entity_T_T)-T 'DefaultEcs.ComponentChangedHandler&lt;T&gt;(DefaultEcs.Entity, T, T).T')
The new value of the component.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#### [DefaultEcs](./index.md 'index')
### [DefaultEcs](./DefaultEcs.md 'DefaultEcs')
## ComponentDisabledHandler&lt;T&gt;(DefaultEcs.Entity, T) Delegate
Represents the method that will called when a component of type [T](#DefaultEcs-ComponentDisabledHandler-T-(DefaultEcs-Entity_T)-T 'DefaultEcs.ComponentDisabledHandler&lt;T&gt;(DefaultEcs.Entity, T).T') is disabled on an [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity').
```csharp
public delegate void ComponentDisabledHandler<T>(in DefaultEcs.Entity entity, in T value);
```
#### Type parameters
<a name='DefaultEcs-ComponentDisabledHandler-T-(DefaultEcs-Entity_T)-T'></a>
`T`
The type of the component disabled.

#### Parameters
<a name='DefaultEcs-ComponentDisabledHandler-T-(DefaultEcs-Entity_T)-entity'></a>
`entity` [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity')
The [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity') on which the component was disabled.

<a name='DefaultEcs-ComponentDisabledHandler-T-(DefaultEcs-Entity_T)-value'></a>
`value` [T](#DefaultEcs-ComponentDisabledHandler-T-(DefaultEcs-Entity_T)-T 'DefaultEcs.ComponentDisabledHandler&lt;T&gt;(DefaultEcs.Entity, T).T')
The value of the component.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#### [DefaultEcs](./index.md 'index')
### [DefaultEcs](./DefaultEcs.md 'DefaultEcs')
## ComponentEnabledHandler&lt;T&gt;(DefaultEcs.Entity, T) Delegate
Represents the method that will called when a component of type [T](#DefaultEcs-ComponentEnabledHandler-T-(DefaultEcs-Entity_T)-T 'DefaultEcs.ComponentEnabledHandler&lt;T&gt;(DefaultEcs.Entity, T).T') is enabled on an [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity').
```csharp
public delegate void ComponentEnabledHandler<T>(in DefaultEcs.Entity entity, in T value);
```
#### Type parameters
<a name='DefaultEcs-ComponentEnabledHandler-T-(DefaultEcs-Entity_T)-T'></a>
`T`
The type of the component enabled.

#### Parameters
<a name='DefaultEcs-ComponentEnabledHandler-T-(DefaultEcs-Entity_T)-entity'></a>
`entity` [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity')
The [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity') on which the component was enabled.

<a name='DefaultEcs-ComponentEnabledHandler-T-(DefaultEcs-Entity_T)-value'></a>
`value` [T](#DefaultEcs-ComponentEnabledHandler-T-(DefaultEcs-Entity_T)-T 'DefaultEcs.ComponentEnabledHandler&lt;T&gt;(DefaultEcs.Entity, T).T')
The value of the component.

20 changes: 20 additions & 0 deletions documentation/api/DefaultEcs-ComponentPredicate-T-(T).md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#### [DefaultEcs](./index.md 'index')
### [DefaultEcs](./DefaultEcs.md 'DefaultEcs')
## ComponentPredicate&lt;T&gt;(T) Delegate
Represents the method that defines a set of criteria and determines whether the specified component meets those criteria.
```csharp
public delegate bool ComponentPredicate<T>(in T value);
```
#### Type parameters
<a name='DefaultEcs-ComponentPredicate-T-(T)-T'></a>
`T`
The type of the component to compare.

#### Parameters
<a name='DefaultEcs-ComponentPredicate-T-(T)-value'></a>
`value` [T](#DefaultEcs-ComponentPredicate-T-(T)-T 'DefaultEcs.ComponentPredicate&lt;T&gt;(T).T')
The component value.

#### Returns
[System.Boolean](https://docs.microsoft.com/en-us/dotnet/api/System.Boolean 'System.Boolean')
true if the component meets the criteria; otherwise, false.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#### [DefaultEcs](./index.md 'index')
### [DefaultEcs](./DefaultEcs.md 'DefaultEcs')
## ComponentRemovedHandler&lt;T&gt;(DefaultEcs.Entity, T) Delegate
Represents the method that will called when a component of type [T](#DefaultEcs-ComponentRemovedHandler-T-(DefaultEcs-Entity_T)-T 'DefaultEcs.ComponentRemovedHandler&lt;T&gt;(DefaultEcs.Entity, T).T') is removed from an [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity').
```csharp
public delegate void ComponentRemovedHandler<T>(in DefaultEcs.Entity entity, in T value);
```
#### Type parameters
<a name='DefaultEcs-ComponentRemovedHandler-T-(DefaultEcs-Entity_T)-T'></a>
`T`
The type of the component removed.

#### Parameters
<a name='DefaultEcs-ComponentRemovedHandler-T-(DefaultEcs-Entity_T)-entity'></a>
`entity` [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity')
The [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity') on which the component was removed.

<a name='DefaultEcs-ComponentRemovedHandler-T-(DefaultEcs-Entity_T)-value'></a>
`value` [T](#DefaultEcs-ComponentRemovedHandler-T-(DefaultEcs-Entity_T)-T 'DefaultEcs.ComponentRemovedHandler&lt;T&gt;(DefaultEcs.Entity, T).T')
The value of the component.

9 changes: 9 additions & 0 deletions documentation/api/DefaultEcs-EntitiesMap-TKey--Complete().md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#### [DefaultEcs](./index.md 'index')
### [DefaultEcs](./DefaultEcs.md 'DefaultEcs').[EntitiesMap&lt;TKey&gt;](./DefaultEcs-EntitiesMap-TKey-.md 'DefaultEcs.EntitiesMap&lt;TKey&gt;')
## EntitiesMap&lt;TKey&gt;.Complete() Method
Clears current instance of its entities if it was created with some reactive filter ([WhenAdded&lt;T&gt;()](./DefaultEcs-EntityRuleBuilder-WhenAdded-T-().md 'DefaultEcs.EntityRuleBuilder.WhenAdded&lt;T&gt;()'), [WhenChanged&lt;T&gt;()](./DefaultEcs-EntityRuleBuilder-WhenChanged-T-().md 'DefaultEcs.EntityRuleBuilder.WhenChanged&lt;T&gt;()') or [WhenRemoved&lt;T&gt;()](./DefaultEcs-EntityRuleBuilder-WhenRemoved-T-().md 'DefaultEcs.EntityRuleBuilder.WhenRemoved&lt;T&gt;()')).
Does nothing if it was created from a static filter.
This method need to be called after current instance content has been processed in a update cycle.
```csharp
public void Complete();
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#### [DefaultEcs](./index.md 'index')
### [DefaultEcs](./DefaultEcs.md 'DefaultEcs').[EntitiesMap&lt;TKey&gt;](./DefaultEcs-EntitiesMap-TKey-.md 'DefaultEcs.EntitiesMap&lt;TKey&gt;')
## EntitiesMap&lt;TKey&gt;.ContainsEntity(DefaultEcs.Entity) Method
Determines whether the [EntitiesMap&lt;TKey&gt;](./DefaultEcs-EntitiesMap-TKey-.md 'DefaultEcs.EntitiesMap&lt;TKey&gt;') contains a specific [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity').
```csharp
public bool ContainsEntity(DefaultEcs.Entity entity);
```
#### Parameters
<a name='DefaultEcs-EntitiesMap-TKey--ContainsEntity(DefaultEcs-Entity)-entity'></a>
`entity` [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity')
The [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity') to locate in the [EntitiesMap&lt;TKey&gt;](./DefaultEcs-EntitiesMap-TKey-.md 'DefaultEcs.EntitiesMap&lt;TKey&gt;').

#### Returns
[System.Boolean](https://docs.microsoft.com/en-us/dotnet/api/System.Boolean 'System.Boolean')
true if the [EntitiesMap&lt;TKey&gt;](./DefaultEcs-EntitiesMap-TKey-.md 'DefaultEcs.EntitiesMap&lt;TKey&gt;') contains the specified [Entity](./DefaultEcs-Entity.md 'DefaultEcs.Entity'); otherwise, false.
Loading

0 comments on commit 5be82c2

Please sign in to comment.