82 lines
2.9 KiB
HTML
82 lines
2.9 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<script type="text/javascript" src="../shared/jquery.min.js"></script>
|
|
<link rel="stylesheet" href="../shared/style.css">
|
|
<div id="site-header">
|
|
<script>$(function(){$("#site-header").load("../shared/header.html");});</script>
|
|
</div>
|
|
</head>
|
|
<body>
|
|
<h1>Boids</h1>
|
|
<section class="project">
|
|
|
|
<h2 id="info">Info</h2>
|
|
<div indented>
|
|
<p>Project type: C++ Simulation</p>
|
|
<p>Timeframe: 2022</p>
|
|
</div>
|
|
|
|
<h2 id="video">Video</h2>
|
|
<iframe
|
|
src="https://www.youtube.com/embed/h6zuPfniL2s?mute=1&loop=1&autoplay=1"
|
|
class="embed" youtube
|
|
></iframe>
|
|
|
|
<a class="internal" target="_blank" href="https://github.com/Scott-G-GD/boids-cpp">
|
|
<div class="github-block">
|
|
<div class="github-logo"></div>
|
|
<h2>Scott-G-GD/boids-cpp</h2>
|
|
</div>
|
|
</a>
|
|
|
|
<h2 id="product-overview">Product Overview</h2>
|
|
<p indented>
|
|
I worked on this for about week inspired by the lessons on steering behaviours at school.
|
|
</p>
|
|
|
|
<h2 id="project-overview">Project Overview</h2>
|
|
<p indented>
|
|
An implementation of boids in C++ with sfml.
|
|
</p>
|
|
|
|
<h2 id="code">Code</h2>
|
|
<div indented>
|
|
|
|
<h2>Boid</h2>
|
|
<div indented>
|
|
<p>
|
|
The boids themselves are primarily a position, a velocity, a mass, and a collection of behaviour function pointers. These boids are then stored in a vector and each of the behaviours is run for each of the boids, resulting in the demonstrated movements.
|
|
</p>
|
|
<div id="code-boids" class="code-content code-box">
|
|
<script>
|
|
$(function(){$("#code-boids").load("https://raw.githubusercontent.com/Scott-G-GD/portfolio-code-highlighting/main/boids-boids.html");});
|
|
</script>
|
|
</div>
|
|
</div>
|
|
|
|
<h2>Behaviours</h2>
|
|
<div indented>
|
|
<p>
|
|
As previously mentioned, the boids all store a collection of behaviours, represented by function pointers. These function pointers take as input a context object representing the program state at the start of the frame, and output a desired change in velocity. The original boids paper describes cohesion, separation, and alignment, so these are the main behaviours implemented.
|
|
</p>
|
|
<div id="code-behaviour-cohesion" class="code-content code-box">
|
|
<script>
|
|
$(function(){$("#code-behaviour-cohesion").load("https://raw.githubusercontent.com/Scott-G-GD/portfolio-code-highlighting/main/cohesion-boids.html");});
|
|
</script>
|
|
</div>
|
|
<div id="code-behaviour-separation" class="code-content code-box">
|
|
<script>
|
|
$(function(){$("#code-behaviour-separation").load("https://raw.githubusercontent.com/Scott-G-GD/portfolio-code-highlighting/main/separation-boids.html");});
|
|
</script>
|
|
</div>
|
|
<div id="code-behaviour-alignment" class="code-content code-box">
|
|
<script>
|
|
$(function(){$("#code-behaviour-alignment").load("https://raw.githubusercontent.com/Scott-G-GD/portfolio-code-highlighting/main/alignment-boids.html");});
|
|
</script>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</html>
|