June 11th Bi-Weekly Update (Patreon)
Content
Worked on a lot of stuff and get some interesting things done!
I wanted to talk about a few different optimization things that I've been working on!First I worked on building out an optimized spawner for prop objects. As it stands the props are things that exist in the world, and while they don't tick, and don't do a lot clock cycle wise generally, they do take a bit of memory with all the associated assets. They also generate a lot of draw calls, as they are all different actors in the world. So if I've got a scene with a stack of like 6 barrels, and two boxes, that's 8 draw calls, which means slower game.Looking to kinda scale back on this, I've been working on building out a system so that I can replace those props with instanced meshes when they aren't active. This means I can reduce the draw calls to 1 for each type of prop, so the same 6 barrels and two boxes would be 2 draw calls.
Furthermore, until we actually NEED a prop, none of the associated assets, like sounds FX and explosions are loaded. Saving some memory.
And of course this is all compatible with the pooling stuff I was previously working on, so those used props that have been destroyed can be reused, and it saves garbage collecting and initializing things.
Then I was also looking at the materials on my characters. Not all of them are as bad as my heroine, but her materials are a little out of control.She has like 5 different materials depending on parts. I've managed to take the stuff I was working on with texture arrays, and apply it to Meridiana's skeletal mesh. Using some vertex coloring, I can tell the material which textures to use. This makes the footprint smaller, and reduces the draw calls. Its a pretty performant material as well. I imagine it will be more complicated as things go, but now I can make big changes to the character's appearance, and not have to worry to much about making the material way more complicated. I simple add to the array, and trigger a few properties. Won't even likely need material instances!
Overall I'm feeling pretty good about this optimization stuff, and I think it'll help make the next pass at things a whole lot cleaner!
Hope everyone has a wonderful week!