Feature Update (v0.1.16)

This week, we had a migration to the new version of Bevy 0.14, and will be able to reap the benefits of this new version. The new version did break some things in our game code, but we managed to fix them.

This week, a new version of Bevy landed (0.14) with a lot of awesome features. With that, though, our attention shifted to migrating our codebase to this new version.

Migration to Bevy 0.14

For Untold Dawn, migrating to Bevy 0.14 was not as automatic as other versions have been. Our method to save the world had a vital functionality deprecated, so we had to figure out a solution to it.

This took a good half of the week, but eventually it was fixed.

There were also changes related to how we were operating out legacy commands that we had to go in and manually modify.

Bevy 0.14
Bevy is a refreshingly simple data-driven game engine built in Rust. It is free and open-source forever!

So most of our week was taken migrating to Bevy 0.14 and we had pretty much five days where our code would not compile unless it was on 0.13.

Being a game that is on an experimental game engine, one of the biggest benefits is the new features that it throws!

Thankfully, the migration is now complete.

Sadly, unless I dive into technical details of what exactly the migration entailed, there's not a lot to show this week!

However, I wanted to use this post to review some of the notable things that Bevy 0.14 will give us.

Benefits of 0.14

Hooks & Observers

Bevy 0.14 introduces Component Lifecycle Hooks and Observers: two complementary "push"-style mechanisms.

We had been using a function that would iterate over added, removed and changed objects; however, component hooks are a much better way of handling this kind of logic. This was mostly being used for saving components to the database; this is something we will need to start modifying, since the Bevy maintainers have already stated a desire to move away from the old system in the future.

There is also a new trigger system that will likely replace a lot of our events in the near future.

Query Joins

Bevy 0.14 has added a system to join queries (an inner join). This is going to be likely useful for us, since being a MUD our queries can get quite unwieldly. Having the ability to just combine two will be useful.

Computed States

States are a Bevy functionality that allows you to define global states for the world. Normally, you modified these states manually with some sort of trigger. Now, they can be computed automatically!

This will likely be used for the time of the day, and we'll move it to that format, using the same functionality that determines the time.

State-Scoped Entities

Bevy also adds state-scoped entities. These are entities that only exist while a particular state is active, before getting deleted when that state is gone.

This is a pattern that could be useful during procedural generation, or when wanting certain elements to exist only in a particular point in time (i.e. if we ever make a virtual reality game while the game is running). But right now we do not have a specific use for it. Nevertheless, useful resource to have.

Query Sorting

Queries in Bevy 0.13 were difficult to sort. We have a lot of areas where we need to make a separate vector for it.

With Bevy 0.14, they have implemented a lot of functionality around sorting queries, including queries to sort queries. For example, if you wanted to order players by who is admin and who is not, or by AFK time (i.e. for the WHO list).

Conclusion

Bevy 0.14 represents a positive update in the toolset that Untold Dawn has at its disposal. As foreseen when we picked the game engine, we expect its ECS to keep evolving for us to be able to do even more interesting things in the future.

While migrations are and will always be painful, especially as the time goes by, managing them the way we did this week will be key to keeping our game modern and performant.

256 contributors worked on these and more changes. While many of the changes also pertain to the graphical rendering part of Bevy (since it is a game engine after all), we will benefit from their work into the ECS and game lifetime systems that we've hooked to.

Very excited to be able to use these new functionalities!