Toy Shader in TinyGo for Game Boy Advance.



Toy Shader in TinyGo for Game Boy Advance.


  • v0.2: 80x80 screen with 3x2 pixel block version for drawing speed.
  • v0.1: 240x160 pixel screen version.

Build Environemnt

  • Ubuntu 20.04 currenly used, but any platform runs TinyGo possible.
  • Tiny Go version 0.18.0 linux/amd64 (using go version go1.16.4 and LLVM version 11.0.0)
  • make
  • VisualBoyAdvance version 1.8.0

Build examples.

Shader Values and Functions

all variable type is int16

R,G,B = { 0..255, 0..255, 0..255 }

  • u_resolution = { 240, 160 }
  • u_time = 0..35
  • u_mouse = { 0..240, 0..160 }
  • cdepth = 255 // color depth
  • vec2 has { x,y }
  • vec3 has { r,g,b }
  • sin() / cos() : radius = 80 and degree by 10
  • length(vec2, vec2) : euclidean distance ^2
  • dot(vec2, vec2)
  • fract(int16) : att like mod 80
  • pow(x int16, n int16) : x * (x/80)^(n-1)
  • mix(x vec3, y vec3, ratio int16) : mix x and y with ratio
  • normalizedXY(vec2) : convert native screen x,y position to normalized (0..80) value.
  • adjustedRGB(vec3) : convert normalized RGB (0..80) value to adjusted RGB (0..255) value.
  • shader.TurnPageByKey() : need to be called before Run() and you can turn screen by any key
  • shader.Run() : main loop

Build your shader

  • export GO111MODULE="off"
  • cd $GOPATH/src
  • git clone
  • cd toyshader.gba
  • write your shader in function shader() on the shader/code.go
  • if you want to use TurnPageByKey() mode, put it on main.go before Run()
  • make

How to run this demo on real hardware

I'm currently using Visual Boy Advance. Because it can load and run ROM cart memory (0x08000000) without Nintendo's ROM headers. It seems that the Visual Boy Advance can emulate the 3rd party Flash Cart Drive which has no Nintendo headers, so we don'nt need create ROM headers.

If you want to run this demo on real hardware or mGBA, pleae check devkitPro or similer tools.

Run as a demo on Windolws

  • Download visualboyadvance-m and extract

  • mkdir and put visualboyadvance-m and toyshader.bin

  • create a start.bat file contains

    start /max visulaboyadvance-m toyshader.bin
  • click start.bat to start and CTL-Q to quit


Nobuhiro Hatano
twitter @nobuhatano
Nobuhiro Hatano
chess package for go

chess Introduction chess is a set of go packages which provide common chess utilities such as move generation, turn management, checkmate detection, P

Logan Spears 289 Jun 12, 2021
Web-based Cloud Gaming service for Retro Game

CloudRetro provides an open-source cloud gaming platform for retro games. It started as an experiment for testing cloud gaming performance with WebRTC and libretro, and now it aims to deliver the most modern and convenient gaming experience through the technology.

giongto35 1.5k Jun 12, 2021
A small fantasy game engine in WASM using GoLang

The GoLang Fantasy Engine (GoLF Engine) is a retro game engine. It draws inspiration from fantasy console projects like pico-8, tic-80, and pyxle. Like those projects it is designed to be a retro-feeling game creation/playing tool. Unlike those projects GoLF is more minimal in scope and only provides an API and a small set of tools to help you create your games. Tools like an image editor and code editor are not built in. Despite this minimalism creating games in GoLF is still easy and should still maintain the retro game feel.

Brandon Atkinson 75 Jun 7, 2021
Snake game implemented in golang

little_pineapple(Snake game implemented in golang) 贪吃蛇golang实现 Snake game implemented in golang 数据结构:链表&数组 Data structures used: linked list&array 使用方

null 7 Aug 17, 2020
Snake game made in Go! 🐍

Snake This is a Terminal based snake game made by tristangoossens. Please star this repository to help my first big project grow! Documentation can be

Tristan Goossens 295 Jun 16, 2021
Terminal-based game engine for Go, built on top of Termbox

Termloop Termloop is a pure Go game engine for the terminal, built on top of the excellent Termbox. It provides a simple render loop for building game

Joel Auterson 1.2k Jun 9, 2021
🕹️ A basic gameboy emulator with terminal "Cloud Gaming" support

Gameboy.Live ??️ Gameboy.Live is a Gameboy emulator written in go for learning purposes. You can simply play Gameboy games on your desktop: Or, "Cloud

AaronLiu 4.1k Jun 19, 2021
Scalable Distributed Game Server Engine with Hot Swapping in Golang

GoWorld Scalable Distributed Game Server Engine with Hot Reload in Golang Features Architecture Introduction Get GoWorld Manage GoWorld Servers Demos

Nan Lin 1.9k Jun 13, 2021
♛♔ Play chess against UCI engines in your terminal.

uchess ♛♔ Play chess in your terminal. Introduction uchess is an interactive terminal chess client designed to allow gameplay and move analysis in con

Travis Whitton 28 May 29, 2021
Engo is an open-source 2D game engine written in Go.

Engo A cross-platform game engine written in Go following an interpretation of the Entity Component System paradigm. Engo is currently compilable for

Engo 1.4k Jun 12, 2021
Go 3D Game Engine

G3N - Go 3D Game Engine G3N (pronounced "gen") is an OpenGL 3D Game Engine written in Go. It can be used to write cross-platform Go applications that

G3N - Go 3D Game Engine Repositories 1.5k Jun 12, 2021
A hand-crafted 2D game library in Go

Pixel A hand-crafted 2D game library in Go. Take a look into the features to see what it can do. go get If you are using Mod

Michal Štrba 3.5k Jun 12, 2021
An open source re-implementation of Diablo 2

OpenDiablo2 Join us on Discord! Development Live stream Support us on Patreon We are also working on a toolset:

OpenDiablo2 9.5k Jun 13, 2021
Dedicated Game Server Hosting and Scaling for Multiplayer Games on Kubernetes

Agones is a library for hosting, running and scaling dedicated game servers on Kubernetes. Agones, is derived from the Greek word agōn which roughly t

GoogleForGames 3.9k Jun 11, 2021