November 2, 2020

Arsenal Development: Week 4 - Lock Free Dynamic Queries

Arsenal Week4.png Arsenal Week4.png Micro Thumbnail

Another week of Arsenal development! This week were able to establish lock free dynamic queries on top of the latest improvements in Bevy.

Recently @cart, the author of Bevy, merged some great improvements into Bevy's query system. These improvements not only made the Rust API nicer for game developers, but also had a great positive impact on the performance of queries, all while simplifying the code!

Because our dynamic systems PR dealt closely with the query system we had to adapt our changes to work with the updated Bevy queries. The good news is that we can borrow from these performance improvements too!

With the extra simplification of the Query iterators that came with @cart's changes, we were able to build our dynamic queries on top of the existing query system without over-complicating it. This means that instead of having to maintain two query implementations, one for dynamic queries and one for static queries, we should be able to use one implementation for both and allow both use-cases to share in the performance improvements.

This refactor meant we had to spend a little extra time on the dynamic queries, but the improvements have resulted in an overall better design. @cart said that he will be looking into our PR after he releases Bevy 0.3, at that point we'll address his review and hopefully get this thing merged!

What's Next

For this week I'm going to start by cleaning up some of the mess left in the dynamic query implementation after the latest refactor. Once I get that nice and clean I'll resume work on the scripting implementation for the Arsenal Runtime.

The first experiment for Arsenal scripting will be to create bindings to Bevy's transform components. These bindings are written in Rust and will integrate with the scripting system to create a language agnostic interface. Then we will create a Python language adatper, also written in Rust, which will connect to those bindings and allow you to query and mutate the transforms of objects in a Bevy game.