Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For a few boids more - boids in Rust (Part 2) #4

Open
utterances-bot opened this issue Jun 14, 2020 · 6 comments
Open

For a few boids more - boids in Rust (Part 2) #4

utterances-bot opened this issue Jun 14, 2020 · 6 comments

Comments

@utterances-bot
Copy link

For a few boids more - boids in Rust (Part 2)

Let's have some fun with procedural graphics generation. We'll give life to a flock of birds by implementing the classic boids algorithm in Rust.

https://blog.bitsacm.in/for-a-few-boids-more/

Copy link

It would be good to utilize some rust functions rather than plain loops, like find.

@twitu
Copy link
Owner

twitu commented Jun 21, 2020

Thanks for pointing it out. I cannot change the blog without breaking stuff, but I've made an improvement to the latest version in d589d5f.

@pickfire
Copy link

pickfire commented Jun 22, 2020

Nice, that looks better. By the way, you could close this issue.

@twitu
Copy link
Owner

twitu commented Jun 22, 2020

Actually this issue acts like the comment section for the post, so it shouldn't be closed.

Copy link

CGMossa commented Jul 6, 2020

I've been following along and copy-pasting code.. I think after the add_objects_to_scene, I've no idea where what goes where and when.

Also, I'd love it if the code snippets where without scrolling and wide enough to show the entirety of the code?

Great post by the way.

@twitu
Copy link
Owner

twitu commented Jul 6, 2020

This might be confusing because of closely related names. Objects are meshes (with geometries) that are rendered on screen, while obstacles are "things" that are given to the physics engine to detect collisions. Both have the same shape so that the physics engine's calculations are consistent with what is happening on screen. The add_objects_to_scene registers objects in the game window, and create_obstacles simply creates obstacle and returns a reference to them. You should call both inside the main function, anywhere before the render scene loop.

All changes after that i.e. the ray casting stuff happens in the boid.rs file. Don't fret too much over this though, just download the version of the code tagged as stage_5 and continue from there. Seeing the code written together, rather than in bits and pieces will make it much easier to understand.

Sorry about having to side scroll the code snippets. I'll see if there's a way to make the font smaller but don't bank on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants