DOME - Dynamic Opinionated Minimalist Engine
A lightweight game framework which melds SDL2 and the Wren scripting language, written in C.
here.
For more information on how to use DOME and get started, read the docsHow to Use
Build
Ensure you have the shared SDL2 libraries installed on your system first, then to build, run:
> make
Run
Run ./dome [gamefile.wren]
to run your game. If your initial file is called main.wren
, just running ./dome
will execute it.
Basics
Your game's entry point must contain a Game
class which contains at least static init()
, static update()
and static draw(_)
methods.
import "input" for Keyboard
import "graphics" for Canvas, Color
class Game {
static init() {
__x = 10
__y = 10
__w = 5
__h = 5
}
static update() {
if (Keyboard.isKeyDown("left")) {
__x = __x - 1
}
if (Keyboard.isKeyDown("right")) {
__x = __x+ 1
}
if (Keyboard.isKeyDown("up")) {
__y = __y - 1
}
if (Keyboard.isKeyDown("down")) {
__y = __y + 1
}
}
static draw(dt) {
Canvas.cls()
var color = Color.new(171, 82, 54)
Canvas.rectfill(__x, __y, __w, __h, color)
}
}
Modules
DOME provides the following modules/methods/classes:
- Graphics
- Canvas
- Rect
- Point
- Circle
- Lines
- Color
- ImageData
- Draw sprites loaded from files (png)
- Canvas
- Input
- Keyboard
- Mouse
- Gamepads
- Filesystem
- File reading and writing
- Audio (stereo and mono OGG and WAV files only)
TODO
You can follow my progress on implementing DOME on my twitter.
- Graphics
- Triangles
- IO
- Asynchronous Operations
- Audio and Graphics also
- Network Access
- UDP
- HTTP client (maybe)
- Security sandboxing (maybe)
Dependencies
DOME currently depends on a few libraries to achieve it's functions.
- Wren (This is built by
make
automatically) - SDL2 (version 2.0.2 or newer, this is a shared library and you must install it seperately)
- libffi (version 3.3 or newer, but optional and can be built by
make DOME_OPT_FFI=1
) - stb_image
- stb_image_write
- stb_vorbis
- microtar
- optparse
- jo_gif
- ABC_fifo (A SPMC threadpool/task dispatching FIFO I wrote for this project)
Apart from SDL2, all other dependancies are baked in or linked statically. DOME aspires to be both minimalist and cross platform, so it depends on as few external components as possible.
Acknowledgements
- Bob Nystrom for creating Wren and inspiring me to make games, thanks to Game Programming Patterns
- Special thanks to lqdev for the fantastic logo!
- Glenn Fiedler for the most referenced resources on Game Loops, Physics and Networking in games
- Casey Muratori for creating Handmade Hero, an inspiration and educational resource that makes this project possible.
- Font comes from here and here.
- Sean Barrett for multiple libraries
- rxi for microtar
- Jon Olick for jo_gif
- Chris Wellons for optparse