Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zulu-inuoe/cl-tiled
Tiled map library for CL
https://github.com/zulu-inuoe/cl-tiled
common-lisp tiled tiled-map-editor tiled-parser tilemap tmx
Last synced: 4 days ago
JSON representation
Tiled map library for CL
- Host: GitHub
- URL: https://github.com/zulu-inuoe/cl-tiled
- Owner: Zulu-Inuoe
- License: zlib
- Created: 2017-08-21T23:53:30.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-10-21T17:14:09.000Z (2 months ago)
- Last Synced: 2024-10-31T13:06:21.081Z (about 2 months ago)
- Topics: common-lisp, tiled, tiled-map-editor, tiled-parser, tilemap, tmx
- Language: Common Lisp
- Homepage:
- Size: 194 KB
- Stars: 23
- Watchers: 4
- Forks: 9
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# cl-tiled
[Tiled](http://www.mapeditor.org) TMX/TSX and JSON map/tileset loader
## About
**cl-tiled** is a Common Lisp library for importing [TMX/TSX](http://doc.mapeditor.org/reference/tmx-map-format/) and [JSON](https://github.com/bjorn/tiled/wiki/JSON-Map-Format) tilemaps and tilesets generated by [Tiled](http://www.mapeditor.org).
It aims to fill the same role as [other](https://github.com/marshallward/TiledSharp) [engine-agnostic](https://github.com/bitcraft/PyTMX) Tiled [importers](https://github.com/baylej/tmx/). Meaning it is not a renderer nor does it provide integration with renderers on its own. Instead it aims to provide an easy, logical way to read map data so it may be imported/rendered in whatever way you wish.## Status
alpha quality. API changes to come. Mostly additions to missing features.
Note that as a current goal, this library aims to be feature complete, not fast nor space efficient.
Current:
* Full TMX/TSX and JSON reading support
* Support for embedded and external tilesets
* Support for embededd and external images
* API support for all layer, tile, object, and terrain types
* Full support for property objects with distinct data-types (string, number, bool, color, pathname)
* Orthogonal map supportPlanned:
* Defining API for isometric, staggred, and hexagonal maps
* Make the library more efficient
* Modifying map and writing TMX/TSX and JSON files (if enough demand for this)Please post any requests/bugs on the issues page.
## Dependencies
* [alexandria](https://gitlab.common-lisp.net/alexandria/alexandria) - general utilities
* [asdf](https://common-lisp.net/project/asdf/) - building
* [chipz](https://github.com/froydnj/chipz) - decompressing tileset and image data
* [cl-base64](http://quickdocs.org/cl-base64/api) - Decode base64 binary data in XML text
* [cl-json](https://github.com/hankhero/cl-json) - JSON parser
* [nibbles](https://github.com/froydnj/nibbles) - Decode encoded/compressed tile data
* [parse-float](https://github.com/soemraws/parse-float) - parsing floats (xml data)
* [split-sequence](http://cliki.net/split-sequence) - split sequences (CSV type XML data)
* [uiop](https://github.com/fare/asdf/tree/master/uiop) - pathname handling
* [xmls](https://www.common-lisp.net/project/xmls/) - XML parser## Example
``` common-lisp
(defpackage #:my-cool-package
(:use #:cl)
(:local-nicknames
(#:tiled #:cl-tiled)))
(in-package #:my-cool-package)(defgeneric render-layer (layer))
(defmethod render-layer ((layer tiled:tile-layer))
(dolist (cell (tiled:layer-cells layer))
;; tiled:cell-x and tiled:cell-y for pixel positions
;; tiled:cell-tile for `tiled:tile' information
;; what image, which row/column within image
))(defmethod render-layer ((layer tiled:image-layer))
;;tiled:layer-image gets you the relevant image to render
)(defmethod render-layer ((layer tiled:object-layer))
(dolist (object (tiled:object-group-objects layer))
;; render each object according to type
))(defmethod render-layer ((layer tiled:group-layer))
;;Render each sub-layer
(dolist (layer (tiled:group-layers layer))
(render-layer layer)))(let ((tiled-map (tiled:load-map "assets/map.tmx")))
(dolist (layer (tiled:map-layers tiled-map))
(render-layer layer)))
```## Contact
Wilfredo Velázquez-Rodríguez