jyanar / boids Goto Github PK
View Code? Open in Web Editor NEWAn implementation of the Boids program using C++ and the SFML library.
License: MIT License
An implementation of the Boids program using C++ and the SFML library.
License: MIT License
With increasing number of boids the performance of this program drops significantly. Although FPS is not the perfect way to measure performance, here are some of my observations.
Release mode
Number of boids: 250
Avg FPS: 650
Memory usage: 30 MB
CPU usage: 29.9%
Number of boids: 1000
Avg FPS: 50
Memory usage: 31 MB
CPU usage: 23.7%
Now there are two problems here:
Note: These reading were taken on i5 9th gen + GTX1650 + 8 GB Ram
Unfortunately it doesn't seem to build :(
$ git rev-parse master
81d098d9b51fb0bb383cecad0af2b6ece945f671
$ make
g++ -c -g Boid.cpp
g++ -c -g Flock.cpp
In file included from Flock.cpp:2:
Flock.h:22:11: error: ‘Boid& Flock::getBoid(int)’ cannot be overloaded with ‘Boid Flock::getBoid(int)’
22 | Boid &getBoid(int i);
| ^~~~~~~
Flock.h:21:10: note: previous declaration ‘Boid Flock::getBoid(int)’
21 | Boid getBoid(int i);
| ^~~~~~~
Flock.cpp:20:7: error: no declaration matches ‘Boid& Flock::getBoid(int)’
20 | Boid &Flock::getBoid(int i)
| ^~~~~
Flock.cpp:14:6: note: candidate is: ‘Boid Flock::getBoid(int)’
14 | Boid Flock::getBoid(int i)
| ^~~~~
In file included from Flock.cpp:2:
Flock.h:14:7: note: ‘class Flock’ defined here
14 | class Flock {
| ^~~~~
make: *** [makefile:21: Flock.o] Error 1
Boid getBoid(int i);
returns a copy of the boid which makes it impossible change. If this was intended maybe adding a getter for both read only and read/write would be good.
should be:
Boid &getBoid(int i);
with the definition being:
Boid &Flock::getBoid(int i)
{
return flock[i];
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.