Helper library to transform TMX tile maps into a simpler format for Ebiten

Ebitmx

Ebitmx is a super simple parser to help render TMX maps when using Ebiten for your games.

Right now is super limited to XML and CSV data structures in the TMX file, with support only for orthogonal, right-down, non infinite maps.

Please do not use this library in a production environment, this is just done as an example/helper to people who want to use TMX maps with Ebiten. And it's being used in the creation of a game. However, feel free to open a ticket to request a feature or send a PR.

This library parses a TMX file and returns a struct like the following, with the basic fields for you to render your map inside the Draw() function of the Ebiten main loop.

type EbitenMap struct {
	TileWidth  int      // The width of the tile
	TileHeight int      // The height of the tile
	MapHeight  int      // The number of tiles in Height
	MapWidth   int      // The number of tiles in Width
	Layers     [][]int  // Layers
}

Quick Start

// Load the tiles image
tiles, _, err := ebitenutil.NewImageFromFile("overworld.png")
if err != nil {
	fmt.Println(err)
	os.Exit(2)
}

// Load the information of the tmx file
myMap, err := ebitmx.GetEbitenMap("map.tmx")
if err != nil {
	fmt.Println(err)
	os.Exit(2)
}

// Ready to draw! Check the examples for more info

Examples

Check the example code in the examples folder.

Run it by

$ cd examples
$ go run main.go

A super simple map with 2 layers should load:

alt text

Roadmap

  • Tilesets (support for .tsx files)
  • Orientation
  • Renderorder
  • Infinite maps

License

MIT License

Similar Resources

Quality of life tool for diablo2r. Automatically counts up and writes the game name into clipboard.

Quality of life tool for diablo2r. Automatically counts up and writes the game name into clipboard.

counterbaal Quality of life tool for people hosting diablo2 baalruns. Automatically counts up and writes the game name into clipboard. Probably only u

Jan 1, 2022

A dead simple 2D game library for Go

A dead simple 2D game library for Go

Ebiten (v2) A dead simple 2D game library for Go Ebiten is an open source game library for the Go programming language. Ebiten's simple API allows you

Dec 28, 2022

A hand-crafted 2D game library in Go

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 github.com/faiface/pixel If you are using Mod

Dec 31, 2022

Go bindings for raylib, a simple and easy-to-use library to enjoy videogames programming.

Go bindings for raylib, a simple and easy-to-use library to enjoy videogames programming.

raylib-go Golang bindings for raylib, a simple and easy-to-use library to enjoy videogames programming. Requirements Ubuntu X11 apt-get install libgl1

Dec 28, 2022

A simple Go library for 3D ray-tracing rendering, implementing the book Ray Tracing in One Weekend.

A simple Go library for 3D ray-tracing rendering, implementing the book Ray Tracing in One Weekend.

Ray Tracing in Go A Go implementation of the book Ray Tracing in One Weekend. The repository provides a library to describe and render your own scenes

Sep 23, 2022

build and animate objects according to verlet physics. pure golang library

build and animate objects according to verlet physics. pure golang library

verlet build and animate objects according to verlet physics. pure golang library Examples depend on pixel library, see requirements to build them: wo

Dec 22, 2022

Rock-paper-scissors game library

Rock-paper-scissors game library

jankensheep Rock-paper-scissors game library Examples Play with two players:

May 13, 2022

Golang writen 3D render library and some game-relative concepts

Golang writen 3D render library and some game-relative concepts.

Jun 6, 2022

Golang library for connecting to EOSIO SHIP

go-eosio-ship go-eosio-ship is a golang library built on top of go-eosio for con

Jan 3, 2022
Comments
  • Add rudimetry .tsx support

    Add rudimetry .tsx support

    Basic support for loading external (ie, in seperate .tsx files) Tilesets.

    N.B., this doesn't implement the entire Tileset spec - my use case isn't particularly complicated, so I've just added what I need for now.

  • Add Support/Example of using Go's 1.16 embed package

    Add Support/Example of using Go's 1.16 embed package

    Thanks for making this and throwing it on Github. I am messing around with ebiten for the the 7DRL Challenge 2021 (Game Jam) and found your repo here which saved me a little bit of time.

    I went to generate a binary and realized I could use Go's new embed package to create a single binary to distribute to friends for testing. Here's the changes I made if you have any interest in incorporating or leaving as an example for others.

A simple game that I created with Ebiten game library as a way to teach myself Go. Enjoy!
A simple game that I created with Ebiten game library as a way to teach myself Go. Enjoy!

galactic-asteroid-belt Overview A simple game that I created with Ebiten game library as a way to teach myself Go. Enjoy! Run To run, you will need Go

Dec 2, 2021
Donburi is just another Entity Component System library for Ebiten inspired by legion.
Donburi is just another Entity Component System library for Ebiten inspired by legion.

Donburi Donburi is just another Entity Component System library for Ebiten inspired by legion. It aims to be a feature rich and high performance ECS L

Dec 15, 2022
Spaceshooter - A port to go of the pygame Space Shooter game using the ebiten library
Spaceshooter - A port to go of the pygame Space Shooter game using the ebiten library

Space Shooter This is a port to go of the pygame Space Shooter (https://github.c

Sep 29, 2022
Arkanoid game in Go using Ebiten game engine with ECS.
Arkanoid game in Go using Ebiten game engine with ECS.

Arkanoid-go Arkanoid game in Go using Ebiten game engine with ECS. You must have Git LFS installed when cloning the repository to download assets. See

Oct 9, 2022
Tetra3D is a 3D software renderer written in Go and Ebiten and made for games.
Tetra3D is a 3D software renderer written in Go and Ebiten and made for games.

Tetra3D Tetra3D Docs Support If you want to support development, feel free to check out my itch.io / Steam / Patreon. I also have a Discord server her

Dec 20, 2022
A simple breakout game made in Ebiten
A simple breakout game made in Ebiten

Ebiten Breakout Play online on itch.io A simple breakout game made in Ebiten. This is my first game made with Ebiten - a nice simple engine which allo

Nov 23, 2022
Minimal polymorphic solitaire engine in Go, ebiten

Gilbert Oddstream's Minimal Polymorphic Solitaire 5 There's a live WASM version here. Towards a polymorphic solitaire engine in Go+Ebiten, with help f

Dec 14, 2022
Implementation of a popular graphics benchmark written on Ebiten.
Implementation of a popular graphics benchmark written on Ebiten.

Ebiten Bunny Mark This is an implementation of the popular graphics benchmark written on Ebiten. The initial benchmark was created by Ian Lobb (code)

Dec 7, 2022
Simple 2D-grid game made with Ebiten
Simple 2D-grid game made with Ebiten

Simple 2D-grid game made with Ebiten

Mar 15, 2022
Awesome 2D Maze-based games to play with kids in family and with friends on rich console UI. developed into Go.
Awesome 2D Maze-based games to play with kids in family and with friends on rich console UI. developed into Go.

gomazes Have fun time with kids and family and friends at playing awesome 2D maze-based games while feeling like a programmer on the computer console/

Dec 23, 2021