RedGem 3D Engine

Build 3D games in Ruby.

With Ruby, the most human-friendly language.

RedGem is a game engine with its own editor. Build your levels, write the gameplay in Ruby, press Play, ship it for Linux, Windows and Android.

Experimental. A young engine with rough edges, built on open source: Blender, Jolt Physics, raylib, mruby and more.

Scripting

Your game is Ruby classes.

Players, enemies, pickups, rules, HUD: each one is a behaviour you attach to objects. No bindings to write, no build step. Save the file and press Play.

  • Everything gameplay needs: input, physics, triggers and collisions, sound, on-screen text, loading levels, spawning objects.
  • Scenes set up in Ruby: one file says who drives, who walks and what spawns.
  • No require: a class loads the first time you use its name.
  • Errors don't crash the game: the failing behaviour is switched off and the backtrace goes to the console.
# scripts/player.rb
class Player < Behaviour
  SPEED = 6.0
  JUMP = 9.0

  def update(dt)
    move = Vector3.new(Input.axis(:horizontal), 0,
                       -Input.axis(:vertical))
    character.move(move.normalized * SPEED)
    character.jump(JUMP) if Input.action_pressed?(:jump) &&
                            character.grounded?
  end

  def on_trigger_enter(other)
    return unless other.tag?(:coin)

    Audio.play(:coin)
    GameManager.instance.collect_coin
    other.destroy
  end
end
# scripts/main_scene.rb
class MainScene < SceneScript
  SPEEDS = { "Slime" => 1.5, "Bat" => 4.0 }

  def setup
    find!("Hero").add_component(Player)
    Camera.main.add_component(CameraFollow)

    SPEEDS.each do |name, speed|
      enemy = find!(name)
      enemy.add_component(Patrol, speed: speed)
    end
    find_all(:coin).each { |c| c.add_component(Spin) }
  end
end

Scenes

The level says what is there. Ruby says what it does.

Levels are plain glTF files, built in the editor or exported from Blender. A scene script attaches behaviours, sets their parameters and spawns copies, so the whole game stays in one language.

Made with RedGem

One engine, different games.

These demos ship with the engine, scripts and tests included. Each is a small game or scene built to exercise a different part of it.

A third-person platformer with coins and floating platforms
Platformer. Run, jump, push crates, ride moving platforms, collect every coin and reach the flag.
A car on a track with a lap timer
Time trial. A car with real wheel physics, checkpoints in order, lap and best times.
A low-poly crossroad with traffic
City crossroad. Cars that obey traffic lights and brake for each other.
Driving a red car through traffic on a detailed street
Street at dusk. A stress test for the renderer: drive through traffic, a crowd and falling leaves.

Editor

Build, script and play in one window.

Scene view with gizmos, hierarchy, inspector, Ruby tabs that split side by side, a console with backtraces, and a Play button that runs the game right where you are editing.

The RedGem editor with a scene and a Ruby script open
Scene, inspector and Ruby side by side
The game running inside the editor next to its code
Press Play: the game runs where you edit it

Features

What is in the box.

Gameplay

Keyboard, mouse and gamepad, triggers and collisions, timers and tweens, particles, sound and music, saved progress, level loading, spawning from templates.

Multiplayer

Games on the same network find each other; over the internet, players meet in a room by a short code, through a relay that ships with the engine. Scripts talk in named messages, and objects stay in sync across machines.

Menus and HUD

Buttons, images and text drawn from Ruby; pause the game with a menu on top. A title screen, pause and end screen ship with the template.

Rendering

PBR materials, sun shadows, reflections, ambient occlusion, bloom, fog, color grading and speed blur.

Terrain

Ground you sculpt in the editor with a brush: raise, lower, smooth, flatten. Collisions follow its shape.

Physics

Rigid bodies, character controllers, vehicles with wheels, triggers and raycasts.

Animation

Skeletal animation from glTF, GPU skinning, a clip per character with fades and mixing, crowds of copies out of step with each other.

Blender pipeline

Model and lay out levels in Blender; custom properties carry gameplay data into the game.

Testable games

System tests are Ruby scripts that play the game frame by frame and take screenshots.

Builds for Linux, Windows and Android

One click makes your game a Linux binary, a Windows .exe or an Android .apk, all built from Linux. On a phone, touch controls appear by themselves.

Workflow

From a model to a game.

Model

Build the level in Blender and export it as glTF, or drop models into the editor.

Script

Write behaviours in Ruby in the editor's tabs, or in your own editor.

Play

Press Play: the game runs in the scene view with your latest edits.

Ship

Build for Linux, Windows or Android and share it.

Built with

Standing on open source.

RedGem was not built from zero. It is C++17 glue and tooling around these projects, and would not exist without them. Thank you to the people behind them.

ProjectUsed forLicense
BlenderModeling, level building and the scene exporterGPL
Jolt PhysicsRigid bodies, characters, vehicles, raycastsMIT
mrubyThe Ruby interpreter that runs game scriptsMIT
raylibWindow, input, OpenGL rendering, audiozlib
cgltfLoading glTF scenesMIT
Dear ImGuiThe editor's interfaceMIT
rlImGuiDear ImGui on raylibzlib
ImGuizmoMove, rotate and scale gizmosMIT
nlohmann/jsonglTF JSON and settingsMIT
doctestC++ testsMIT
Inter, JetBrains Mono, Font Awesome FreeFonts and iconsOFL

Demo assets: Kenney, Poly Haven and ambientCG (CC0); the showcase car and scanned people come from BlenderKit.

How to install

Download, unpack, run.

Nothing to install. RedGem is experimental and free, under the MIT license.

Linux

x86_64, OpenGL 3.3, Ubuntu 24.04 or newer. The tested one: builds games for Linux, Windows and Android.

Download for Linux

Windows

x86_64. Compiled from Linux and only tried under Wine so far: tell us what breaks. Builds games for Windows.

Download for Windows

1. Unpack

Anywhere you like. To remove RedGem, delete the folder.

2. Run

bin/redgem on Linux, redgem.exe on Windows. The project hub opens.

3. New game

Pick Platformer, give it a name: the editor opens with a level ready to play.

4. Play

Press Play. Move with WASD, jump with Space. Then open a script and change it.

The source is on GitHub: issues and small pull requests are welcome, and the known limitations are a good place to start.

Prefer to build it yourself? You need a C++17 toolchain, CMake and Ninja; every library is downloaded at a pinned version. The manual has the details, Docker included.

git clone https://github.com/carlosdanielpohlod/redgem.git && cd redgem
cmake -S . -B build -G Ninja && cmake --build build
./build/src/redgem                        # project hub
./build/src/redgem new my_game --template platformer