# pixi-plugin-tilemap

> A tilemap renderer for PIXI.JS

Latest version **1.1.0** (published 2020-10-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install pixi-plugin-tilemap
pnpm add pixi-plugin-tilemap
yarn add pixi-plugin-tilemap
bun add pixi-plugin-tilemap
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2020-10-28 |
| First published | 2020-07-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 39 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | pierre.beaujeu@rednet.io |
| Maintainers | oza94 |

## Links

- npm: https://www.npmjs.com/package/pixi-plugin-tilemap
- Repository: https://github.com/Oza94/pixi-plugin-tilemap
- npm.io page: https://npm.io/package/pixi-plugin-tilemap

## Recent versions

- 1.1.0 (latest) — 2020-10-28
- 1.0.2 — 2020-10-27
- 1.0.1 — 2020-10-27
- 1.0.0 — 2020-07-25

## README

# Pixi Tilemap Plugin

Fast tilemap rendering with PIXI.js V5. Compatible with module bundlers.

This plugin uploads all tiles indices of a layer in a single geometry therefore making only 1 draw call per layer. It also supports linear-time tiles animations.

![Demo screenshot](https://i.imgur.com/kZjPQt1.png)

## Usage

This plugin only works for PIXI v5+.

Using this plugin is pretty simple :

```js
import { TilemapRenderer, Tilemap, Tileset, Vector2 } from "pixi-tilemap-plugin";

// Add the plugin
Renderer.registerPlugin("tilemap", TilemapRenderer);

// ...

// Creates a tileset from a texture specifying tile size
// Texture must be loaded for this to properly work
const tileset = new Tileset(texture, { tileSize: 16 });
// Add each layer to the stage using their array of tiles indices
stage.addChild(new Tilemap(tileset, new Vector2(4, 4), [
  7, 8, 8, 9,
  4, 0, 0, 4,
  4, 0, 0, 4,
  1, 0, 2, 3,
]));
```

The layer indices array layout follows [Tiled](https://www.mapeditor.org/)'s CSV format which is pretty common for storing tilemaps data.

See full working demo in `demo/`.

## Limitations 

This plugin is build for performance, as a result it comes with limits :

- Currently you can use one texture per layer (see improvements)
- Tilemaps can't have children
- Individual tile transforms (e.g. rotation) are not supported
- Filters are not supported (although you can use a parent container)

## Improvements

There's no timeline but I'll eventualy add the following features to this plugin :

- Non square tiles (this is already implemented at shader level)
- Composite layers (single geometry for multiple layers)
- Multiple textures for a single layer
- Isometric support ?

## Alternative

You may look at [pixi-tilemap](https://github.com/pixijs/pixi-tilemap) for pixi v4 that supports textures atlases & other stuff compared to this library.

---
_Source: https://npm.io/package/pixi-plugin-tilemap · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
