EasyEcs

Changelog

What changed in each EasyEcs release, newest first: new APIs, performance, fixes and the changes that need code changes.

What changed from one EasyEcs release to the next, newest first, for code that uses EasyEcs. Upgrading across a major or minor version that needs code changes? The migration guide has the steps. Each GitHub release also lists every pull request it contains.

4.6.0

New

  • world.Load(input, markWritten: false) loads a whole save without change ticks: no loaded row counts as written or removed, also for systems added after the load, so a restart that resumes a saved world does not send every record again. See restart.
  • world.AddSystem<T>(changesFromNow: true) (and AddSystem(system, changesFromNow: true)) starts a system at the current tick: the first run of its [Changed<T>] and [Removed<T>] methods visits only what is written or removed after the call. See ticks.

Fixes

  • Native AOT publishes without warnings: a program with tracked components (ITrackChanges, also the built-in ChildOf) or disabled components got an IL3054 warning (generic recursion), which fails a build that treats warnings as errors. See Native AOT.

4.5.0

New

  • entity.Run(ref job) runs a struct job (IForEachEntity<T1..T9>) on one entity: it returns false when the entity is stale or lacks a component, and entity.Run(ref job, filter) also when a QueryFilter (With, Without, WithAny, Changed, Removed, a group) rejects it. The job's Writes stamp change ticks as in a pass, its ref parameters stay valid across its own structural changes, and its writes reach the moved row even when it throws. See one entity: entity.Run.
  • A system group can filter through interfaces: IGroupWith<T> / IGroupWithout<T> on the group, or on an interface it implements, act as [With<T>] / [Without<T>]. A generic interface gives each type its own group (IActorGroup<TActor> : IGroupWith<Inbox<TActor>>), which attributes cannot express. See group filters.
  • world.Descendants(root) walks a whole subtree, depth first, allocation-free once warm: collect a group with every level of children before moving or saving it. See list them.
  • world.LoadEntitiesInto(input, entities, markWritten: false) restores a record without counting it as a change, so [Changed<T>] savers and replicators do not send it back; that holds for a value it replaces too, such as a prefab's default. See a record of what persists.
  • The EasyEcs package brings Nino's generator: a [NinoType] component gets its formatter with no other package reference, so a project can drop its Nino.Generator reference (a kept one must not be older than the Nino of EasyEcs). See declare the components.
  • The analyzer treats entity.Run as a structural call: EECS010 rejects it in a parallel [ForEach] method, EECS013 and EECS014 check it like Set.

Fixes

  • The analyzer treats world.LoadEntitiesInto as a structural call, like LoadEntities: it was missing from the members EECS010, EECS013 and EECS014 check, so a call in a parallel [ForEach] method, in a method that promises no structural change or on another thread compiled without an error.

4.4.0

New

  • world.SaveEntities(output, ids, set) saves only the components of a ComponentSet (ComponentSet.Create().With<Bank>(), or With(typeof(Bank)) for types learned at run time): a record of what persists, without the runtime components around it, which then need no Nino formatter. See a record of what persists.
  • world.LoadEntitiesInto(input, entities) loads such a save onto entities that exist already: the i-th saved entity's components are added to or replace those of the i-th entity, each entity moving table at most once, with indexes, groups, change tracking and EntityId fields following. See a record of what persists.
  • A component renamed or moved to another namespace keeps its saves with [NinoFormerName("Old.Name")]: saves record types by their Nino type id. See when the code changed.
  • An unmanaged [NinoType] component is written by its Nino formatter, so a VersionTolerant or Keyed one may gain members between builds and still load its old rows. See when the code changed.
  • A refused load names the cause and the fix: raw rows against a formatter, a changed size or layout, two types of the process sharing an id. See why a save does not load.

Performance

  • A DynamicBuffer<T> that dies (its entity destroyed, the component removed) hands its emptied list to the next buffer of its element type the thread creates: entities that come and go with buffers allocate nothing once warm. See dynamic buffers and decision D32.

Changes that need code changes

  • Saves written by 4.3 or earlier do not load (InvalidDataException): write again the data that must outlive the upgrade. See the migration guide.
  • EasyEcs builds on Nino 4.0.0-rc.6: reference Nino.Generator 4.0.0-rc.6. See the migration guide.
  • An unmanaged component marked [NinoType] is saved by its formatter instead of as raw rows; remove the attribute where raw rows are meant. See the migration guide.

Fixes

  • EECS033 no longer suggests a generated member the receiver does not have (entity.Read<ChildOf>() was told to become entity.ChildOf, a member of query items, which does not compile).

4.3.0

New

  • Performance rules in the analyzer, for code that works but does more than it needs. Warnings, for code that costs: EECS025 a ref / Span<T> parameter, Get<T>() or WriteX() that only reads, EECS026 a [ForEach] parameter the method does not use, EECS027 a component or singleton looked up through the visited Entity or the World on every row, EECS028 an allocation in a [ForEach] method or OnUpdate, EECS029 an instance [ForEach] method that uses nothing of its system, EECS030 a structural change entity by entity over a query, EECS031 entities created one by one in a counted loop, EECS032 Count() > 0 instead of Any() and counting or filtering in a loop. Suggestion (Info), for the same cost written shorter: EECS033 a generic call with a generated member of the same meaning (entity.Get<Position>() as entity.Position). Error: EECS034 a system that calls World.Update(). Why each rule is in and the ones left out: decision D29.
  • Code fixes for the new rules where the change is mechanical: in, ReadOnlySpan<T>, Read<T>(), [With<T>], static, the bulk call (SetAll, RemoveAll, DisableAll, EnableAll, DestroyEntities), CreateEntities or EnsureCapacity, Any / Count, and the generated member. Each is offered only when the result compiles.
  • Every analyzer diagnostic links its section of the analyzer rules page.

Changes that need code changes

  • A build that treats warnings as errors fails on the new warnings (EECS025 to EECS032) until the code is changed or the rule is suppressed, and a system that calls World.Update() no longer builds (EECS034). See the migration guide.

4.2.0

New

  • world.EnsureCapacity<T1, …, Tn>(count) pre-sizes the table of exactly those components and the entity storage, so the next count CreateEntity / CreateEntities calls with them never grow either (Friflo's archetype.EnsureCapacity, Arch's EnsureCapacity(signature, n)). See structural changes.

Performance

  • Creating many entities in a fresh world no longer sets off a full garbage collection inside the call: a reservation (EnsureCapacity, EnsureEntityCapacity, CreateEntities, InitialEntityCapacity) grows the table and the entity storage to what it needs instead of the next power of two, and large entity storage sized by one goes to the pinned object heap, beside the columns. See decision D28.

Changes that need code changes

  • A [ForEach] method's singleton parameter throws InvalidOperationException when the world has no such singleton, like world.X and GetSingleton<T>() (it used to add the default value); world.SingletonRef<T>() throws the same way. Add the singleton where the world is built, before the first Update(): world.SetClock(…) or world.AddSingleton<Clock>(), or world.GetOrAddClock() where the default is right. See singletons and the migration guide.

Fixes

  • A [ForEach] method with a parameter named owner no longer fails to build with CS0100 in generated code.
  • world.EnsureCapacity(prefab, count) called while a query or [ForEach] pass walks the table it grows no longer leaves the pass writing to the old columns for the rest of the table. See structural changes.

4.1.0

New

  • Archetype tables: each table stores its components as columns of rows, unmanaged columns pinned and 64-byte aligned. Removing a component keeps the row and clears a presence bit, so states that come and go never move data. See architecture.
  • Immediate structural changes with stricter iteration: a pass visits each entity at most once, and ref writes of a [ForEach] method survive the body's own structural changes. See structural changes.
  • Batch [ForEach] methods taking Span<T> / ReadOnlySpan<T> (whole runs of rows, with an EntitySpan), and [ForEach(Parallel = true)] to split one method's rows over threads without allocating. See systems and threading.
  • Static [ForEach] methods outside systems, generic systems and runners, filters on system groups, Maybe<T> parameters, UpdatePhase, and systems need no partial. See systems.
  • Ordering by dependency with [UpdateBefore<T>] / [UpdateAfter<T>]; errors as data with SystemErrorPolicy.Disable and system.Error; per-system timing with WorldOptions.MeasureSystems and system.Stats. See systems.
  • Change tracking (ITrackChanges, [Changed<T>], QueryFilter.Changed<T>(since)) and removal detection ([Removed<T>], QueryFilter.Removed<T>(since)). See change tracking.
  • Generated members for every component, tag, singleton, index, buffer and query shape: hero.Position.X += 1, hero.SetVelocity(1, 0), hero.SetDead(), world.Battle.Tick++, world.ZoneIndex.Find(3), item.Position, prefab.SetLoot(…). See entities and components.
  • Prefabs (new Prefab(), derived prefabs, groups with AddMember), world.Instantiate, EnsureCapacity and entity.Clone(). See prefabs.
  • DynamicBuffer<T>: a list per entity held as a tracked component. See dynamic buffers.
  • Value indexes (IIndexed<TKey>, world.Index<T, TKey>()), ordered walks (Range, Ascending), relations (IRelation buffers) and target policies (WhenTargetDestroyed). See indexes and relations.
  • Hierarchies: ChildOf(EntityId Parent), children, destroy cascades. See hierarchy.
  • GroupBy<T>() splits tables by a value, so a query for one zone walks only its tables. See groups.
  • entity.Disable<T>() / Enable<T>() and cleanup components (ICleanupComponent). See cleanup and disable.
  • Bulk SetAll / RemoveAll / DisableAll / EnableAll, and CreateEntities / DestroyEntities. See bulk changes.
  • Snapshots: world.Capture() / world.Restore(snapshot). See snapshots.
  • Saves: world.Save / Load through Nino. See saves.
  • SaveEntities / LoadEntities / MoveEntities hand a group of entities to another world or process, and world.RemoveTypes(assembly) takes a plugin's types out of a world so its AssemblyLoadContext can unload. See migration and unload.
  • WithAny<T> filters, entity.Read<T>() and entity.TryGetRef<T>(out found). See queries.
  • world.Describe(), entity.Describe() and a debugger view of entities. See API.
  • Analyzer rules up to EECS024 and code fixes for them, bundled in the package. See analyzer.
  • Templates: dotnet new install EasyEcs.Templates. See getting started.

Performance

  • A realistic server tick of 100,000 entities runs much faster than in 4.0.1 and allocates nothing. See performance.
  • Structural changes check a plain owner flag instead of a compare-and-swap, so creating and destroying entities is faster.
  • Jobs that cannot change structure iterate with no per-entity bookkeeping.
  • Parallel runs use the thread pool and wake helper threads only when they pay (D22).
  • Change and removal summaries per block of rows (D23), index keys as id arrays (D24) and structural loops compiled for tables without tombstones (D25).
  • A QueryFilter holds no object reference, so building one at the call is cheaper (D18).
  • Counting rows by their set bits with Vector512 / Vector<T> (D21).

Changes that need code changes

Every step is in the migration guide.

  • WorldOptions.Parallel is WorldOptions.ParallelSystems: write new WorldOptions { ParallelSystems = true }.
  • Entity.Id is an EntityId and Entity.Version is gone: read entity.Id.Index and entity.Id.Version, and store EntityIds in components (EECS017 warns about Entity fields).
  • EcsSystem.Priority is gone: order systems with [UpdateBefore<T>] / [UpdateAfter<T>].
  • The World.SystemError event is gone: use new WorldOptions { SystemErrors = SystemErrorPolicy.Disable } and read system.Error.
  • world.DestroyEntity(entity) is gone: call entity.Destroy().
  • entity.Add<T>() is gone: write Set(new T(…)) or the generated SetX(…) to add or replace, GetOrAdd<T>() to add a default only when missing.
  • world.CompactArchetypes() and world.GetFragmentationStats() are gone: tables stay dense on their own.
  • IForEach jobs receive only the components: take the entity through IForEachEntity.
  • Query results are ref structs: no await in the loop, no storing items in fields, lambdas or LINQ.
  • Structural changes belong to the world's owner thread; one made inside a parallel stage or a parallel [ForEach] throws InvalidOperationException. See threading.
  • EECS007 (state in a system) and EECS008 (a system referencing a system) are errors; they were warnings in 4.0. Move the state into a component or singleton, and let systems communicate through data.
  • QueryEnumerator.Count and IsEmpty are gone: call world.Count<…>(filter) / world.Any<…>(filter).
  • UpdateInterval and UpdatePhase should return constants: EECS018 warns when they do not.
  • Refs into a table can be invalidated by structural changes of other entities; iteration order follows table rows; AddSingleton resets an existing singleton in place; stale handles answer Has / TryGet with false. See refs and await.

Fixes

  • Entity.GetHashCode() is deterministic across runs, computed from the entity's index and version.
  • The analyzer knows generated writers by their symbols: a component named Settings, read through entity.Settings, no longer hides an EECS013.

4.0.1

New

  • WorldOptions.Parallel runs systems side by side when their generated read/write sets do not conflict, with the same result as running them in order. See threading.
  • A [ForEach] method may take no component when a [With<T>] names what to query: [ForEach, With<Dead>] static void Remove(Entity e). See systems.

4.0.0

New

  • A rewrite for .NET 10 in one EasyEcs namespace: World, Query, and a single version-checked Entity handle whose accessors return ref T.
  • Synchronous EcsSystems with source-generated [ForEach] methods, system groups with [UpdateInGroup<T>], recycled entity ids and per-world singletons.
  • An analyzer that enforces the ECS principles (EECS006-EECS008). See ECS principles.

Changes that need code changes

Every rename is in the migration guide.

  • Context is World and GroupOf is Query.
  • Systems are synchronous: no UniTask, no async callbacks.
  • Events are gone: state changes are components.

3.1.1

Fixes

  • The release build uses the .NET 8 SDK (C# 13); the library is unchanged.

3.1.0

New

  • Count and IsEmpty on GroupResultEnumerator, and CountOf<T>() / AnyOf<T>() on Context.
  • Tag.SetBits / ClearBits take a params ReadOnlySpan<int>.

Performance

  • Tag.ContainsAll matches archetypes with SIMD.
  • GetFragmentationStats is lock-free, and Update() reuses its task buffer.
  • Archetypes are walked by index instead of by dictionary enumeration.

Fixes

  • Avx2.TestZ corrected to Avx.TestZ.

3.0.5

Performance

  • No state machine cost for tasks that already completed.

3.0.4

Performance

  • Tiny tasks run inline instead of on the thread pool.

3.0.3

Performance

  • Parallel work uses an array pool instead of materializing UniTasks.

3.0.2

Performance

  • Faster GetMatchingArchetypes.

3.0.1

Fixes

  • A repeat of the 3.0.0 release with the same contents.

3.0.0

New

  • Archetypes, and adding or removing several components in one call.

Performance

  • Entity creation and destruction and component changes take effect at once.
  • Faster GroupOf and tags, with better locality.

Changes that need code changes

  • Callbacks are gone and changes run at once. See the migration guide.

2.1.6

Performance

  • Iterating systems allocates nothing.

2.1.5

Performance

  • Getting groups allocates nothing (no red-black tree).

2.1.4

Performance

  • Faster Update.

2.1.3

Performance

  • Every overload of GroupOf allocates nothing.

2.1.2

Performance

  • Faster task scheduling.

2.1.1

Performance

  • Faster task dispatching.

2.1.0

Performance

  • Singleton components allocate less.

2.0.10

Performance

  • A better resize strategy.

2.0.9

Performance

  • Faster component lookup.

2.0.8

Performance

  • Faster entity and component lookup.

2.0.7

Performance

  • No SortedList needed.

2.0.6

Performance

  • Fewer allocations through ValueTask.

2.0.5

Fixes

  • Several bugs fixed.

2.0.4

Fixes

  • A tag type is registered automatically on first use.

2.0.3

Fixes

  • The AddSingletonComponent callback passes a ref.

2.0.2

Performance

  • Better memory use.

2.0.1

Performance

  • Faster iteration, refs, entity creation and component adds.

2.0.0

New

  • A lock-free context for parallel systems, components that allocate nothing, faster component lookup.

1.0.8

Changes that need code changes

  • Initializing a context no longer catches exceptions.

1.0.7

Changes that need code changes

  • Components are classes that hold a reference to their entity.

1.0.6

New

  • An entity gives access to its context.

1.0.5

New

  • SingletonComponent: a context holds any number of them.

1.0.4

New

  • Systems run in parallel.

1.0.3

Fixes

  • Several systems with the same priority all run.

1.0.2

New

  • Get an entity from a context by its id.

1.0.1

New

  • Systems can be added after the context has been initialized.

1.0.0

New

  • The first release: an ECS with asynchronous, parallel systems.
Edit on GitHub

Last updated on

How is this guide?

On this page