Friday, 21 September 2012

The Character that Died

Once upon a time there was a character that we had planed for the project.  It was a spirit of sorts that followed the mouse around and caused objects in its wake to follow.  I spent two days working on making this character follow the mouse in a fashion that looked cool.  On the third day I met with my team mates and we decided together that the character was no longer needed so my hard work was for naught and the character was dead.

Now I have implemented a fluid solver in its place.  The scene is split into a currently 24 by 24 grid.  When the mouse moves the solver figures out how the mouse effects the square it is in contact with and how the squares around it are effected by it.  Each square stores their velocity which then can be picked up by a sprite in contact with that square and use that to find its acceleration.

Unfortunately the only way to get the program to run at a sufficient speed is to reduce the framerate to 30.  I will  find out a way to reduce the number of times the solver runs with out reducing the framerate but for now this allows me to have something that actually works.

Well it did work until Ben suggested I change all the arrays into vectors.  Now the program only applies acceleration to sprites in the y-axis and only if the mouse passes over the sprite directly.  This means the diffusion of the mouse effect is not working and the calculation for the x velocity of the square is not being calculated.  I will fix this tomorrow when I try to combine the code for the fluid solver and Ben M. code for flocking, which I am extremely happy with how it look.

No comments:

Post a Comment