anlianglu / oak

A game engine in Go

Home Page:https://oakmound.blogspot.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Oak

A pure Go game engine

GoDoc Go Report Card Build Status Code Coverage

Installation

go get -u github.com/oakmound/oak/...

On linux, for audio, see klangsynthese for audio installation requirements

Usage

This is an example of the most basic oak program:

oak.AddScene("firstScene",
    // Initialization function
    func(prevScene string, inData interface{}) {}, 
    // Loop to continue or stop current scene
    func()bool{return true}, 
    // Exit to transition to next scene
    func()(nextScene string, result *oak.SceneResult){return "firstScene", nil}) 
oak.Init("firstScene")

See the examples folder for longer demos.

Motivation

The initial version of oak was made to support Oakmound Studio's game, Agent Blue and was developed in parallel. Oak supports Windows with no dependencies and Linux with limited audio dependencies. We hope that users will be able to make great pure Go games with oak and welcome improvements.

Because Oak wants to have as few dependencies as possible, Oak does not use OpenGL or GLFW. We're open to adding support for these in the future for performance gains, but we always want an alternative that requires zero or near-zero dependencies. (We are very sad about the linux audio dependency and are considering writing an audio driver just to get rid of it.)

Features

  1. Window Rendering
    • Windows and key events through shiny
    • Logical frame rate distinct from Draw rate
  2. Image Management
    • render.Renderable interface
    • TileSheet Batch Loading
    • Manipulation
      • render.Modifiable interface
      • Built in Shaping, Coloring, Shading, ...
      • Some built ins via gift
      • extensible Modification syntax func(image.Image) *image.RGBA
      • Copying
    • Built in Renderable types
      • Sprite
      • Sheet Animation
      • Sequence, Compound, Composite
      • History-tracking Reverting
    • Primarily 2D
  3. Particle System
  4. Mouse Handling
    • Click Collision
    • MouseEnter / MouseExit reaction events
    • Drag Handling
  5. Audio Support
    • From klangsynthese
    • Batch Loading
    • Positional filters to pan and scale audio based on a listening position
  6. Collision
    • Collision R-Tree from rtreego
    • 2D Raycasting
    • Collision Spaces
      • Attachable to Objects
      • Auto React to collisions through events
      • OnHit bindings func(s1,s2 *collision.Space)
      • Start/Stop collision with targeted objects
  7. Physics System
    • Vectors
      • Attachable to Objects / Renderables
      • Momentum
      • Friction
      • Force / Pushing
  8. Event Handler, Bus
    • PubSub system
    • event.CID can Bind(fn,eventName) and selectively Trigger(eventName) events
    • GlobalBind and event.Trigger for entity-independent
  9. Timing utilities
    • Smoothed draw rate, frame rate tracking
    • FPS conversion to time.Duration
    • Manipulatable time.Ticker to readily change frame rate
  10. Shaping
    • Shapes from func(x float64) (y float64) equations
    • Shapes from func(x,y,w,h int) bool containment
    • Convert shapes into:
      • Containment checks
      • Outlines
      • 2D arrays
  11. Custom Console Commands
  12. Logging
    • Controlled by config files
    • Filterable by string, debug level

Package-specific Usage

... Pending! See examples or godoc!

About

A game engine in Go

https://oakmound.blogspot.com

License:Apache License 2.0


Languages

Language:Go 100.0%