Last stretch

The last week has been really frantic. Yesterday we finally did the dreaded merge of the master branch and the 3D branch. The 3D branch contained all of the new 3D graphics and changes in almost every single class to accommodate the new 3D graphics. I had added a new camera management and rendering system to allow each 2D physics object to also have a 3D representation with certain parameters (such as depth to allow for more shapes, a z-coordinate to allow us to offset the arms and legs in 3D, etc). This meant that anything that had a physics object had been changed, so the merge was tough. Lots of conflicts everywhere and it took quite a while, but in the end it went as smoothly as you can hope for something like that.

The last really big remaining issue was the crashes we were getting for seemingly no reason when creating a new physics body. As Box2D is a C-library and the crash happened in there, that meant complete JVM crashes. I got a hunch that the problem was caused by pooling in Box2D, in other words that the problem was caused by Box2D reusing body objects, which meant that we were most likely messing up the memory management of bodies somehow. And lo and behold, turns out some of the collision detection code was detecting multiple collisions for certain objects within the same update. When for example a destructible wall was touched twice at the same time, it would be deallocated twice as well, leading to the internal body pool in Box2D becoming corrupted. The next attempt to create a body would then have a risk of failing. I fixed that by adding a checks to prevent multiple deallocations, and a range of cryptic bugs were solved. We had another rare bug where a ball that kept being dropped would multiply due to the same issue; the ball would hit two things at the same time and therefore was respawned twice.

Also did the following during this week:
 - Wrote about 1.5 pages on our GDD, mostly on technical stuff as that's where my expertise lies.
 - Added a gradient background to the scene.
 - Added the last missing 3D models for the goal flag and the saw blade.
 - Added multisample anti-aliasing to the rendering to improve the look a look.
 - Fixed a menu-related bug.
 - Added some extra code to make sure all objects were correctly removed when moving to the next level.

It sure was a long week!

Comments

Popular posts from this blog

Today's work

3D graphics work