Hajime Hoshi (星一) (@hajimehoshi)
English version
Who am I?
What I’m talking today
Go Gopher by Renée Franch is licensed under CC BY 3.0
What Ebiten is
Ebiten - What Ebiten is
Desktops | Windows, macOS, Linux, FreeBSD |
Browsers | Chrome, Safari, Firefox |
Mobiles | Android, iOS |
Ebiten - Features
| Features |
Graphics | Draw from a rect to a rect (basically that’s all!)�Geometry matrix, Color matrix, compositions, offscreen rendering, text rendering |
Input | Keyboard, Touch, Mouse, Gamepad |
Sound | Wav, MP3, Ogg/Vorbis, PCM (any io.Reader) Sync with game progress |
Ebiten - Mainloop
func update(screen *ebiten.Image) error {
// Update
// Draw to the screen
return nil
}
func main() {
if err := ebiten.Run(update, 320, 240, 2,
“title”); err != nil {
log.Fatal(err)
}
}
Ebiten - Graphics
*ebiten.Image (render target)
*ebiten.Image (render source)
The photograph by Chris Nokleberg is licensed under CC BY 3.0
Ebiten - Demo
Actual example
Actual example - Clock of Atonement
Actual example - Clock of Atonement
Ebiten (Go)
RPG Engine (Go)
Game Editor
(Web App)
Test Player�(Web App)
RPG Engine
(JS)
Game Data
(JSON)
Actual example - Clock of Atonement
Ebiten (Go)
RPG Engine (Go)
Game Editor
(Web App)
Game Player
(Mobile App)
RPG Engine�(Native bin.)
Game Data
(JSON)
Implementation (Summary)
Implementation - Graphics
| API | Go Bindings |
Desktops | OpenGL (GLFW) | github.com/go-gl/gl github.com/go-gl/glfw |
Browsers | WebGL | github.com/gopherjs/gopherjs github.com/gopherjs/webgl |
Mobiles | OpenGL ES | golang.org/x/mobile/gl |
Implementation - Sound
| API | |
Desktops | winmm (Windows), OpenAL (macOS, FreeBSD) ALSA (Linux) | |
Browsers | WebAudio | |
Mobiles | AudioTrack (Android), OpenAL (iOS) |
Implementation - Audio decoder
| Go library | |
MP3 | github.com/hajimehoshi/go-mp3 or browsers’ | |
Ogg | github.com/jfreymuth/oggvorbis | |
Wav | (Implemented in Ebiten) |
Implementation (Desktops)
Implementation (Desktops) - GLFW
http://www.glfw.org/
Implementation (Desktops) - Cgo
Implementation (Browsers)
Implementation (Browsers)
GopherJS Logo?
https://twitter.com/gopherjs
Implementation (Browsers) - GopherJS
package main��import (� "github.com/gopherjs/gopherjs/js"�)��func main() {� doc := js.Global.Get("document")� doc.Call("addEventListener", � "click",� func() {� println("clicked")� }� )�}
document.addEventListener(� 'click', function() {� console.log('clicked');� }�)
The above code represents a semantically-equivalent code, and actual compilation results will not be so clean.
Implementation (Browsers) - Performance
Implementation (Browsers) - GopherJS status
Implementation (Mobiles)
Implementation (Mobiles) - gomobile
Implementation (Mobiles) - gomobile
Command | Output | Pros | Cons |
gomobile build | Apps | Easy | Inflexible |
gomobile bind | Dynamic libs | Flexible | Not easy, Requires other langs |
Implementation (Mobiles) - Difficulty
Implementation (Mobiles) - Bugs (1/4)
Implementation (Mobiles) - Bugs (2/4)
Implementation (Mobiles) - Bugs (3/4)
Implementation (Mobiles) - Bugs (4/4)
Implementation (Mobiles) - Context Lost
Implementation (Mobiles) - Context Lost
Idea | Pros | Cons |
A) Notice the user to recreate images | Easy for Ebiten | Impose burden on users�Break the compatibility |
B) Ebiten tries to restore the game | Easy for users | Make Ebiten impl. complicated �Bad performance |
Implementation (Mobiles) - Performance Tuning
Conclusion
How is game developing in Go?
Conclusion
Thank You!