Announcing Amethyst 0.15.0

Published on Mar 24th 2020 by Azriel Hoh

The Amethyst team is happy to announce a new version of Amethyst, 0.15.0. Amethyst is a data-driven and data-oriented game engine aiming to be fast and as configurable as possible.

If you wish to use Amethyst in your application, simply add the following line to `Cargo.toml`:

[dependencies]
amethyst = "0.15.0"

What's in 0.15.0

Highlights of this release include:

  • Better panic messages on `stable` Rust.
  • Support for setting log levels from configuration.
  • Text field rendering corrections.
  • Target multiple overlapping UI entities with events.

See the detailed release notes for 0.15.0 to learn about other changes not covered by this post.

Better Panic Messages On Stable Rust

During development, it is common to run into the following panic message:

Tried to fetch a resource, but the resource does not exist.
Try adding the resource by inserting it manually or using the `setup` method.
You can get the type name of the missing resource by enabling `shred`'s `nightly` feature

Switching to nightly Rust and recompiling the application is cumbersome.

In Amethyst 0.15.0, the following message is presented on stable Rust:

Tried to fetch resource of type `MyRes`[^1] from the `World`, but the resource does not exist.
You may ensure the resource exists through one of the following methods:

* Inserting it when the world is created: `world.insert(..)`.
* If the resource implements `Default`, include it in a system's `SystemData`, and ensure the system is registered in the dispatcher.
* If the resource does not implement `Default`, insert it in the world during `System::setup`.

[^1]: Full type name: `module::path::MyRes`

As part of this change, the `"nightly"` feature is removed.

Support For Setting Log Levels

As applications get large, so does the amount of logging that is produced.

At times, developers may wish to enable debug logging, but only for specific modules. Previously to do this, developers had to set log levels in code, resulting in recompilation of the application:

amethyst::Logger::from_config(amethyst::LoggerConfig { .. })
    .level_for("amethyst_rendy", log::LevelFilter::Trace)
    .level_for("gfx_backend_metal", log::LevelFilter::Trace)
    .level_for("rendy_factory", log::LevelFilter::Trace)
    // .level_for("my_game::ui", log::LevelFilter::Debug)

In Amethyst 0.15.0, the `LoggerConfig` type implements `Deserialize`, so your application may read and initialize the logger from configuration:

LoggerConfig(
    level_filter: Info,
    module_levels: [
        ("amethyst_rendy", Trace),
        ("gfx_backend_metal", Trace),
        ("rendy_factory", Trace),
        // ("my_game::ui", Debug),
    ],
)

There isn't yet a minimal example for this, but this is used in the game, Will (main.rs, logger.yaml).

Text Field Rendering Corrections

Amethyst 0.15.0 correctly renders the text field caret and selection highlight.

Previously, the caret position and selection highlight for editable text fields were rendered with incorrect coordinates when the text contains white space:

Text field caret and selection offset by spaces

In this version, the rendering bugs have been corrected:

Text field caret and selection correctly rendered

Target Multiple Overlapping UI Entities with Events

Amethyst 0.15.0 supports sending UI events for overlapping entities.

Consider the UI in the recording below. The icons are UI entities, and thus they can react to UI mouse events -- hover, click, and drag. Previously, mouse events would only target the top-most `opaque` entity (greatest Z value), so while an icon is dragged over another, there would not be any mouse hover events sent for the eclipsed icon.

UI events target multiple overlapping entities

Notice that while dragging one icon over another, the eclipsed icon responds to the hover event by moving into an empty slot. This is made possible when an entity has a `UiTransform` component with the following values:

let mut ui_transform = UiTransform::new(..);
ui_transform.opaque = false;
ui_transform.transparent_target = true;

With these values, although the entity is not `opaque`, it is still targeted by mouse events. The mouse events will also pass through the entity to UI entities beneath it (having lesser Z value). The mouse events will not pass through an `opaque` entity.

Thus, in the recording, while one icon is dragged over another one, a mouse hover event is still sent for the eclipsed icon.

What's Next

We are actively working on WASM support, and hope to have something usable by the end of April.

To follow our progress, please see:

If you are interested in contributing, please check out the contribution guide!

💖 Contributors to Amethyst 0.15.0

We would like to thank all our contributors who were involved in making this release possible:

  • ab0v3g4me
  • Azriel Hoh
  • bors[bot]
  • Caitlin Potter
  • ⭐caitp⭐
  • Duncan
  • est31
  • Hayden Faulds
  • Justin LeFebvre
  • machine-hum
  • Milan Vaško
  • mrhatman
  • mvlabat
  • pseudoscalar
  • RichoDemus
  • saresend
  • shonenada
  • Zibi Braniecki