Skip to main content

Animation bottleneck and map rewrites.

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.

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

Popular posts from this blog

Automating Level imports from Blender to Godot

  Recently I've been making some levels in Blender an importing them into Godot. There are only about 7 or 8 shaders for each level, not counting dynamic objects which will be added later. But to improve rendering performance, it can be a good idea to split the meshes up into sections. At that point you might be faced with a list like this: Or it might be even more chaotic, if you didn't use simple names for the objects in your level. So it can take a long time to sort out all the meshes, make them unique and add textures and so on. Blender imports with simple Blender textures, or with placeholder materials. This is sometimes OK, but if your Godot shaders are very different to those used by Blender, it means applying new materials to every mesh object in the level when you import the scene. I found that during the design process, I was importing and readying a level several times before I was happy with the final layout. So at first I was wasting a lot of time. In Blender, I us

Upstairs / Downstairs.

I've decided to make my prefabs multilevel. Later this should allow me to add pit traps and other great stuff. It also makes it easier to line up stairs so that you can exit them on the same co-ordinates where you entered them. The prefab editor is pretty much finished, it just needs some code for loading up prefabs from a saved dictionary, so that they can be checked or edited. The entries will need to be forwards compatible, so I'll be loading each tile and then translating the indexes to a new array, that way if I add extra indexes or extra info (like traps or puzzles) I'll be able to update existing prefabs to work with the new standard. Click for a video.

Advice needed on tilesets...

I need some advice on which is the best way to handle building the dungeon. Right now I'm using prefabs for my dungeon, they have a north south east and west section for each "room": The basic tileset. This has several advantages, and also several disadvantages. Firstly I can have curved rooms, I can have tunnels and other interesting shapes. The tilesets can look quite nice with a little work. On the other hand I can't easily get the navigation data before building the map and once the map has been built I can't make changes to the layout, like having active pit traps or believable secret doors. Although the rooms are interesting, they are quite repetitive, and it takes a lot of effort to make even a few different variations. Also rooms are constrained to one size. A newer version of the tileset with a lot of variant parts for making more interesting rooms. To create a tile set is a real headache too. Planning how to lay out the UVs, trying to cra