October 15th: Rain

Okay I figured out what was causing problems with my particles, and it turned out not to be a rendering issue at all. In fact, it was the combination of two bugs, one of which wasn’t really a bug and the other was a weird Haxe thing.

The first issue was something that I actually fixed, an issue with a whole bunch of particles sharing timing info causing them to be updated at the wrong speed. I fixed that, but failed to update the particle effects speed values to something that worked with the new system, so they actually just moved so fast they disappeared off the screen on the first frame. However, if everything else worked right this would have manifested as flickering as the particles quickly despawned and respawned:

However, there was also a problem in the behavior system that made it so they weren’t properly respawning, which was caused by a peculiarity in Haxe’s system of for loops. In most cases, using ‘for (x in container) x.doThing()’ causes it to iterate through and call doThing() on each object in the container. However, when using a basic type such as Float this apparently does not work, likely because it copies the values rather than modifying them by reference, though I haven’t checked to be sure.

Once I changed the x and y velocity values to something more moderate and I changed the ‘for (f in mBehaviorTimers) f += time;’ loop into ‘for (i in 0…mBehaviorTimers.length) mBehaviorTimes[i] += time;’, everything seemed to work FINE. So yay.


About problemmachine

What is the nature of your problem? Can we modify the nature of your problem? Can your problem be touched? Eaten? May we eat your problem for you? May we eat your soul for you? Would you like a replacement problem? We make problems. We eat souls. We crap solutions. We are Problem Machine.
This entry was posted in Daily Update, Programming. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s