Tuesday, October 18, 2011

Post-IGF Deadline

What Happened

This past week has been challenging for a lot of developers across the nation as we all pushed to get ready for the IGF main deadline, and our team was no different. We were working a lot of hours these last few days, but unfortunately did not submit to the main competition.

Our internal deadline was Friday for a build; the goal was to use the weekend to test and debug the level before submitting it. Friday rolled in more quickly than I wanted, and I found that we weren't close to ready at all. I struggled with the decision to pull our entry: we didn't have a playable game and it would have been a waste of the $95 fee. Saturday night I reevaluated the progress and solidified the decision, and began notifying individual team members. A few agreed and a few didn't. I promised to stay the course and, if we managed to get something playable in time, we'd submit. We continued to work until Monday at 4pm (eight hours until the deadline) and got the game into a playable state! We rushed to the university to build; we can only build our game by using UAT's commercial license. In a sad, almost ironic situation UAT had re-imaged their machines and had not registered their copy of Unity 3D, rendering us unable to build in time. We reached out to a few others who may have been able to help, but it just wasn't in the cards.

What I Learned

As with every huge push, regardless of whether a goal is met, a huge amount of progress is made. We, as a team, also learned a great deal. Several game-breaking bugs had cropped up a few days prior to the deadline, and conquering them provided valuable technical knowledge that we can now share. The two biggest issues were a severe burden on the CPU that crippled our frame-rate, and a strange new error BEAST was throwing at me as I tried to bake lightmaps into the level.

Particle Systems

Currently our level is relying on a large number of separate particle systems used to simulate magic. We had originally designed a custom object that used an inverted cube (flipped normals) to contain moving particles. This granted us great control over the shape of the particle system without hardly any work. Unfortunately, once I started adding numerous variations and copies it became apparent that they were hamstringing our FPS. A quick look at our profiler showed 96% of our CPU load was dedicated to particle.update.

Brendan and I quickly set up a stress test room and determined that a particle system is actually pretty inexpensive: one draw call per and far less than a millisecond response time. What was killing us were our inverted meshes; each parented system had around 200-500 particles that were colliding and requiring the CPU to apply physics. Once we dropped this method and developed a mesh particle emitter (with systematic spawning) our frame-rate issue was solved!


The second issue was an error that BEAST was throwing that was along the lines of "You've exceeded the maximum of 254 lightmaps". Doing some research yielded precious little insight into what was happening. I couldn't believe our level was that big; I've seen other levels with exponentially higher numbers of lights and meshes being baked. Fortunately, Brendan had a hunch. Unity 3D's lightmapping system defaults to 1024x1024 sized maps, and although you can change them post bake, there isn't an option to do it pre-bake. Brendan wrote a simple editor script that allowed us to, and we experimented with both 2048 and 4096 sized maps, both of which solved our problem! Instead of trying to bake more than the maximum number, we increased the size of the map so more information was contained in each, and Unity happily started baking away. I now have another custom tool thanks to Brendan (I'm going to write a blog post on all of the awesome tools he's written for me someday).

What's Next

We're still on track to submit to the student competition, and with two weeks more polish I'm really excited to see what we can pull off. And this time we'll have a backup plan for building. I hoped to release our demo so everyone can play it, but I think we're going to wait until the 31st now.

No comments:

Post a Comment