Advertisement

Simple Boids Problem

Started by May 09, 2010 07:47 PM
4 comments, last by IADaveMark 14 years, 9 months ago
I have tried to implement a boids algorithm into my current game, but am having some issues. When the boids code is removed the 100 objects draw to the screen fine, just static, but when I add the boids code they dont appear at all. Code is here: http://pastebin.com/MaVvdPyk
Have you checked what the positions are after moving the boids? Could it simply be that they're moving really far away from the camera really quickly?

Also there's no timing involved in your code; usually application of velocity looks something like:
position += velocity * deltaTime;
Advertisement
First question of self-sufficiency:

"Have you stepped through your code to see if your positions stay within drawable bounds?"

If you haven't stepped through your code during execution, then neither should we.

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

Quote:
Original post by Hodgman
Have you checked what the positions are after moving the boids. Could it simply be that they're moving really far away from the camera really quickly?

... by 22 seconds, Hodgman. 22 seconds.

Regardless, we are both asking the same thing.






Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

I followed your advice and stepped through my code and found the problem. The algorithm is wrong slightly and doesn't do what it should but the result at the moment is actually better for my purposes. Thanks for the help.
Aaaaahh... yet another victory of self-sufficiency.

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

This topic is closed to new replies.

Advertisement