vector/ogmo: Ogmo Editor 3 levels and projects read + write as a TileMap (tile / grid / entity / decal layers, every save layout, values; HaxeFlixel TurnBasedRPG sample, MIT)
This commit is contained in:
1 parent
1f74419ccf
commit
9c02ebdee5
15 files changed
+1596
-4
No files matched your search
@@ -151,6 +151,7 @@ is tested under both runtimes (luau `--codegen -O2` and LuaJIT through the build
|
||||
| data | xml | .xml .xsd .xsl .xslt .rss .atom .xhtml | yes | yes | namespaces: true, streaming: true | `tests/data/xml.luau` |
|
||||
| data | yaml | .yaml .yml | yes | yes | ordered: true, multiDocument: true, anchors: true | `tests/data/yaml.luau` |
|
||||
| vector | ldtk | .ldtk | yes | yes | levels: true, worlds: true, intGrid: true, entities: true | `tests/vector/ldtk.luau` |
|
||||
| vector | ogmo | .ogmo | yes | yes | projects: true, entities: true, decals: true | `tests/vector/ogmo.luau` |
|
||||
| vector | svg | .svg | yes | yes | rasterize: true, text: false | `tests/vector/svg.luau` |
|
||||
| vector | tiled | .tmx .tmj .tsx .tsj | yes | yes | tilesets: true, infinite: true | `tests/vector/tiled.luau` |
|
||||
| layered | aseprite | .aseprite .ase | yes | yes | layers: true, groups: true, animation: true, depths: 8, 16, 32 | `tests/layered/aseprite.luau` |
|
||||
|
||||
@@ -240,6 +240,37 @@ local back = assert(F.load(ldtk))
|
||||
assert(back.layers[1].layers[1].tiles[2].tile == 3)
|
||||
```
|
||||
|
||||
## Ogmo Editor 3
|
||||
|
||||
[Ogmo Editor 3](https://ogmo-editor-3.github.io) keeps a project (`.ogmo`: layer definitions, entity templates,
|
||||
tilesets with their images embedded) and one JSON file per level. A level loads as a `TileMap`; pass its project as
|
||||
`opts.project` (bytes or decoded JSON) to get the tilesets (gids), the map grid, entity template sizes and value
|
||||
types. Without it tile layers keep `id + 1` as their gids. A project alone loads with `meta.project = true`, its
|
||||
tilesets and one empty layer per definition.
|
||||
|
||||
| Ogmo layer | `TileLayer` (`ogmoType`) |
|
||||
|---|---|
|
||||
| tile (ids or coords, 1D or 2D) | `"tiles"` (`"tile"`): `data` gids, `tileset`, the tile flags as Tiled flip bits |
|
||||
| grid | `"tiles"` (`"grid"`): `grid` (the cell strings, `"0"` empty), `data` (their numbers), `legend` |
|
||||
| entity | `"objects"` (`"entity"`): `x` / `y` top-left (position minus `originX` / `originY`), `width`, `height`, `rotation` in degrees, `flippedX` / `flippedY`, `nodes` (`{ { x, y } }`), values as `properties` |
|
||||
| decal | `"objects"` (`"decal"`): `texture`, `x` / `y`, `scaleX` / `scaleY`, `rotation` in degrees, `originX` / `originY` |
|
||||
|
||||
Ogmo's first layer is drawn on top, so the layers are reversed (bottom first, as everywhere in `TileMap`). Layers keep
|
||||
their cell size (`cellWidth`, `cellHeight`) and save layout (`exportMode`, `arrayMode`). Tileset images stay bytes
|
||||
(`tileset.imageData`, a PNG) next to their `imageSource` path.
|
||||
|
||||
```luau
|
||||
local map = assert(F.load(ogmoLevelText, { format = "ogmo", project = ogmoProjectText }))
|
||||
assert(map.pxWidth == 640 and map.tileWidth == 8) -- the project's grid
|
||||
local walls = map.layers[1]
|
||||
assert(walls.ogmoType == "tile" and walls.tileset == "tiles" and walls.width == 40)
|
||||
local things = map.layers[2]
|
||||
assert(things.objects[1].class == "player" and things.objects[1].x == 128)
|
||||
local level = assert(F.save(map, nil, { format = "ogmo" })) -- a level
|
||||
local project = assert(F.save(map, nil, { format = "ogmo", kind = "project" })) -- a project for any map
|
||||
assert(F.detect(project) == "ogmo")
|
||||
```
|
||||
|
||||
## Formats
|
||||
|
||||
| Format | Read | Write | Notes |
|
||||
@@ -247,6 +278,7 @@ assert(back.layers[1].layers[1].tiles[2].tile == 3)
|
||||
| TMX / TSX | yes | yes | CSV, base64 (raw, zlib, gzip) and `<tile>` data; zstd data returns `UNSUPPORTED` |
|
||||
| TMJ / TSJ | yes | yes | |
|
||||
| LDtk (`.ldtk`) | yes | yes | levels as groups, worlds, IntGrid / auto / tile / entity layers, fields; `.ldtkl` through `resolve`; writes embedded levels |
|
||||
| Ogmo Editor 3 (`.ogmo`, level `.json`) | yes | yes | tile / grid / entity / decal layers, values; the project through `opts.project` |
|
||||
|
||||
TMX and TMJ are both the `tiled` format in [FORMATS.md](../FORMATS.md) (Wang sets and terrains are dropped).
|
||||
|
||||
|
||||
Reference in new issue
Block a user