Skip to content

MaulingMonkey/mmk.tiles

Repository files navigation

mmk.tiles

MaulingMonkey's typescript tile rendering/picking/management API.

Live Demo: http://maulingmonkey.com/mmk.tiles/

Currently supports:

  • Subdividing spritesheets from JSON data
  • Basic rendering of translated and rotated dense rectangular tilemaps
  • Basic picking for translated and rotated dense rectangular tilemaps

License: Apache 2.0

Basic API

See src/_demo.ts

// TODO (finalize high level APIs first?)

Installation

Via NuGet

  • Add mmk.tiles to your project via nuget. Soon (tm)
  • Reference <script src="Scripts/mmk.tiles/mmk.tiles.js"></script> on your page.
  • Done!

Browser Support

Browser API(s) Bench [1] Bench [2]
FireFox 53 Canvas2D ~7ms
Opera 44 Canvas2D ~13ms
Chrome 59 Canvas2D ~13ms ~20ms
IE 11 Canvas2D ~14ms ~16ms
Edge Canvas2D ~16ms
  1. "Total" figures from the demo on Machine 1
  2. "Total" figures from the demo on Machine 2

Benchmarks last updated @ https://github.com/MaulingMonkey/mmk.tiles/commit/4747016ce20ac92bda4c91715c03f9b47b79165f . Note that the benchmark averages were eyeballed (shock! horror!), cpu speed not well controlled, etc. - take it with a grain of salt.

Benchmarking Hardware

Component Machine 1 Machine 2
Build Custom Samsung ATIV Book 9
OS Windows 7 Professional Windows 10 Home
CPU 3.5 GHz Intel Core i7-5930K 1.8 GHz Intel Core i7-4500U
Actual Speed ~3.6 GHz ~ 2.4 - 2.7 GHz
GPU nVidia GeForce GTX 970 Intel HD Graphics 4400

TODO

  • Finish adding higher level APIs
    • Add a sparse tile renderer
    • Make renderers more stateful with regards to transform/target for ease of use and ability to make data driven
  • Benchmark improvements:
    • Frame times
    • Smooth/debounce results
    • d3 based for selectable text?
  • Optimize
    • Check dirty tiles
    • Scrolling blits when resizing canvas
  • Figure out how to prevent sinclair from tainting this codebase with modules