A downloadable game engine for Windows, macOS, and Linux

Buy Now$48.00 USD or more

DragonRuby Game Toolkit is a commercial-grade, yet beginner-friendly, 2D game engine. It's tiny (~3MB), fast as hell, and cross-platform. The Standard License (this page) is a one-time purchase and includes support for PC, Mac, Linux, Raspberry Pi, and Web. 

Made for Indie Game Devs that want a powerful game engine that's royalty-free, fast, productive, and easy-to-use.

UpdatedJul 4, 2024, Total releases (so far): 181
InceptionApr 19, 2019
StatusReleased
CategoryGame engine
PlatformsWindows, macOS, Linux, Raspberry Pi
Rating★★★★★(307)
AuthorDragonRuby
Tags2DdragonrubyGame engineModdableruby

Tech Demo

Here is what's possible with just a Standard license. 


Tour and Tutorial

Ryan put together a 5-minute intro to DragonRuby, to give you a whirlwind tour of the big ideas.

Try the Samples (150+ included in the download).

Features

  • Dirt simple, data-oriented APIs capable of creating complex 2D games.
  • Fast as hell. Powered by highly optimized C code written by Ryan C. Gordon, one of the juggernauts behind SDL (the tech that powers thousands of games, triple-A game engines, and the Steam client).
  • Battle-tested by Amir Rajan, a critically acclaimed indie game dev with titles built with DragonRuby on mobile and the Nintendo Switch.
  • Tiny. Like really tiny. The entire engine is a few megabytes.
  • Hot loaded, real-time coding, optimized to provide constant feedback to the dev. Productive and an absolute joy to use.
  • Turnkey builds for Windows, macOS, and Linux with seamless publishing to Itch.io.
  • Cross-platform: PC, Mac, Linux, Raspberry PI, Web, iOS, Android, Nintendo Switch, XBOX One, and PS4 (mobile requires a Pro License, and console compilation requires a business entity, and NDA verification; contact us at support@dragonruby.org for more info).

The Standard license is a one-time/lifetime purchase. Indie and Pro licenses are subscription-based but come with some incredibly powerful features.

Free Unrestricted License

You are eligible for a free license if any of the following items pertain to you:

  • Your income is below $2000 (USD) per month.
  • You are under 18 years of age.
  • You are a student of any type: traditional public school, homeschooling, college, boot camp, or online.
  • You are a teacher, mentor, or parent who wants to teach a kid how to code.
  • You work/worked in public service or at a charitable organization: for example public office, army, or any 501(c)(3) organization.

Just contact Amir at ar@amirrajan.net with a short explanation of your current situation and he'll set you up. No questions asked. 

Standard Features                                                                     
MacOS
Windows
Linux/Steam Deck
Raspberry Pi
Web Builds
In-Game Web Server
Portrait Mode
Sound Synthesis
Pixel Arrays
Itch.io Distribution: Streamlined
Steam Distribution: Steamworks CLI
Purchase Standard
Indie Features
All features from Standard
Steam Distribution: Streamlined
C Extensions
Bytecode Compilation
Triangle Primitives
Purchase Indie
Pro Features
All features from Indie
iOS Distribution
Android Distribution
HD Mode
All Screen Mode
MP4 Replay Export
Oculus Quest VR Mode
Purchase Pro


Hello World is one file, three lines.

This is all you need to create a game. One file. One method called tick. Here we render the current step value as a label:

def tick args  
  args.outputs.labels << [100, 100, args.state.tick_count]
end

That's it. If you know how to use the array datatype in any language, you know everything needed to get started with DragonRuby Game Toolkit. Play around with the engine in your browser.

You can skim our documentation here if you need more details.

Output: Six rendering primitives are all you need.

Here are the six draw primitives you need to know: solids, sprites, labels, lines, borders, and sounds. Here is how you use them:

def tick args    
  # draw a blue square that's half way faded out
  args.outputs.solids << [100, 100, 50, 50, 0, 0, 255, 128]
  
  # draw a red label
  args.outputs.labels << [100, 100, "This is a label.", 255, 0, 0]
  
  # draw a sprite turned 45 degrees and half way faded out
  args.outputs.sprites << [200, 200, 50, 50, 'ninja.png', 45, 128]
  
  # draw a diagonal green line from bottom left to top right
  args.outputs.lines << [0, 0, 1280, 720, 0, 255, 0]
  
  # draw a black border (unfilled square)
  args.outputs.borders << [100, 100, 50, 50, 0, 0, 0, 255]
  
  # play a sound every second
  args.outputs.sounds << "ping.wav" if args.state.tick_count % 60 == 0
end

That's it. You now know the entire render API for DragonRuby.

Here's a more complicated example. This is how you create a nighttime scene, with a title, and a ninja:

  1. solids: A black background, and two hundred stars made of tiny squares.
  2. labels: Display some smokey-white text.
  3. sounds: Play a sound when the game starts up.
  4. sprites: Render a sprite on the screen.
  5. lines: Draw a line representing the floor
  6. borders: Frame the entire scene with a white border.
def tick args  
  # destructure args into local variables  
  state, outputs, grid = args.state, args.outputs, args.grid  
  
  # set some default values for the game  
  state.colors.background ||= [0, 0, 0]  
  state.colors.star       ||= [128, 200, 255]  
  state.colors.text       ||= [200, 200, 200]  
  state.colors.landmarks  ||= [255, 255, 255]  
  state.night             ||= [grid.rect, state.colors.background]  
  state.stars             ||= 200.map do
    [rand * grid.w,
     rand * grid.h,
     rand * 2 + 2,
     rand * 2 + 2,
     state.colors.star]
  end
  
  # start up some background music
  outputs.sounds  << "opening_fx.wav" if state.tick_count == 0
  
  # render the background and stars
  outputs.solids  << state.night
  outputs.solids  << state.stars
  
  # set a title for the game
  outputs.labels  << [grid.left + 50, grid.top  - 50,
                       "Ninja Game", state.colors.text]
  
  # set a sprite
  outputs.sprites << [50, 50, 50, 50, 'ninja.png']
  
  # create a line that represents the ground
  outputs.lines   << [grid.left,
                      grid.bottom + 50,
                      grid.right,
                      grid.bottom + 50,
                      state.colors.landmarks]
  
  # create a border to frame the game
  outputs.borders << [grid.left + 1,
                      grid.bottom + 1,
                      grid.right - 1,
                      grid.top - 1,
                      state.colors.landmarks]
end

Input: Controllers, Mouse, and Keyboard.

This is how you move a sprite using your gamepad:

args.state.ninja.x ||= 100
args.outputs.sprites << [args.state.ninja.x, 300,
                         50, 50,
                         'ninja.png']
if args.inputs.controller_one.key_held.right
  args.state.ninja.x += 10
elsif args.inputs.controller_one.key_held.left
  args.state.ninja.x -= 10
end

This is how you move a sprite using your mouse:

args.state.ninja.x ||= 100
args.outputs.sprites << [
   args.state.ninja.x,
   300,
    50,
    50,
    'ninja.png'
]
if args.inputs.mouse.click
  args.state.ninja.x = args.inputs.mouse.click.point.x
end

This is how you move a sprite using your keyboard:

args.state.ninja.x ||= 100
args.outputs.sprites << [
  args.state.ninja.x, 300, 50, 50,
  'ninja.png'
]
if args.inputs.keyboard.key_held.right
  args.state.ninja.x += 10
elsif args.inputs.keyboard.key_held.left
  args.state.ninja.x -= 10
end

Game State: Entities and Collision.

Randomly create 500 ninjas on the screen. Create a lookup table that contains the alpha property of ninjas that have collided. Present all ninjas with their alpha properties set.

def tick args  
  # destructure args into local variables
  grid, state, outputs = args.grid, args.state, args.outputs
  # use Game Toolkit's built in helper methods to create
  # adhoc entities
  state.ninjas ||= 500.map do
    state.new_entity(:ninja,
                     rect: [grid.w.-(50) * rand,
                            grid.h.-(50) * rand,
                            50,
                            50])
  end
  # use Ruby's powerful apis to determine collision
  state.collisions ||= state.ninja
                            .product
                            .reject { |n, n2| n == n2 }
                            .find_all { |n, n2| n.rect.intersects_rect?(n2.rect) }
                            .map { |n, _| [n.entity_id, 128] } 
                            .pairs_to_hash
  #render everything to the screen
  outputs.sprites << state.ninjas.map do |n|
    [n.rect, 'dragonruby.png', 0,
     state.collisions[n.entity_id] || 255]
  end
end

The developers behind DragonRuby Game Toolkit.

This is Ryan C. Gordon (Wikipedia), he is one of the juggernauts behind Simple DirectMedia Layer (Wikipedia). 

Ya know... 

SDL.

That low-level library that powers thousands of games, Triple-A game engines, and Valve's Steam client? 

He's also worked on porting a number of games to Linux and Mac OS: such as Braid, Super Meat Boy, Dear Esther, and LIMBO.

And this is Amir Rajan, he is an indie game dev with titles on iOS, Android, desktop, and Nintendo Switch... amassing 3 million downloads and counting (NintendoKill ScreenThe New Yorker). And yes, all these games are built with the DragonRuby Runtime.

Both of these guys hate the complexity of today's engines. And as luck would have it, their paths ended up crossing. After six months and 50,000 lines of DragonRuby Runtime enhancements, Ryan and Amir now have a live/hot loadable, cruft-free, productive game engine that can target... well... any gaming device you can think of. 

Updated 4 days ago
StatusReleased
CategoryTool
PlatformsWindows, macOS, Linux
Rating
Rated 4.9 out of 5 stars
(309 total ratings)
AuthorDragonRuby
Tags2D, dragonruby, Game engine, Moddable, ruby

Purchase

Buy Now$48.00 USD or more

In order to download this game engine you must purchase it at or above the minimum price of $48 USD. You will get access to the following files:

dragonruby-gtk-macos.zip 110 MB
Version 186
dragonruby-gtk-linux-amd64.zip 108 MB
Version 186
dragonruby-gtk-linux-raspberrypi.zip 108 MB
Version 178
dragonruby-gtk-windows-amd64.zip 108 MB
Version 186

Development log

View all posts