For game development beginners after an accessible, high performance engine, Bevy is preferable. Those valuing flexibility across platforms and languages, or intending to dive into graphical applications, should opt for Raylib.

Comparison of Bevy and Raylib

Key Differences Between Bevy and Raylib

  • Language: Bevy uses Rust, valued for fast compilation and safety features, while Raylib is written in C99 known for cross-platform compatibility.
  • Focus: Bevy prioritises entity component system and game development. Raylib is targeted towards prototyping, embedded systems, education and tools development.
  • Community: Both have strong communities, but Bevy fosters more active community contributions.
  • Platform support: Bevy currently lacks Android support, unlike Raylib
Comparison Bevy raylib
Language Rust C (C99)
Main Focus 2D/3D Games Prototyping, Tooling, Applications
Platform Support Win, Mac, Linux, Web, iOS Win, Mac, Linux, FreeBSD, Android, Raspberry Pi, HTML5
Rendering Support 2D/3D 2D/3D
UI Functionality Yes Yes (raygui)
Audio Support Sound Loading Streaming (WAV, OGG, MP3, FLAC, XM, MOD)
API Stability Rust-dependent Stable
Community Discord, Subreddit, GitHub, Asset Collection Open Source Community
License MIT or Apache 2.0 Open Source
VR Support No (future plan) Yes

What Is Bevy and Who’s It For?

Built in Rust, Bevy is a data-oriented game engine tailored for both 2D and 3D applications. Chuck-full of features like 2D and 3D rendering, UI functionality, sound loading and hot reloading, Bevy targets users on all major platforms, spanning from Windows, MacOS, Linux, and the Web, with a future sight set on Android. Its modus operandi is built around the Entity Component System (ECS) paradigm, focusing on community contribution, continuous interaction and updates.

Bevy caters to a diversified user-base, from indie developers and technology enthusiasts to larger studios in the long run, offering a bespoke experience in terms of its offerings and functionality. With fast compile times and bytes ticking merely over 1MB for a “hello world” game, Bevy aims for seamless performance and efficient resource usage.

Colorful sketch of game developers collaborating in a tech start-up office

Pros of Bevy

  • Data-Driven Game Engine
  • Supports 2D and 3D rendering, UI functionality, and hot reloading
  • Fast compile time
  • Community oriented with a rich set of communication methods
  • Open Source & free licensed under MIT or Apache 2.0
  • Support for all major platforms

Cons of Bevy

  • Dependency on the Rust language may lead to API-breaking changes in new versions
  • No support for Android
  • No support for modern web standards such as wasm and webgpu

What Is raylib and Who’s It For?

Initiated by Ramon Santamaria in 2013, raylib is a dynamic, cross-platform framework developed in C99. Designed to facilitate game prototyping, tooling, graphical applications, and education in mind, it has a footprint that extends to operating systems like FreeBSD and Raspberry Pi. With inspiration from Borland BGI and XNA framework, it boasts over 50 language bindings.

raylib lays claim to a bevy of sophisticated features like a flexible material system, shader support, a capable math module, VR stereo rendering, and immediate GUI modules. Touted as intuitive and friendly, the power of raylib extends to teaching video game programming globally. It meets the user right where they are, whether at the stage of creating a weekend project or a complex gaming application.

Colorful image of a classroom with students learning video game programming

Pros of raylib

  • Comprehensive cross-platform support
  • Over 50 programming language bindings
  • Hardware accelerated with OpenGL
  • No external dependencies
  • Educational tooling for game development

Cons of raylib

  • Lacks the modern appeal of some of its contemporaries
  • Written in C, which may not be preferable for some developers
  • Interface could use an update

Code Examples for Bevy & Raylib

Bevy

In this beginner-friendly Bevy example, we will create a simple 2D sprite with a rotating motion. To run the code, Rust and Bevy engine should be installed on your system. In your Rust project, add bevy as a dependency in your Cargo.toml.

use bevy::prelude::*;

fn main() {
    App::build()
        .add_plugins(DefaultPlugins)
        .add_startup_system(setup.system())
        .add_system(rotate_sprite.system())
        .run();
}

fn setup(mut commands: Commands, asset_server: Res<AssetServer>, mut materials: ResMut<Assets<ColorMaterial>>) {
    commands.spawn_bundle(OrthographicCameraBundle::new_2d());

    let texture_handle = asset_server.load("branding/icon.png");

    commands.spawn_bundle(SpriteBundle {
        material: materials.add(texture_handle.into()),
        ..Default::default()
    });
}

fn rotate_sprite(time: Res<Time>, mut query: Query<(&mut Transform)>) {
    for mut transform in query.iter_mut() {
        transform.rotation = Quat::from_rotation_z(3.0 * time.seconds_since_startup() as f32);
    }
}

Raylib

In the following Raylib code snippet, we will create a bouncing colored shape on screen. In order for the script to run seamlessly, your system needs to be set up with raylib library, and the code snippet uses C programming language.

#include "raylib.h"

int main(void)
{
    const int screenWidth = 800;
    const int screenHeight = 600;

    InitWindow(screenWidth, screenHeight, "raylib [shapes] example");

    Vector2 ballPosition = { (float)screenWidth/2, (float)screenHeight/2 };
    Vector2 ballSpeed = { 5.0f, 4.0f };
    float ballRadius = 20.0f;

    SetTargetFPS(60);              

    while (!WindowShouldClose())    
    {
        ballPosition.x += ballSpeed.x;
        ballPosition.y += ballSpeed.y;

        // Collision logic
        if ((ballPosition.x >= (float)screenWidth) || (ballPosition.x <= 0)) ballSpeed.x *= -1;
        if ((ballPosition.y >= (float)screenHeight) || (ballPosition.y <= 0)) ballSpeed.y *= -1;

        BeginDrawing();

        ClearBackground(RAYWHITE);

        DrawCircleV(ballPosition, ballRadius, MAROON);

        EndDrawing();
    }
    CloseWindow();

    return 0;
}

Bevy vs Raylib: Your Veridical Verdict

In the titanic clash between Bevy and Raylib, technology enthusiasts find themselves in a conundrum. Each engine exhibits distinctive capabilities. Let’s dissect them for various audience segments:

Indie Game Developers

For indie game developers eyeing rapid development and cross-platform utility, Bevy shines bright. Its ability to hot-reload, subsequent fast compile times, and advanced 3D capabilities make it a robust choice. For this audience, Bevy offers a blend of speed, simplicity, and sophistication.a focussed indie developer unravels the potential of Bevy in creating immersive gaming experiences

AR/VR Innovators

For the pioneers in the AR/VR realm, Raylib emerges victorious. Raylib’s VR stereo rendering support, raycast system, shader support, and its versatility of bindings give it the edge in fabricating high-end, immersive experiences with ease.An innovative AR/VR creator explores the expanded potentials of Raylib

Educators and Learners

Educators and learners hungry for a user-friendly and aptly documented tool should decidedly opt for Raylib. Recognized globally for its utility in teaching video game programming, Raylib’s simplicity, binding-variety, and friendly OpenGL abstraction layer, rlgl, make it an ideal tool for learning.A learning enthusiast, delving into the depths of programming with Raylib

Summing it up, Bevy, an engine mirroring the present and future of game-making, shines for its speed, simplicity, and powerful set of features. Raylib, on the other hand, stands as a beacon for AR/VR innovators and educators, with an impeccable range of bindings and a beginner-friendly design. Rookie or veteran; enthusiast or educator – your choice between Bevy and Raylib hinges on your niche and ambition.

Patrick Daugherty

Content writer @ Aircada. Merging AR expertise with a love for late-night gaming sessions.