{"id":37046741,"url":"https://github.com/simulation-tree/simulation","last_synced_at":"2026-01-14T05:30:52.219Z","repository":{"id":309945528,"uuid":"895694971","full_name":"simulation-tree/simulation","owner":"simulation-tree","description":"For containerizing program code","archived":false,"fork":false,"pushed_at":"2025-09-24T03:03:14.000Z","size":213,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-10-29T11:46:58.183Z","etag":null,"topics":["csharp","dotnet","ecs","nativeaot"],"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/simulation-tree.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-11-28T17:42:04.000Z","updated_at":"2025-09-24T03:00:12.000Z","dependencies_parsed_at":"2025-09-24T05:03:30.299Z","dependency_job_id":"ec52d20c-7370-4909-ba1c-095c89d6ecdf","html_url":"https://github.com/simulation-tree/simulation","commit_stats":null,"previous_names":["simulation-tree/simulation"],"tags_count":63,"template":false,"template_full_name":null,"purl":"pkg:github/simulation-tree/simulation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simulation-tree%2Fsimulation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simulation-tree%2Fsimulation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simulation-tree%2Fsimulation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simulation-tree%2Fsimulation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simulation-tree","download_url":"https://codeload.github.com/simulation-tree/simulation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simulation-tree%2Fsimulation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28410594,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","dotnet","ecs","nativeaot"],"created_at":"2026-01-14T05:30:51.663Z","updated_at":"2026-01-14T05:30:52.213Z","avatar_url":"https://github.com/simulation-tree.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simulation\n\n[![Test](https://github.com/simulation-tree/simulation/actions/workflows/test.yml/badge.svg)](https://github.com/simulation-tree/simulation/actions/workflows/test.yml)\n\nLibrary providing a way to broadcast messages to added listeners.\n\n### Running simulators\n\nSimulators contain and update systems:\n```cs\npublic static void Main()\n{\n    using Simulator simulator = new();\n    simulator.Add(new ProgramSystems());\n    // do work\n    simulator.Remove\u003cProgramSystems\u003e();\n}\n\npublic class ProgramSystems : IDisposable\n{\n    public ProgramSystems()\n    {\n        //before addition\n    }\n\n    public void Dispose()\n    {\n        //after removal\n    }\n}\n```\n\n### Receiving messages\n\nA system that is partial, and implementing the `IListener\u003cT\u003e` interface will\nallow it to receive messages broadcast by the simulator:\n```cs\nsimulator.Broadcast(32f);\nsimulator.Broadcast(32f);\nsimulator.Broadcast(32f);\n\npublic partial class ListenerSystem : IListener\u003cfloat\u003e\n{\n    void IListener\u003cfloat\u003e.Receive(ref float message)\n    {\n    }\n}\n```\n\nMessages can also be broadcast by reference, allowing systems to modify them,\nand use it to communicate between different projects:\n```cs\nLoadRequest request = new();\nsimulator.Broadcast(ref request);\nAssert.That(request.loaded, Is.True);\n\npublic partial class LoadSystem : IListener\u003cLoadRequest\u003e\n{\n    void IListener\u003cfloat\u003e.Receive(ref LoadRequest message)\n    {\n        message.loaded = true;\n    }\n}\n\npublic struct LoadRequest\n{\n    public bool loaded;\n}\n```\n\n### Global simulator\n\nAnother way to have listeners and broadcasting setup, is using the included `GlobalSimulator` type.\nThis approach is slimmer than with the `Simulator`, at the cost of the listeners being global to the entire\nruntime.\n```cs\npublic class Program\n{\n    public static void Main()\n    {\n        GlobalSimulatorLoader.Load();\n        GlobalSimulator.Broadcast(32f);\n        GlobalSimulator.Broadcast(32f);\n        GlobalSimulator.Broadcast(32f);\n    }\n}\n\npublic static class Systems\n{\n    [Listener\u003cfloat\u003e]\n    public static void Update(ref float message)\n    {\n    }\n}\n```\n\n### Contributing and design\n\nThis library is created for composing behaviour of programs using systems, ideally created by\nseparate isolated projects.\n\nContributions to this goal are welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimulation-tree%2Fsimulation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimulation-tree%2Fsimulation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimulation-tree%2Fsimulation/lists"}