marrus-sh / jelli

A game engine! Currently being developed.
MIT License
1 stars 0 forks source link

Support for Tilesets larger than 0xFF #50

Open marrus-sh opened 8 years ago

marrus-sh commented 8 years ago

The maximum size of the Tileset should be specified by data-bit-depth, which determines how Maps are processed. For example, with data-bit-depth="6" each Map will be broken into 6-bit integers. (Right now integers are 8-bit). Support for bit-depths up to 32 is provided by JavaScript Typed Arrays, and so is a reasonable upper-limit.

A lightweight implementation of this would simply use

Array =
    depth <= 8 ? UInt8Array :
    depth <= 16 ? UInt16Array :
    depth <= 32 ? UInt32Array :
    Array;

Note, however, that this is not memory-efficient for non-power-of-2 bit-depths. A base converter shouldn't be too difficult to program for increased efficiency.

marrus-sh commented 8 years ago

Ditto for Letters

EDIT: This is a character encoding issue, so I've moved it to its own issue.