Optimisations and stability

A long overdue post, but rest assured, lots of work has been done over the last couple of months!

Optimizations of the TimelineFX Library

Firstly, for most of December, I did a big refactor of the TimelineFX Library, not just to optimize it but also to open the door for a lot more optimizations in the future. This had two main steps:

I transitioned all the data for updating effects, emitters, and particles to “structs of arrays”. Without going into too much technical detail, this makes it a lot easier to parallelize updating the particles. The problem with storing all the data in an “array of structs” format is that if you only want to update, say, the position of the particle, you have no choice but to load in a bunch of particle data that is unrelated to that specific update. So you end up loading things from memory that you don’t actually need. But with a “struct of arrays,” you can be more precise about the data that you’re loading and updating, making it easier on the cache lines and cache usage of the CPU.

The second part of the refactor was to add multi-threading. This had a number of challenges, especially when it comes to depth-ordered particles, but in the end, I’m quite happy with the results. Worth noting also that the “struct of arrays” approach made this a lot easier to achieve.

What this means for future optimizations is that it will now be much easier to implement SIMD to really start to see some speedups! This will be something that I’ll be looking to do very soon, but will probably tackle the API side of the library first to make it as easy to use as possible.

Making use of new Test Suite in Dear ImGui

The user interface library that I use, Dear ImGui, recently released a new test suite where you can set up tests in your application to test all the various features of it. So I spent most of January/February setting up more than 160 tests, which will help a great deal with stability. Before, I just had a checklist to tick off before each release, which was both tedious and prone to missing lots of issues. Now, I can automate all of the tests, which I hope will make things a lot more stable in the future.

Test suite running in TimelineFX editor

Test suite running in TimelineFX editor

Note: The test suite isn’t available in the release version of TimelineFX, it’s just something I’m using to test things to make sure I haven’t broken anything before each release.

Here’s the full list of all updates in this version:

* TimelineFX library got a big optimisation update including multithreading.
* On the first run of TimelineFX the number of threads to use will be based on the total cores available.
* Angle transform graphs now named properly.
* Multiple crash bugs fixed.
* Added over 165 tests for every feature of TimelineFX to help catch bugs and improve stability for all future versions of TimelineFX.
* Added string for history when changing align to camera and vector.
* Matching the end node to start value on the graphs now correctly adjusts the curve as well
* Changed the icon for Effect Properties
* Opacity Graph renamed to Blendfactor
* Improved UX for changing emitters when the graph tab is open.
* Added some tooltips for the tool bar options on the Animation Tab.
* Fixed issue when saving and animation to multiple files and the file path has more then 1 “.”.
* Adding a sub effect no longer converts to 3d when it shouldn’t.