I recently found a bottleneck that was causing some slowdown in the game. I've been using a single flexible rig for humanoids which incorporates 2 arms, 2 legs (with extra back cantered versions), a tail, two possible head locations, hair, antennas, a cape, weapons hooks including animated bow, a helmet hook so helmets can be removed during a cut scene or special animation if needed as well as wings.
This is a very flexible rig, but it has a problem. Multiple inverse kinematics solvers, multiple copy rotation and location constraints and lots of redundant bones when used for most types of agent. For example bird men have wings and back cantered legs and use the lower head bones, but they don't use hair or capes. One the other hand humans use hair and capes, but not wings or tails.
With all those extra bones and constraints to calculate, animation time was double what it should be. Once you start adding a lot of enemies to the scene (more than 4) it results in a serious slowdown.
The solution is simple, duplicate the rig in to two rigs, then go through and prune the bones which are redundant in each case. The two rigs can continue to share the same animations, bones that don't exist a simply not calculated. The result is a noticeable improvement in frame rate under stress conditions.
I will keep the armatures combined for now. There are several extra animations to do for the game yet which can be shared as long as the rigs are combined. Once I split the rigs it becomes much more difficult for them to share an animation, which can increase my workload. Near to release I'll go a head and split the rigs to get the speed improvement.
In other news I'm reworking my map generation to make use of BSP trees, but keeping the tunneling corridors. I'm also adding a extra style of map which will use 4x4 rooms rather than the current 10x10 rooms. When generating a level the game will decide whether to use type A or type B rooms and will go on from there. The result will be two very different styles of dungeon. I already included flexibility about tile size in the dungeon generation and placement code when i was first writing it, so implementation shouldn't be too painful.
I'm considering keeping my old style "brute force" placement of rooms algorithm to be used as an occasional alternative to the BSP one. It does generate some interesting sparse tunnel like layouts, but I think I can get a similar result for tweaking the BPS generation to have more pruned branches. It would be better to have one flexible algorithm than two fixed ones.
This is a very flexible rig, but it has a problem. Multiple inverse kinematics solvers, multiple copy rotation and location constraints and lots of redundant bones when used for most types of agent. For example bird men have wings and back cantered legs and use the lower head bones, but they don't use hair or capes. One the other hand humans use hair and capes, but not wings or tails.
The humanoid armature.
With all those extra bones and constraints to calculate, animation time was double what it should be. Once you start adding a lot of enemies to the scene (more than 4) it results in a serious slowdown.
The solution is simple, duplicate the rig in to two rigs, then go through and prune the bones which are redundant in each case. The two rigs can continue to share the same animations, bones that don't exist a simply not calculated. The result is a noticeable improvement in frame rate under stress conditions.
The two armature types.
I will keep the armatures combined for now. There are several extra animations to do for the game yet which can be shared as long as the rigs are combined. Once I split the rigs it becomes much more difficult for them to share an animation, which can increase my workload. Near to release I'll go a head and split the rigs to get the speed improvement.
In other news I'm reworking my map generation to make use of BSP trees, but keeping the tunneling corridors. I'm also adding a extra style of map which will use 4x4 rooms rather than the current 10x10 rooms. When generating a level the game will decide whether to use type A or type B rooms and will go on from there. The result will be two very different styles of dungeon. I already included flexibility about tile size in the dungeon generation and placement code when i was first writing it, so implementation shouldn't be too painful.
The new 4x4 tile room prefabs.
I'm considering keeping my old style "brute force" placement of rooms algorithm to be used as an occasional alternative to the BSP one. It does generate some interesting sparse tunnel like layouts, but I think I can get a similar result for tweaking the BPS generation to have more pruned branches. It would be better to have one flexible algorithm than two fixed ones.
Comments
Post a Comment