{"id":18286480,"url":"https://github.com/v0idzdev/boids-improved","last_synced_at":"2026-05-02T06:37:29.026Z","repository":{"id":39902834,"uuid":"494611337","full_name":"v0idzdev/boids-improved","owner":"v0idzdev","description":"My second attempt at implementing boids in P5.js.","archived":false,"fork":false,"pushed_at":"2022-05-22T15:49:56.000Z","size":536,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-15T00:45:55.975Z","etag":null,"topics":["boids","javascript","p5","processing","simulation","sketch"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/v0idzdev.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}},"created_at":"2022-05-20T21:28:45.000Z","updated_at":"2022-05-21T02:21:27.000Z","dependencies_parsed_at":"2022-09-13T13:41:16.323Z","dependency_job_id":null,"html_url":"https://github.com/v0idzdev/boids-improved","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v0idzdev%2Fboids-improved","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v0idzdev%2Fboids-improved/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v0idzdev%2Fboids-improved/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v0idzdev%2Fboids-improved/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/v0idzdev","download_url":"https://codeload.github.com/v0idzdev/boids-improved/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247989196,"owners_count":21029247,"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":["boids","javascript","p5","processing","simulation","sketch"],"created_at":"2024-11-05T13:20:33.196Z","updated_at":"2026-05-02T06:37:28.958Z","avatar_url":"https://github.com/v0idzdev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Boids\n\n## What are Boids?\n\n\"Boids\" is an **artificial life simulation** originally created by **Craig Reynolds** *(cs.stanford.edu, n.d)*, designed to imitate the flocking behaviour exhibited by birds. Boid behaviour is governed by three mathematical principles.\n\nThese are as follows *(Ben Eater, n. d)*:\n\n* **Cohesion**: Each boid flies towards other boids, gradually steering towards the average position of its neighbours. \n* **Separation**: Each boid tries to avoid running into other boids. If it gets too close to another, it'll steer away.\n* **Alignment**: Each boid tries to match the speed and direction of the other boids around it.\n\n## Examples\n\nHere are some examples from my implementation. If you'd like to learn more about boids, look at **[Sebastian Lague's video](https://www.youtube.com/watch?v=bqtqltqcQhw)** about them on YouTube. **I've added all of the websites**, **YouTube** videos, and **scientific papers** I used to create Boids in the **[references](#references)** section if you're interested.\n\n![image](https://user-images.githubusercontent.com/88111643/169629779-3da92622-704a-47ce-a591-5f317d8082c3.png)\n\n\u003e [Above] Boids abide by three rules: **separation**, **alignment**, and **cohesion**.\n\n![image](https://user-images.githubusercontent.com/88111643/169629804-14f9c2ff-5641-4030-8404-c98b27129066.png)\n\n\u003e [Above] As you can see, the boids aren't in one large group. This is because each of them has a **view radius**.\n\n## Running This Implementation of Boids\n\nYou can simply download this repository as a **.ZIP** file and open `index.html` in your preferred browser.\n\nHowever, when this is run directly, issues sometimes occur. I would recommend running this simulation using the following steps. Firstly, **clone the repository** and **navigate to the root directory** by running:\n\n```bash\ngit clone https://github.com/matthewflegg/boids-improved.git\ncd boids-improved\n```\n\nThen, if you have **Python** installed, run the following command. This will **serve the HTML file locally** using Python's built in HTTP server.\n\n```bash\npushd index.html\npython3 -m http.server 9999\npopd\n\u003cbrowser\u003e 0.0.0.0:9999  # Replace \u003cbrowser\u003e with your browser. For instance, `google-chrome`, or `firefox`.\n```\n\nIf you do not have **Python** installed, **run either of the following commands**, depending on your browser. If you use a different one than what's listed below, try and type its name in the same format:\n\n```bash\ngoogle-chrome index.html  # For Chrome users.\nfirefox index.html         # For Firefox users.\n\u003cbrowser\u003e index.html      # Replace \u003cbrowser\u003e with your browser.\n```\n\n## Am I Going To Develop This Further?\n\n**Yes, of course**! I'd really like to write some **[GLSL shaders](https://www.google.com/url?sa=t\u0026rct=j\u0026q=\u0026esrc=s\u0026source=web\u0026cd=\u0026cad=rja\u0026uact=8\u0026ved=2ahUKEwiO37LIwu_3AhVISkEAHRWkCIkQFnoECAwQAw\u0026url=https%3A%2F%2Fwww.khronos.org%2Fopengl%2Fwiki%2FOpenGL_Shading_Language\u0026usg=AOvVaw1MAt44nlQbnOwDcka6Fxx4)** as p5.js offers support for them via their **[WEBGL Rendering Context](https://p5js.org/reference/#/p5/WEBGL)**.\n\n## References\n\n*cs.stanford.edu. (n.d.)*. **Boids**. [online] Available at: **https://cs.stanford.edu/people/eroberts/courses/soco/projects/2008-09/modeling-natural-systems/boids.html**.\n\n‌*Ben Eater. (n.d.)*. **Boids algorithm**. [online] Available at: **https://eater.net/boids**.\n\n*Sebastian Lague. (n.d.)*. **Coding Adventure: Boids**. [online] Available at: **https://www.youtube.com/watch?v=bqtqltqcQhw** [Accessed 21 May 2022].\n\n*Sergio Abreu. (n.d.)*. **Boids - The Emergence of Flocks**. [online] Available at: **https://www.youtube.com/watch?v=pXQCasmBhY4\u0026t=247s** [Accessed 21 May 2022].\n\n*dante. (n.d.)*. **How do Boids Work? A Flocking Simulation**. [online] Available at: **https://www.youtube.com/watch?v=QbUPfMXXQIY\u0026t=101s [Accessed 21 May 2022]**.\n\n*http://www.cs.cmu.edu (2010)*. **Flocking and Steering Behaviors**. [online] Available at: **http://www.cs.cmu.edu/afs/cs/academic/class/15462-s10/www/lec-slides/Lecture24_flocking.pdf** [Accessed 21 May 2022].\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fv0idzdev%2Fboids-improved","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fv0idzdev%2Fboids-improved","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fv0idzdev%2Fboids-improved/lists"}