{"id":22120228,"url":"https://github.com/joshbrew/mazeswarm","last_synced_at":"2025-03-24T06:27:22.279Z","repository":{"id":227609011,"uuid":"771896608","full_name":"joshbrew/mazeswarm","owner":"joshbrew","description":"Javascript maze game with swarm physics. Acerola Game Jam 0 last minute submission","archived":false,"fork":false,"pushed_at":"2024-03-24T00:48:28.000Z","size":5413,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-29T12:15:10.811Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joshbrew.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":"2024-03-14T06:39:27.000Z","updated_at":"2024-07-21T12:02:00.000Z","dependencies_parsed_at":"2024-12-01T14:21:39.357Z","dependency_job_id":null,"html_url":"https://github.com/joshbrew/mazeswarm","commit_stats":null,"previous_names":["joshbrew/mazeswarm"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshbrew%2Fmazeswarm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshbrew%2Fmazeswarm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshbrew%2Fmazeswarm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshbrew%2Fmazeswarm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joshbrew","download_url":"https://codeload.github.com/joshbrew/mazeswarm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245220179,"owners_count":20579720,"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":[],"created_at":"2024-12-01T14:21:34.625Z","updated_at":"2025-03-24T06:27:22.244Z","avatar_url":"https://github.com/joshbrew.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MazeSwarm\nFlowfields, Mazes, with Rapier physics + BablyonJS 3D\n\n[Playable Demo](https://mazeswarm.netlify.app) \n\nFind the exit, escape the swarm! Use the map to help find the keys and the exit. We'll be adding more to this later as we have time/energy. I want to develop a much richer game but using the physics and flow puzzle/action premises.\n\nClick to go to youtube:\n[![yt](https://img.youtube.com/vi/XA25_1qLjig/0.jpg)](https://youtu.be/XA25_1qLjig))\n\n\nBabylonJS for rendering. Rapier3D for scene collision and scripting interactions. All entities are physics-based and update the render thread.\n\nPhysics thread uses a separate thread to convolve the main flowfield that tracks the player from all points in the maze for navigating ai to you. Idle AI will alternate accessible flowfield points on separate convolved layers that can be purposed for other targets too.\n\nBabylonJS thread handles only the render updating while positions and states etc. are determined by the physics thread. \n\nMain thread just passes user inputs to babylonjs to update the render with simple vector calc.\n\nMany many things left undone, we have a future game planned around this general idea but this is far away from that.\n\n### To run:\n\n`npm i -g tinybuild \u0026 tinybuild` if you don't have [tinybuild](https://github.com/joshbrew/tinybuild) installed.\n\nthen \n\n`npm start` or `tinybuild`\n\n### About\n\nRapier3D: fancy Rust -\u003e JS WASM physics engine, it's faster than anything else free except maybe the updated Havok plugin for BabylonJS which has first class support. Only thing Babylon needs now is proper lighting :P Rapier could use better raw buffer access for quicker reads/writes.\n\nBenchmarks: https://www.dimforge.com/blog/2020/08/25/announcing-the-rapier-physics-engine/\n\nBabylonJS: fancy JS rendering engine, including lots of extras. Little fatter than ThreeJS but heavier on game engine features.\n\nHomemade Maze generation with Flowfield pathfinding for efficient swarm physics. AStar is used to generate door and key placements to ensure it's always solvable.\n\nRuns at 60-120fps no problem on my laptop, plenty could be further optimized as well as quality of life improvements to the code organization but we worked hot and fast to make this functional.\n\n\n### Benchmark\n\n![benchmark](./benchmark_3.png)\n\nCurrent benchmarks on an RTX3070 + i7-10750H. Tasks running in 7-11 microseconds with ~4000 3D entities (with floor represented as 1 physics plane). CPU time can be further minimized on BabylonJS to increase render complexity. Swapping in WebGPU will be a major boost, which should work better with the 7.0 update in a week, but we are stuck with single threaded physics bottlenecks. This is good enough for 60-120fps gameplay. The GPU calls by comparison are less than half a microsecond (~0.32ms average) so it's not a rendering issue at all. \n\n![benchmark](./benchmark.png)\n\nBaseline performance is on the order of microseconds. This is just with two crowd entities, a player, a number of other physics objects, and a single light source.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshbrew%2Fmazeswarm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoshbrew%2Fmazeswarm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshbrew%2Fmazeswarm/lists"}