{"id":51063600,"url":"https://github.com/deblasis/ziofsm","last_synced_at":"2026-06-23T04:30:29.902Z","repository":{"id":355022261,"uuid":"1226237107","full_name":"deblasis/ziofsm","owner":"deblasis","description":"Comptime finite state machine for Zig games. Type-safe, zero allocation. 39 tests.","archived":false,"fork":false,"pushed_at":"2026-05-01T12:27:46.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-01T14:22:43.974Z","etag":null,"topics":["game-engine","gamedev","gamedev-library","zig","zig-lang"],"latest_commit_sha":null,"homepage":null,"language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deblasis.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":null,"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":"AGENTS.md","dco":null,"cla":null},"funding":{"github":"deblasis","ko_fi":"deblasis","custom":["https://etherscan.io/address/0x9664E083C380F3b655f76B37D73d419F49bD7e8b"]}},"created_at":"2026-05-01T06:13:54.000Z","updated_at":"2026-05-01T12:27:49.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/deblasis/ziofsm","commit_stats":null,"previous_names":["deblasis/ziofsm"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/deblasis/ziofsm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deblasis%2Fziofsm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deblasis%2Fziofsm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deblasis%2Fziofsm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deblasis%2Fziofsm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deblasis","download_url":"https://codeload.github.com/deblasis/ziofsm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deblasis%2Fziofsm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34675970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"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":["game-engine","gamedev","gamedev-library","zig","zig-lang"],"created_at":"2026-06-23T04:30:29.352Z","updated_at":"2026-06-23T04:30:29.894Z","avatar_url":"https://github.com/deblasis.png","language":"Zig","funding_links":["https://github.com/sponsors/deblasis","https://ko-fi.com/deblasis","https://etherscan.io/address/0x9664E083C380F3b655f76B37D73d419F49bD7e8b"],"categories":[],"sub_categories":[],"readme":"# ziofsm\n\n\u003e Comptime finite state machine for Zig games. Type-safe transitions, zero allocation.\n\nPart of the [zio-zig](https://github.com/deblasis/zio-zig) ecosystem.\n\n## Quick start\n\n```zig\nconst zfsm = @import(\"ziofsm\");\n\nconst State = enum { idle, walking, running, jumping };\nconst Event = enum { start_walk, stop, jump, land, speed_up };\nconst T = zfsm.Transition(State, Event);\n\nconst transitions = [_]T{\n    .{ .from = .idle,    .event = .start_walk, .to = .walking },\n    .{ .from = .walking, .event = .speed_up,   .to = .running },\n    .{ .from = .running, .event = .stop,       .to = .idle },\n    .{ .from = .walking, .event = .stop,       .to = .idle },\n    .{ .from = .idle,    .event = .jump,       .to = .jumping },\n    .{ .from = .walking, .event = .jump,       .to = .jumping },\n    .{ .from = .jumping, .event = .land,       .to = .idle },\n};\n\nvar fsm = zfsm.FSM(State, Event, \u0026transitions).init(.idle);\n\n// Process events\nfsm.process(.start_walk);  // idle → walking\nfsm.process(.speed_up);    // walking → running\nfsm.process(.jump);        // no transition! stays running\nfsm.process(.stop);        // running → idle\n\n// Query state\nconst state = fsm.currentState();\nconst can_jump = fsm.canProcess(.jump);\n```\n\n```bash\nzig build test          # Run 39 tests\nzig build run-example   # Run example\n```\n\n## Example output\n\n```\n$ zig build run-example\nState: .menu\nAfter start: .playing\nAfter die: .game_over\nAfter reset: .menu\n```\n\n## API\n\n### Transition(State, Event)\n\nStruct with `.from: State`, `.event: Event`, `.to: State`.\n\n### FSM(State, Event, transitions)\n\nComptime-parameterized state machine. Transitions array is comptime-known.\n\n| Method | Description |\n|--------|-------------|\n| `init(initial_state)` | Create FSM in initial state |\n| `process(event)` | Process event, returns `true` if transition occurred |\n| `canProcess(event)` | Check if a transition exists for current state + event |\n| `currentState()` | Get current state |\n| `forceTransition(state)` | Jump to any state (bypass transitions) |\n\n### Properties\n- Zero allocation — all state stored inline\n- Comptime-verified — transition table checked at compile time\n- `process()` returns false for invalid transitions (no state change)\n\n## License\n\nMIT. Copyright (c) 2026 Alessandro De Blasis.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeblasis%2Fziofsm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeblasis%2Fziofsm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeblasis%2Fziofsm/lists"}