As mentioned in dev log 3 I was chasing a strange particle system bug for many days now. Watch the following video to get an idea why it was so annoying. Look at the boat’s exhaust fumes (the black dots) and the emission direction rendered as red line:

It looks totally wrong! The fumes don’t go along the red line but “swing” left and right. What the hell is wrong here?

My first intention was a failure in my own particle system orientation code. After absolving my code I started demonizing the SPARK particle library. Day after day I was decomposing the lib without success. Everything was right, nothing to blame.

Around dev log 4 I paused. Maybe some time off would give me new access to the problem.

Some days of fun & booze later I went on debugging. Reseting my mind did not help. There was still no answer. Until yesterday.

Question: How can something mathematically correct look so wrong?

Answer: You have to ask the right question. Try again!

OK: What do I expect to see? How should the particle emissions look like? How to falsify wrong results? What affects the particles?

Question: What are the parts of the expected particle emission model?

Answer: That’s the right question, young lad! You forgot to include the level scrolling and the boat velocity.

That was the problem. I started searching the bug too close to the base. Missing high level effects made the emissions look wrong. Humans tend to compare game physics with real life physics. Therefore I expected the level scrolling and boat movement to be included in the particle emission calculation. But they were not.

Lesson learned: Know what to expect from code before you judge it.

That’s it for this Wednesday. After this debugging odyssey I can go on with the fun stuff. Subscribe to Nordenfelt’s RSS feed or follow me on Twitter at @black_golem if you’re curious what the fun stuff is. 🙂