{"id":22933077,"url":"https://github.com/evilkiwi/quadtree","last_synced_at":"2025-08-12T16:32:35.423Z","repository":{"id":57166918,"uuid":"139472286","full_name":"evilkiwi/quadtree","owner":"evilkiwi","description":"A simple, efficient Quadtree system","archived":false,"fork":false,"pushed_at":"2023-11-11T09:15:12.000Z","size":150,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-08T10:48:38.895Z","etag":null,"topics":["game","game-development","game-server","nodejs","physics","quadtree"],"latest_commit_sha":null,"homepage":"https://evil.kiwi","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/evilkiwi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"github":"evilkiwi"}},"created_at":"2018-07-02T17:15:39.000Z","updated_at":"2024-08-06T18:47:46.000Z","dependencies_parsed_at":"2024-09-25T09:02:34.983Z","dependency_job_id":null,"html_url":"https://github.com/evilkiwi/quadtree","commit_stats":{"total_commits":18,"total_committers":3,"mean_commits":6.0,"dds":0.2222222222222222,"last_synced_commit":"30a25a653d066b5cc66a17b8aded0f566b2c4f9f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/evilkiwi/quadtree","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evilkiwi%2Fquadtree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evilkiwi%2Fquadtree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evilkiwi%2Fquadtree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evilkiwi%2Fquadtree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evilkiwi","download_url":"https://codeload.github.com/evilkiwi/quadtree/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evilkiwi%2Fquadtree/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270097080,"owners_count":24526608,"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","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"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","game-development","game-server","nodejs","physics","quadtree"],"created_at":"2024-12-14T11:19:48.016Z","updated_at":"2025-08-12T16:32:35.182Z","avatar_url":"https://github.com/evilkiwi.png","language":"TypeScript","readme":"\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@evilkiwi/quadtree\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/@evilkiwi/quadtree?style=flat-square\" alt=\"NPM\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://discord.gg/3S6AKZ2GR9\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/discord/1000565079789535324?color=7289DA\u0026label=discord\u0026logo=discord\u0026logoColor=FFFFFF\u0026style=flat-square\" alt=\"Discord\" /\u003e\n  \u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/npm/l/@evilkiwi/quadtree?style=flat-square\" alt=\"GPL-3.0-only\" /\u003e\n  \u003ch3\u003eQuadtree\u003c/h3\u003e\n\u003c/div\u003e\n\nA quadtree is a method of splitting a game world in to separate nodes in order to increase the performance of collision-based operations.\n\n## Installation\n\nThis package is available via NPM:\n\n```bash\nyarn add @evilkiwi/quadtree\n\n# or\n\nnpm install @evilkiwi/quadtree\n```\n\n## Usage\n\nTODO:\n\n## Explanation\n\nA regular way of checking collisions in a game would be getting `ObjectA` and checking it's position against every other Object/Entity in my\ngame, and then doing the same for every other Object/Entity. This is minimal with a smaller amount of entities, but isn't scalable. And\nwhilst you _can_ optimise this somewhat, it fundamentally cannot scale. This method is called the `n^2` method, as if you have 100\nObject/Entities, you'll need to do 100^2 checks to run the collision logic (10,000 checks).\n\nThe idea behind a Quadtree in Game Development is to get around this by having spacial awareness. For example, if I'm checking collisions\nfor `ObjectA`, I only need to check the other Entities/Objects that are around it - there's no point checking for collision against an\nEntity that's on the other side of the game world. You could do something similar to this in the `n^2` method by looping over every single\nObject/Entity, checking whether its position is close to `ObjectA` and only then running collision logic on it, but this is still\nfundamentally unscalable as you are still doing _some_ level of logic on _every_ Object/Entity in the game world, hence the performance\nbottlenecks of `n^2` still apply.\n\nA Quadtree does this by taking Objects that you supply it (In Game Dev, these would be Entities), and then subdividing the game world in to\nquads based on how many Objects are in a given area. For example, see this image:\n\n![Example 1](https://i.imgur.com/AlY7vtN.png)\n\nThe blue lines show the quads that were generated by the quadtree after inserting the red objects (Entities).\n\nFor more information on Quadtrees and how they work, check out this video: [What are Quadtrees](https://www.youtube.com/watch?v=-OLQlDHCMgM)\n\n## To-do\n\n- Add a test suite\n","funding_links":["https://github.com/sponsors/evilkiwi"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevilkiwi%2Fquadtree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevilkiwi%2Fquadtree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevilkiwi%2Fquadtree/lists"}