Ebiten: To add TMX (Tiled Map) files support for opening and for drawing game levels design.

Created on 3 Feb 2020  路  11Comments  路  Source: hajimehoshi/ebiten

Tiled Map Editor: https://www.mapeditor.org/
Go package for TMX-files parsing: https://github.com/salviati/go-tmx

What to support:

  1. Add *.tmx file support for opening with pattern graphics files (tiles).
  2. Production ready structures and function for working with tile map.
  3. Draw tiles due to map and layers data and player position (camera).

Engo package for example: https://engoengine.github.io/tutorials/05-tilemaps

feature help-wanted request

Most helpful comment

In case this helps, I am doing a small tool that parses tmx files and gets the useful information so it can be rendered by Ebiten.

I've added an example on how to use the lib and render a basic TMX file with Ebiten.

Feel free to use the lib or copy the code! https://github.com/Rulox/ebitmx

All 11 comments

This is an interesting idea, but I'd want this in another package rather than in Ebiten core.

This is an interesting idea, but I'd want this in another package rather than in Ebiten core.

It is good solution. Not all developers need TMX, but those who need just will install addon package.

Just want to add that I have a tmx parser here the one you listed is a couple versions behind and doesn't support external tilesets or resources in folders other than the one the tmx is in. Using that, it shouldn't take much work at all to get it working with ebiten

https://gitlab.com/beoran/ebsgo/-/blob/master/engine/tile/io.go

This uses allegro through al5go, but could be adapted to Ebiten relatively easily. Chances are that I will do that, eventually.

Just want to add that I have a tmx parser here the one you listed is a couple versions behind and doesn't support external tilesets or resources in folders other than the one the tmx is in. Using that, it shouldn't take much work at all to get it working with ebiten

Thank you! I will take a look on this package.

I've coincidentally been working on exactly this over the past couple of days. Not nearly as well written or full featured as the other options mentioned here, but it's Ebiten (functions use ebiten.Image, DrawImageOptions, GeoM, etc.), which might be of interest.

Package tiled in https://github.com/jwlarocque/engine/

Very early WIP example: https://github.com/jwlarocque/game/
(Note that at the moment file paths in the Tiled .tmx/.tsx/.json files need to be relative to main.go, not the file in which they are found.)

BTW, as there are already some TMX parsing libraries [1], I think we'd need a library to render TMX structs using Ebiten or other libraries like Engo or Pixel.

[1] https://github.com/salviati/go-tmx, https://github.com/fardog/tmx, https://github.com/ilikeorangutans/tiled/tree/master/tmx, etc. Of course @Noofbiz's, @beoran's and @jwlarocque's are ones of them.

how

But don't you think a native support for tmx would be good like pixel and engo does

I'm not sure what a native support means, but having a third party library that parses TMX and works with Ebiten sounds good.

In case this helps, I am doing a small tool that parses tmx files and gets the useful information so it can be rendered by Ebiten.

I've added an example on how to use the lib and render a basic TMX file with Ebiten.

Feel free to use the lib or copy the code! https://github.com/Rulox/ebitmx

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mortenson picture mortenson  路  7Comments

hajimehoshi picture hajimehoshi  路  5Comments

hajimehoshi picture hajimehoshi  路  6Comments

hajimehoshi picture hajimehoshi  路  6Comments

hajimehoshi picture hajimehoshi  路  4Comments