Mechropolis: nearing completion
|
We are nearing the first finish-line for Mechropolis, namely Gotland Game Conference 2014. I dare to say though that we are quite behind schedule, or at least behind our initial estimates. Nevertheless we are adamant about having a proper version ready for GGC and without doubt will we reach a presentable product.
KeybindingsThe work of this week is mostly related to more menu functionality (keybindings) and some trivial bug fixes. Suprisingly, NGUI does not provide a keybinding script for an input field so I had to write my own. It was fairly easy though; using Unity’s Event class you can pull arbitrary keyboard and mouse input per frame with Event.current.keyCode and Event.current.button , however Event.current is only populated in void OnGUI() but it is just a matter of wrapping that function. Keybindings as of now are postponed since other features are prioritized. It is highly unlikely that keybindings are required for GGC anyway as main gameplay is in focus. I also do not know if it is possibly to sample arbitrary joystick input without setting up all possibilities in the input manager, but I realized that having a configurable joystick setup would be wonky and probably not worth the effort. As such we decided (at least for now) that the joystick is not re-bindable. Frustum culling for animationsA peculiar behavior I found was that Unity does frustum culling not based on polygons (as I thought) but rather by their bounding box, which makes sense performance wise. The reason I thought otherwise was that objects does not cull until fully occluded but now I realize the entire mesh is still drawn, even the portions offscreen. The case where this caused initially unexpected behavior was with animated meshes. Apparently, the bounding box is static and does not follow animation, which caused Vale’s hands to suddenly disappear given certain camera angles (particularly around the pitch [up/down] axis). The reason was that the initial bounding box (hands straight down) came out-of-bounds of the camera frustum. There are basically two options to fix this; manually override and increase the size and offset of the bounding box to encompass all possible animations, or tick a checkbox “Update When Offscreen” in the skinned mesh renderer. I choose the checkbox just for simplicity and what it does is that it re-calculates the bounding box every frame to correctly represent the mesh. I believe that this feature should be used sparingly but that it was appropriate and acceptable for this situation. |