Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

StaticEcs

> 数据库
Open source

C# Hierarchical Inverted Bitmap ECS framework

198 stars0 likes1 views
WebsiteGitHub

About

C# Hierarchical Inverted Bitmap ECS framework

Static ECS - C# Hierarchical Inverted Bitmap ECS framework

  • Performance
  • Lightweight
  • No allocations
  • Low memory footprint
  • No Unsafe in core
  • Based on statics and structures
  • Type-safe
  • Free abstractions
  • Powerful query engine with parallelism support
  • Batch entity operations
  • Component and tag change tracking
  • Entity grouping by types and clusters
  • Entity relations system
  • World snapshot serialization
  • Event system
  • No boilerplate
  • Compatibility with Unity with support for Il2Cpp and Burst
  • Compatibility with other C# engines
  • Compatible with Native AOT

Table of Contents

  • Contacts
  • Installation
  • Concept
  • Quick start
  • Features
    • Entity
    • Entity global ID
    • Component
    • Tag
    • MultiComponent
    • Relations
    • World
    • Systems
    • Resources
    • Query
    • Events
    • Change Tracking
    • Serialization
    • Compiler directives
  • Performance
  • Unity integration
  • Roslyn analyzer
  • AI Agent Integration
  • Roadmap
  • Community projects & references
  • License

Contacts

  • [email protected]
  • Telegram

Support the project

If you like Static ECS and it helps your project, you can support its development:

Installation

The library has a dependency on StaticPack 1.2.6 for binary serialization, StaticPack must also be installed

  • As source code

    From the release page or as an archive from the branch. In the master branch there is a stable tested version
  • Installation for Unity

    Via git module in Unity PackageManager:
    https://github.com/Felid-Force-Studios/StaticEcs.git
    https://github.com/Felid-Force-Studios/StaticPack.git
    Or adding to the manifest Packages/manifest.json:
    json
    "com.felid-force-studios.static-ecs": "https://github.com/Felid-Force-Studios/StaticEcs.git"
    "com.felid-force-studios.static-pack": "https://github.com/Felid-Force-Studios/StaticPack.git"
  • NuGet

    dotnet add package FFS.StaticEcs
    For debug build with assertions:
    dotnet add package FFS.StaticEcs.Debug
    Packages: FFS.StaticEcs · FFS.StaticEcs.Debug

Concept

StaticEcs — a new ECS architecture based on an inverted hierarchical bitmap model. Unlike traditional ECS frameworks that rely on archetypes or sparse sets, this design introduces an inverted index structure where each component type owns entity bitmaps instead of entities storing component masks. A hierarchical aggregation of these bitmaps provides logarithmic-space indexing of entity blocks, enabling O(1) block filtering and efficient parallel iteration through bitwise operations. This approach completely removes archetype migration and sparse-set indirection, offering direct SoA-style memory access across millions of entities with minimal cache misses. The model achieves up to 64× fewer memory lookups per block and scales linearly with the number of active component sets, making it ideal for large-scale simulations, open worlds with streaming, networked games with state synchronization, reactive AI with thousands of agents, and projects with frequent component composition changes (buffs, effects, statuses).

In archetype-based ECS (Unity DOTS, Flecs, Bevy, Arch), every component addition or removal triggers entity migration — copying all data to a new archetype, and the number of component combinations leads to archetype explosion. In sparse-set ECS (EnTT, DefaultEcs), component access requires indirect addressing through sparse tables with at least two cache misses per lookup. StaticEcs eliminates both problems: each entity occupies a fixed slot in segmented arrays and never moves in memory — Add/Remove is an O(1) bit flip in the presence mask with no data copying. Memory-stable entity addresses enable cheap entity relations through versioned identifiers (EntityGID), including links with streaming where some related entities reside in unloaded zones — ideal for complex simulations in open worlds. The number of component types has no impact on storage structure, since each type owns its own mask independently of the others. Two-dimensional EntityType × Cluster partitioning further ensures cache locality: entities of the same type within a cluster occupy adjacent memory segments, while clusters allow loading and unloading entire spatial zones without touching the rest of the data.

Memory is organized hierarchically: chunks (4,096 entities) → segments (256) → blocks (64). A world query starts by ANDing heuristic masks at the chunk level — a single bitwise operation covers up to 4,096 entities, skipping empty blocks entirely — then refines at the 64-entity block level. Batch operations (BatchAdd, BatchRemove, BatchSetTag) process up to 64 entities with a single bitwise operation.

  • The core idea of this implementation is static: all world and component data resides in static generic classes (World), enabling avoidance of costly virtual calls and allocations, with a convenient API and plenty of syntactic sugar. The JIT compiler eliminates dead code for unused component hooks
  • This framework is focused on maximum ease of use, speed and comfort of code writing without loss of performance
  • Multi-world creation, strict typing, ~zero-cost abstractions
  • Binary serialization system with world, cluster, and per-entity snapshots, schema versioning and compression support
  • Entity relations system with automatic bidirectional hooks for hierarchies, groups, and links
  • Reactive change tracking for network synchronization, UI, and triggers
  • Multi-components — variable-length per-entity data (inventory, buffs) without heap allocations
  • Multithreaded processing with parallel queries and block-level safety guarantees
  • Low memory usage, SoA layout (Structure of Arrays) — components of the same type in contiguous arrays
  • Built on Bitmap architecture, no archetypes, no sparse-sets
  • The framework was created for the needs of a private project and put out in open-source.

Quick start

For compile-time checks install FFS.StaticEcs.Analyzers — a separate NuGet / UPM package with a Roslyn analyzer and code-fix suite.

…

AI Agent Integration

If you use AI coding assistants (Claude Code, Cursor, Copilot, etc.) with StaticEcs:

  • llms.txt: Point your agent at https://felid-force-studios.github.io/StaticEcs/llms.txt for a concise AI-readable reference
  • Full context: https://felid-force-studios.github.io/StaticEcs/llms-full.txt for comprehensive documentation
  • Claude Code: Copy the consumer CLAUDE.md snippet into your project's CLAUDE.md
  • Common pitfalls: See the pitfalls guide

Roadmap

StaticEcs is feature-complete for its core scope. Active development focuses on two things:

  • Extended Unity Burst support — most of the public API will be made available from Burst-compiled code paths.
  • Maintenance & stability — bug fixes, performance refinements, small quality-of-life improvements.

No large new features are planned at this time. If you hit a bug, have a question, or want to suggest an improvement — please open an issue or send a pull request. Contributions are very welcome.

Community projects & references

StaticTopDownShooter by @d4nilevi4 — 2D top-down shooter, Unity 6, StaticEcs. Enemies use Utility AI to take cover and return fire.

StaticEngine by @d4nilevi4 — experimental C#/.NET 10 game engine inspired by Bevy. Built on StaticEcs + Raylib-cs.

License

MIT license

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C#csharpdata-oriented-designdotnetecs

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category数据库
PricingOpen source

> Related tools

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库