{"id":13836270,"url":"https://github.com/decentraland-scenes/boids","last_synced_at":"2026-04-04T23:39:17.885Z","repository":{"id":98363086,"uuid":"531658934","full_name":"decentraland-scenes/boids","owner":"decentraland-scenes","description":null,"archived":false,"fork":false,"pushed_at":"2022-12-23T16:22:01.000Z","size":2663,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-20T22:52:19.617Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/decentraland-scenes.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}},"created_at":"2022-09-01T19:28:39.000Z","updated_at":"2022-09-06T18:03:45.000Z","dependencies_parsed_at":"2023-04-06T08:06:14.532Z","dependency_job_id":null,"html_url":"https://github.com/decentraland-scenes/boids","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/decentraland-scenes/boids","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/decentraland-scenes%2Fboids","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/decentraland-scenes%2Fboids/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/decentraland-scenes%2Fboids/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/decentraland-scenes%2Fboids/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/decentraland-scenes","download_url":"https://codeload.github.com/decentraland-scenes/boids/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/decentraland-scenes%2Fboids/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264585372,"owners_count":23632646,"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-08-04T15:00:40.323Z","updated_at":"2026-04-04T23:39:17.836Z","avatar_url":"https://github.com/decentraland-scenes.png","language":"TypeScript","funding_links":[],"categories":["Examples"],"sub_categories":["Essentials"],"readme":"# Boids\n\n![demo](./images/scene-thumbnail.png)\n\n\nBoids is an implementation of the boids algorithm. This can be used for simulation flock behavior such as birds or fish in 3D space.  It uses a grid implementation for fast lookups. \n\n# Class Overview\n\nBoidsController class defines a container for boids entities. All entities (flock or obstalces) are added to BoidsController. BoidsController calculates and updates entity positions and velocities.\n\nBoidSystem is the wrapper for BoidsController to make it work inside a Decentraland SDK. The responsibility of this class is to create a new BoidsController instance with the received data and run the requested iterations in this isolated context.\n\nsetupBoids is the setup class.  It will initialize the BoidController.  Here can define here the area, flock, obsticles, predators, subGrid count\n\nBoidEntity class defines an entitiy model which has a position and a velocity. Also it has some utiliy methods.\n\nGrid class creates cubic grid for spatial partitioning. This helps lookups to be performed faster for nearby entities. More information can be found here: http://gameprogrammingpatterns.com/spatial-partition.html\n\n# Configuration\n\n/src/boids/Constants.js\n\nSee Debug Markers such as grid markers, boundary top/bottom, obstacles, seek and prediator entities\n\n```\n//see debug markers for seek/obsticle/predator\nVISIBLE_OBSTACLES:boolean = true \nVISIBLE_SEEK:boolean = true\nVISIBLE_PREDATOR:boolean = true\n\n// see boundary grid markers\nSHOW_DEBUG_BOUNDARY_MARKERS:boolean = true\n// see boundary planes (top,bottom)\nSHOW_DEBUG_BOUNDARY_PLANES:boolean = true\n```\n\n/src/config.ts\n\n```\nTEST_CONTROLS_ENABLE = true\n```\n\n/src/boids/setupBoids.js\n\nsee initBoidController for creation of all entities types.  Some flags of note include\n\n```\n//SETUP BOUNDARIES\nconst parcelSize = 15.5\nconst width = parcelSize \nconst depth = parcelSize * 2\nconst height = 5\nconst heightBottomOffset = 1 \nconst subGrids = 4 //large grid count makes all fish operating the same get reduced\n\n/*\n300 - 1 subgrid\n600 - 2 subgrid\n700 - 3 subgrid*\n*/\n//SETUP INITIALIZATION OF BOIDS\nconst flockEntityCount = 80\n//will randomly place these\nconst obstacleEntityCount = 0\nconst predatorCount = 0\nconst seekCount = 0\n```\n\n\n## Try it out\n\n**Install the CLI**\n\nDownload and install the Decentraland CLI by running the following command:\n\n```bash\nnpm i -g decentraland\n```\n\n**Previewing the scene**\n\nOpen this folder on the command line, then run:\n\n```\ndcl start\n```\n\nAny dependencies are installed and then the CLI opens the scene in a new browser tab.\n\n## Deploy to Decentraland\n\nIf you own any parcels of land in Decentraland, or have permissions to deploy to someone else's, you can publish this project.\n\n1. Make sure the scene parcels in `scene.json` match those you own or have permissions on.\n2. Run `dcl deploy` on the project folder\n3. This will open a browser tab to confirm. Metamask will prompt you to sign.\n   \u003e Note: Make sure you are using the wallet that owns the parcels or has permissions.\n\n### Deploy to a free server\n\nIf you don't own parcels in Decentraland or are not ready to publish your scene to the world, you can share your creations by uploading your scenes to a free hosting service.\n\nSee [Upload a preview](https://docs.decentraland.org/development-guide/deploy-to-now/) for instructions on how to do this.\n\n## Resources\n\nLearn more about how to build your own scenes in our [documentation](https://docs.decentraland.org/) site.\n\nFind more example scenes, tutorials and helper libraries in the [Awesome Repository](https://github.com/decentraland-scenes/Awesome-Repository).\n\nIf you need any help, join [Decentraland's Discord](https://dcl.gg/discord), where you'll find a vibrant community of other creators who are eager to help. You're sure to find help in the #SDK support channel.\n\n## Copyright info\n\nThis scene is protected with a standard Apache 2 licence. See the terms and conditions in the [LICENSE](/LICENSE) file.\n\n## Acknowledgements\n\nCode here is an adaptation of [https://ercang.github.io/boids-js/3-boids-webworkers/](https://ercang.github.io/boids-js/3-boids-webworkers/)\n\n[https://github.com/ercang/boids-js](https://github.com/ercang/boids-js)\n\nBoidJS has standard MIT licence. See the terms and conditions in the [LICENSE](credits/LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdecentraland-scenes%2Fboids","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdecentraland-scenes%2Fboids","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdecentraland-scenes%2Fboids/lists"}