Home Artists Posts Import Register

Content

I'm still in the middle of a large optimization pass and I've learned a few things since my previous post. The conclusions I reached regarding the speed of scene instantiation in Godot were kind of wrong but sort of right. Technically the tweet I linked to in the last post is correct but it's a bit misleading in my opinion because:

  • The actual scene instantiation process may be pretty fast but in the vast majority of cases the first thing you are going to do immediately after instancing a Godot scene is add it to the tree, at which point a bunch of initialization routines are run. So the performance of the operation as a whole depends on what initialization has to happen.
  • If there's a Viewport node anywhere in the subscene, even a small one, then scene instantiation takes a lot longer, I guess because allocating the GPU memory is slow. In Blockhead uses sub-viewports for various rendering operations and some of it happens on a per-block basis.

One thing I am in the middle of doing at the moment is moving the entire choke editor (the fade-in/fade-out/level envelope controls) out of the blocks and into a single place, so instead of every block having its own choke editor there will just be one which will be reused for all blocks. This won't change the way anything looks because Blockhead already automatically closes a block's choke editor as soon as you click outside of it.

Godot has two rendering backends, GLES2 and GLES3. Up until now Blockhead has been using the GLES2 backend because it allows me to support much older computers and there was no real need to use GLES3. I am planning to switch blockhead over to GLES3 instead, which means an increase in hardware requirements from OpenGL 2.1 to OpenGL 3.3. OpenGL 3.3 is still a pretty old API so if your computer's graphics device was manufactured at any point in the past 10 years then it is most likely good enough. I think the GLES2 backend is generally intended for use when targeting mobile devices which I'm not concerned about.

I'm making this switch because it allows me to write some of the shaders in a way that will be both simpler and more efficient. For example blocks with an active choke envelope each have to render a curve which overlays the block background. The shader I originally wrote for doing this isn't great because it just recalculates the entire curve whenever the block has to be redrawn. Now i'm generating the curve once at a fixed resolution whenever it changes and just reading from the resulting image in the shader. This is technically possible with the GLES2 backend but not as efficiently and not without some ugly precision issues.

Optimization is very boring but I think i'll probably be done in a week or so and hopefully things will feel a lot smoother while working with lots of blocks.

Comments

No comments found for this post.