
PIGO8 is a Go library (package) that reimagines the creative spirit of the PICO-8 fantasy console, allowing developers to build charming, retro-style games entirely in Go. Built on top of Ebitengine, PIGO8 gives you a pixel-perfect environment with a familiar and fun API inspired by PICO-8, without needing to learn Lua and start your arrays counting from 1.
While PIGO8 is inspired by PICO-8, it does not contain or distribute any part of the original PICO-8 engine or its proprietary assets. It is a clean-room reimplementation for educational and creative purposes.
.p8 files and reuse your graphics and map data.package main
import p8 "github.com/drpaneas/pigo8"
// Game represents our game state
type Game struct {
// Your game state variables here
}
// Init initializes the game
func (g *Game) Init() {
// Initialization code
}
// Update updates the game state
func (g *Game) Update() {
// Update game logic
}
// Draw draws the game
func (g *Game) Draw() {
// Drawing code
}
func main() {
// Create an instance of the game
game := &Game{}
// Insert the game into PIGO8
p8.InsertGame(game)
// Run the game with the configured settings
p8.Play()
}
or with custom settings:
func main() {
// Create an instance of the game
game := &Game{}
// Insert the game into PIGO8
p8.InsertGame(game)
// Configure settings
settings := p8.NewSettings()
settings.WindowTitle = "My PIGO8 Game"
settings.ScaleFactor = 4
settings.TargetFPS = 60
settings.ScreenWidth = 160
settings.ScreenHeight = 144
// Run the game with the configured settings
p8.PlayGameWith(settings)
}
Note: If you have spritesheet.json, map.json, palette.hex, or audio files such as music0.wav, music1.wav, and so on in the same directory as your game, PIGO8 can load them once they are embedded and registered. Add the following line at the top of your main.go:
//go:generate go run github.com/drpaneas/pigo8/cmd/embedgen -dir .
Then run go generate to generate the embedded files.
Export your game to WebAssembly for browser play with a retro Game Boy-style UI:
# Export your game to the web
go run github.com/drpaneas/pigo8/cmd/webexport -game ./your-game -o ./dist
# Or with a custom title
go run github.com/drpaneas/pigo8/cmd/webexport -game ./your-game -o ./dist -title "My Awesome Game"
# Start a local test server automatically
go run github.com/drpaneas/pigo8/cmd/webexport -game ./your-game -o ./dist -serve
The web export generates:
- game.wasm - Your compiled game
- index.html - A responsive page with Game Boy-style virtual controls
- wasm_exec.js - Go's WebAssembly runtime
Virtual controls work on both desktop (mouse) and mobile (touch), with haptic feedback on supported devices.
To add PIGO8 to your Go project:
go get github.com/drpaneas/pigo8
Check out the examples directory in the repository for complete, working examples of PIGO8 games and demos.
Comprehensive documentation can be found on the PIGO8 Wiki.
Contributions are welcome! Whether it's fixing bugs, adding features, or improving docs—pull requests and issues are encouraged. If you are interested in contributing to PIGO8, read about our Contributing guide
If you have existing assets made in PICO-8, you can load them by using parsepico.
This will read your *.p8 cartridge and extract spritesheet.json and map.json.
By placing those two JSON files into the same directory with your PIGO8 game, they will automatically get picked up by the library.
Note: You must own a legitimate copy of PICO-8 to access its files. PIGO8 does not redistribute any proprietary data or code from Lexaloffle.
PIGO8 is released under the MIT License. It is not affiliated with or endorsed by Lexaloffle Games.
PICO-8 is a trademark of Lexaloffle Games.
This project is a community-made, open-source interpretation and requires that users own PICO-8 to use any .p8 assets.
The font used in this project, PICO-8 wide reversed, was created by RhythmLynx using FontStruct, and is licensed under the Creative Commons CC0 1.0 Public Domain Dedication.
More info and source: PICO-8 Font on GitHub and FontStruct page.
$ claude mcp add pigo8 \
-- python -m otcore.mcp_server <graph>