Some Bug Fixes and Library Refactor

I just completed a refactor of the TimelineFX library so it’s further along in terms of stability of code, ie., less chance of me making a lot of breaking changes. I mentioned in the last post what I’d be working on but here’s what I did:

  • Implemented my memory allocator for much cleaner memory management. A large memory pool is now allocated on initialisation and then sub allocated from. If the pool runs out of space then a new pool is automatically added. This of course can be overridden if anyone wants to use their own allocator instead.
  • I did a bunch of stress testing and optimised how the multithreading works. Before I was threading individual control particle jobs and spawn particle jobs regardless of what emitters they belonged to but it turns out that it’s a lot faster if you just assign a thread to each emitter. I think this works out a lot quicker because the threads can cache the emitter properties and attributes a lot easier rather then one set of particles are from one emitter and then suddenly having to work on another emitters particles whose properties are not cached.
  • Much improved consistency throughout the library. Because I like working in c I’ve made things much more c like but still using some useful things in c++ like function overloading and polymorphism for some functions where it makes sense.

I’m much happier with the overall structure of the code now and it will be a lot easier to add new features in the future.

Apart from that I just fixed a few bugs in the editor that I missed from the the renderer refactor. I also made an outline for future updates for the next couple of months:

Alpha 24

* Bounding boxes for effects both real-time and animation data. This is for library so effects not in view can easily be culled.
* Animation data and sprite sheets should update in a thread with a progress bar
* Stress test with massive animations

Alpha 25

* Key attribute/property shortcuts for emitters with extra notes about tweaking the effect/emitter
* Documentation with some tutorials

Alpha 26

* Compute shader for real-time particle updating

Alpha 27

* Paths as an emission type
* Paths as a translation for emitters and effects

Alpha 28

* Surface traversal

Alpha 29

* Line trails

Alpha 30

* Alternative pipelines for emitters for custom shaders.
* Post effects for Sprite Sheets but also for the preview window.

Then Mac version and beta release? Lets see!

Here’s all the changes in the latest version:

* Optimisations made to the library so that more speed gained from multithreaded processing.
* Memory allocator added to to library for much cleaner memory management (huge reduction in mallocs).
* Fixed frame size issues on the animation tab.
* Fixed some issues with deleting nodes on the graphs.
* Fixed a crash when changing single/amount properties with the sprite data tab open.
* Fixed a bug with changing sync refresh rate and view ports becoming distorted.
* Amount spawned is more accurate now when delta update time option is set.
* You can now move the effect position on the sprite data tab when no interpolation option is set.
* 2d zoom amount now applies to the sprite data tab.
* Seamless animation is now fixed for any effects that had stretched particles.
* Better handling for fixed update when the FPS becomes very low.
* Fixed crash when loading a library with the animation or sprite data tab open.
* Fixed masked drawing on the sprite sheet tab where the wrong shapes were being drawn.
* Checkered background will no longer draw on the animation tab if it’s not set in the options.
* The zoom and pan buttons on the graph work a lot better now.
* Improved how curve nodes on graphs get clamped to the edges of the graph.