Skip to content
forked from domeengine/dome

A lightweight game development environment where games can be written in Wren

License

Notifications You must be signed in to change notification settings

scholar-mage/dome

 
 

Repository files navigation

DOME - Dynamic Opinionated Mini Engine

A lightweight game engine which melds SDL2 and the Wren scripting language, written in C.

For more information on how to use DOME and get started, read the docs here.

Warning

As of 03/07/2018, DOME is in a pre-alpha state. None of the API is stable and it is not production ready. It has been tested in OSX Sierra and 64-bit Lubuntu 18.04, and can be compiled on Windows 10 using MinGW-w64 and MSYS2.

How to Use

Build

Ensure you have the shared SDL2 libraries installed on your system first.

> git submodule init
> git submodule update
> make

Run

Run ./dome [gamefile.wren] to run your game. If your initial file is called main.wren, just executing ./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
    • Color
    • Rectfill
    • Point
    • Circle
    • Lines
  • ImageData
    • Draw sprites loaded from files
  • Input
  • IO
    • Asynchronous
    • File reading
  • Audio (stereo and mono OGG and WAV files only)

TODO

You can follow my progress on implementing DOME on my twitter.

  • IO
    • Writing to files
  • Loading Audio and Graphics asynchronously
  • Graphics
    • Rect (no-fill)
    • Triangles
  • Network Access
    • UDP
    • HTTP client (optional)
  • Math (Better API for Num class functions)
  • Robust error checking and sandboxing
  • Documentation
  • Memory leak checks

Dependencies

DOME currently depends on a few libraries to achieve it's functions.

  • Wren (This is built by make automatically)
  • SDL2 (version 2.0.4 or newer, 2.0.8 may crash)
  • stb_image
  • stb_image_write
  • stb_vorbis
  • microtar
  • 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
  • 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
  • Sean Barrett for multiple libraries
  • rxi for microtar
  • Jon Olick for jo_gif
  • Example game and graphics are derived from this fantastic PICO-8 tutorial.
  • Aerith's Piano Theme (res/AerisPiano.ogg) by Tanner Helland is available under a CC BY-SA 3.0 license: Link
  • Game Over Theme (res/music.wav) by Doppelganger is available under a CC BY-SA 3.0 license: Link

About

A lightweight game development environment where games can be written in Wren

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 98.9%
  • Other 1.1%