Compile errors and warnings after migration to Bevy 0.15

Upgrading My Pong Game to Bevy 0.15: Challenges and Solutions

Over the past few weeks, I’ve been documenting my game development journey with the Bevy engine through a series of blog posts:

  1. Creating a basic Pong game
  2. Adding a UI using Bevy
  3. Adding a UI using EGUI
  4. Resolving UI issues in EGUI

While I shared the code for the first two articles on Github, the EGUI-related posts remained separate as they were built in an isolated project. This week, I tackled the challenge of merging these codebases, starting with upgrading my Pong Game to Bevy 0.15.

Major Challenges in the Upgrade Process

The upgrade process revealed three significant challenges:

1. Dealing with bevy_framespace Compatibility

The bevy_framespace plugin, which I previously used to control the game’s framerate and fix input delay issues, doesn’t support Bevy 0.15. Initially, removing the plugin seemed like a solution, but the input delay problem returned.

Thankfully, through discussions with Bevy developers, I found a simpler solution. Disabling VSync resolved the input delay:

    App::new()
        .add_plugins(
            DefaultPlugins.set(
                WindowPlugin {
                    primary_window: Some(
                        Window {
                            present_mode: PresentMode::AutoNoVsync,
                            ..default()
                        }
                    ),
                    ..default()
                }
            )
        )

2. Adapting to UI System Changes

The UI system in Bevy underwent significant changes. Here’s what I needed to update:

  • The Node struct now serves as both a UI element marker and replaces the Style struct
  • TextBundle is deprecated in favor of the new Text struct Text components now work with separate TextLayout, TextColor, and TextFont components
  • In-game scoring text now uses Text2d instead of the UI-specific Text component

3. Updating Mesh Implementation

The mesh system received a major overhaul. MaterialMesh2DBundle is no longer available as a component. The Mesh, Material and Transform are now added as seperate components to the same Entity.

These changes make the use of these components more flexible, but also required a significant amount of codebase updates.

Lessons Learned and Final Thoughts

Upgrading my Pong game to Bevy 0.15 took approximately two hours for my relatively small codebase. While the changes weren’t complex, they were numerous, and documentation was limited beyond the migration guide. For larger games, this kind of upgrade would require significant effort.

This experience reinforces Bevy’s warning about not being production-ready, as APIs can change significantly between versions. However, despite these challenges, I remain enthusiastic about both Rust and Bevy, and I’ll continue using it as my game engine of choice.

Code available on Github

I’ve now merged both projects and uploaded the migrated version to Github. You can find the complete, updated codebase in my repository.

Home » Upgrading My Pong Game to Bevy 0.15: Challenges and Solutions

Comments

One response to “Upgrading My Pong Game to Bevy 0.15: Challenges and Solutions”

  1. […] providing extra time, I’ve been focusing on improving my Rust and Bevy-based Pong game. After upgrading the repository to Bevy 0.15, I implemented several major enhancements to improve the game’s functionality and codebase […]

Leave a Reply

Your email address will not be published. Required fields are marked *