{"id":20168254,"url":"https://github.com/andreakarasho/tinyecs","last_synced_at":"2025-04-10T01:52:25.856Z","repository":{"id":65387343,"uuid":"583583043","full_name":"andreakarasho/TinyEcs","owner":"andreakarasho","description":"A tiny archetype-style ECS library for dotnet","archived":false,"fork":false,"pushed_at":"2024-04-27T21:48:16.000Z","size":938,"stargazers_count":45,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-05-02T04:15:10.452Z","etag":null,"topics":["csharp","data-oriented-design","dotnet","ecs","entity-component-system"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andreakarasho.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-30T08:12:38.000Z","updated_at":"2024-05-05T23:30:32.291Z","dependencies_parsed_at":"2024-05-05T23:40:34.820Z","dependency_job_id":null,"html_url":"https://github.com/andreakarasho/TinyEcs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreakarasho%2FTinyEcs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreakarasho%2FTinyEcs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreakarasho%2FTinyEcs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andreakarasho%2FTinyEcs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andreakarasho","download_url":"https://codeload.github.com/andreakarasho/TinyEcs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248142941,"owners_count":21054671,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","data-oriented-design","dotnet","ecs","entity-component-system"],"created_at":"2024-11-14T01:07:01.926Z","updated_at":"2025-04-10T01:52:25.845Z","avatar_url":"https://github.com/andreakarasho.png","language":"C#","readme":"# TinyEcs\n\n[![NuGet Version](https://img.shields.io/nuget/v/TinyEcs.Main?label=TinyEcs)](https://www.nuget.org/packages/TinyEcs.Main)\n\nTinyEcs: a reflection-free dotnet ECS library, born to meet your needs.\n\n## Key Features\n\n-   Fast\n-   Reflection-free design\n-   NativeAOT \u0026 bflat support\n-   Zero runtime allocations\n-   Relationships support\n-   `Bevy systems` concept\n\n## Requirements\n\n-   `net9.0`\n\n## Status\n\n🚧 Early development stage: Expect breaking changes! 🚧\n\n## Run the pepe game!\n\n```bash\ncd samples/TinyEcsGame\ndotnet run -c Release\n```\n\n## Sample code\n\nThis is a very basic example which doens't show the whole features set of this library.\n\n```csharp\nusing var world = new World();\nvar scheduler = new Scheduler(world);\n\n// create the Time variable accessible globally by any system which stays fixed at 60fps\nscheduler.AddResource(new Time() { FrameTime = 1000.0f / 60.0f });\nscheduler.AddResource(new AssetManager());\n\nvar setupSysFn = Setup;\nscheduler.AddSystem(setupSysFn, Stages.Startup);\n\nvar moveSysFn = MoveEntities;\nscheduler.AddSystem(moveSysFn);\n\nvar countSomethingSysFn = CountSomething;\nscheduler.AddSystem(countSomethingSysFn);\n\n\nwhile (true)\n    scheduler.Run();\n\nvoid Setup(World world, Res\u003cAssetManager\u003e assets)\n{\n    // spawn an entity and attach some components to it\n    world.Entity()\n        .Set(new Position() { X = 20f, Y = 9f  })\n        .Set(new Velocity() { X = 1f, Y = 1.3f });\n\n    var texture = new Texture(0, 2, 2);\n    texture.SetData(new byte[] { 0, 0, 0, 0 });\n    assets.Register(\"image.png\", texture);\n}\n\nvoid MoveEntities(Query\u003cData\u003cPosition, Velocity\u003e\u003e query, Res\u003cTime\u003e time)\n{\n    foreach ((Ptr\u003cPosition\u003e pos, Ptr\u003cVelocity\u003e vel) in query)\n    {\n        pos.Ref.X += vel.Ref.X * time.Value.FrameTime;\n        pos.Ref.Y += vel.Ref.Y * time.Value.FrameTime;\n    }\n}\n\nvoid CountSomething(Local\u003cint\u003e localCounter, Res\u003cTime\u003e time)\n{\n    localCounter.Value += 1;\n}\n\n\nstruct Position { public float X, Y; }\nstruct Velocity { public float X, Y; }\n\nclass Time\n{\n    public float FrameTime;\n}\n\nclass Texture\n{\n    public Texture(int id, int width, int height)\n    {\n        Id = id;\n        Width = width;\n        Height = height;\n    }\n\n    public int Id { get; }\n    public int Width { get; }\n    public int Height { get; }\n\n    public void SetData(byte[] data)\n    {\n        // ...\n    }\n}\n\nclass AssetManager\n{\n    private readonly Dictionary\u003cstring, Texture\u003e _assets = new ();\n\n    public void Register(string name, Texture texture)\n    {\n        _assets[name] = texture;\n    }\n\n    public Texture? Get(string name)\n    {\n        _assets.TryGetValue(name, out var texture);\n        return texture;\n    }\n}\n\n```\n\n## Bechmarks\n\n-   [friflo - ECS.CSharp.Benchmark-common-use-cases](https://github.com/friflo/ECS.CSharp.Benchmark-common-use-cases/tree/main?tab=readme-ov-file#feature-matrix)\n\n## Credits\n\nInspired by:\n\n-   [entity-component-system](https://github.com/jasonliang-dev/entity-component-system)\n-   [flecs](https://github.com/SanderMertens/flecs)\n-   [bevy](https://github.com/bevyengine/bevy)\n\n## Cool Design Reference\n\n-   [flecs Manual](https://github.com/SanderMertens/flecs/blob/master/docs/Manual.md)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreakarasho%2Ftinyecs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandreakarasho%2Ftinyecs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandreakarasho%2Ftinyecs/lists"}