You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Updating pools to expose Clear and rename RemoveAll to Clear
* Moved batched systems over to use refs
* Added missing computed component benchmark
* Got first iteration of Multiplexer in there
* Added more benchmarks and added ref based multiplexer
* Good example for allocations
* Updated tests
* Added lazy computers
* Moved more over to lazy computers
* Fixed up resolution on ref computed field
* Updated tests to batch correctly
* Fixed up tests and made IsDirty true by default to mimic old behaviour
* Bumped version
* Updated docs and readme
Copy file name to clipboardExpand all lines: docs/ecs-r3/framework/computeds.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,12 +28,18 @@ Now we can all laugh at the name here, but this is basically the same as the pre
28
28
29
29
This provides you with an `IComputedEntityGroup` as the `DataSource` then you translate them into whatever you want `T` to be.
30
30
31
+
> This inherits from the lazy computed line, so it will only refresh its value when you read its `Value`(and it has awaiting changes) or you explicitly call `ForceRefresh`.
32
+
31
33
## `IComputedComponentGroup`
32
34
33
35
While this is listed as a high level `Computed` and not a convention, in reality it is a `ComputedFromEntityGroup<ReadOnlyMemory<ComponentBatch<...>>>` which is a bit of a mouthful, but it provides a really performant way to access components for `Entities`.
34
36
35
37
> For example if you have a group that requires `ComponentA`, `ComponentB` then this computed will provide `ComponentBatch<ComponentA, ComponentB>` for each entity, allowing quick lookup and processing, this is what `BatchedSystems` use under the hood to resolve components.
36
38
39
+
> This inherits from the lazy computed line, so it will only refresh its value when you read its `Value`(and it has awaiting changes) or you explicitly call `ForceRefresh`.
40
+
37
41
### `ComputedFromComponentGroup<T>`
38
42
39
-
This provides you a `IComputedComponentGroup` as the `DataSource` and lets you process it however you want into `T`.
43
+
This provides you a `IComputedComponentGroup` as the `DataSource` and lets you process it however you want into `T`.
44
+
45
+
> This inherits from the lazy computed line, so it will only refresh its value when you read its `Value`(and it has awaiting changes) or you explicitly call `ForceRefresh`.
Copy file name to clipboardExpand all lines: docs/ecs-r3/framework/systems.md
+57Lines changed: 57 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,6 +77,63 @@ public class BatchedExampleSystem : BatchedMixedSystem<SomeStructComponentA, Som
77
77
78
78
> Due to the MANY permutations of this that you can have its recommended that if you have very specific scenarios you just copy the code for the current `BatchedMixedSystem` and alter the signatures however you need.
79
79
80
+
### `MultiplexingSystem` + `IMultiplexedJob`
81
+
82
+
This is very much like a batched system, but it acts as a sort of multiplexer to allow you to run multiple `jobs` within one update, a `job` is basically the same as a batched systems `Process` method but standalone.
83
+
84
+
> This is really useful if you have multiple systems which all require same components and execute at same time, this ensures that it only needs to lookup the batches once and then runs all jobs back to back with the batch data, this can allow for better utilisation of CPU/Memory.
85
+
86
+
```csharp
87
+
// Make as many jobs as you want, you can also use ISystemPreProcessor/PostProcessor with it
On one hand this may seem slightly more complex but in a way it also makes things a bit simpler as your Jobs are lightweight objects that can just be scheduled together and you have a smaller logic footprint.
129
+
130
+
> Remember you dont need to have 100% overlap on required components etc, there will be a tipping point but if you have several systems which all use 75% of the same components you can possibly get a decent performance bonus making them into jobs and giving them all the same components, even if a few of the jobs ignore a component or two it may still end up being more efficient than running them as fully fledged systems.
Same as above but it lets you pass the components to jobs with `ref` keyword, mainly meant for struct scenarios.
134
+
135
+
> There is currently no mixed one but it may be added in the future, there is so many varieties of approaches to mix `ref` it is currently left to you to implement your own variants if you need them.
136
+
80
137
### `IBasicEntitySystem`
81
138
82
139
This system is like a `IBasicSystem` allowing you to process each entity within the group on every update cycle.
Copy file name to clipboardExpand all lines: docs/systems-r3/framework/computeds.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,14 @@ Computed values are basically read only values which are proxy a data source and
6
6
7
7
## Computed Types
8
8
9
-
There are 3 default computed types available within the system:
9
+
There are 4 default computed types available within the system:
10
10
11
11
### `IComputed` (For computed single values)
12
12
Simplest computed and provides a current value and allows subscription to when the value changes, this can be very useful for precomputing things based off other data, i.e calculating MaxHp once all buffs have been taken into account.
13
13
14
+
### `ILazyComputed` (Same as above)
15
+
Same as normal Computed but only updates when value is read or `ForceRefresh` is called, triggering `OnChange` exposes `OnHasChange` as well to indicate the dependent data has changed but not been refreshed.
16
+
14
17
### `IComputedCollection` (For computed collections of data)
15
18
A reactive collection which provides an up to date collection of values and allows you to subscribe to when it changes, this could be useful for tracking all beneficial buffs on a player where the source data is just ALL buffs/debuffs on the entity.
16
19
@@ -64,6 +67,9 @@ var computedFirstPlaceRacer = new ComputedFirstPlace(collectionOfRacers); // inh
Same as previous `ComputedFromData` but a lazily evaluated variant.
72
+
67
73
### `ComputedFromObservable<TOutput, TInput>`
68
74
69
75
Much like the above `ComputedFromData` but the `DataSource` needs to be an `Observable<TInput>`, and will listen for changes on the observable and update its internal state accordingly, these are often known as **Pure Computeds** as they just proxy the underlying Observable.
0 commit comments