Manic Miners Map Renderer is a tool designed to generate PNG images of 2D map tiles with a brushstroke effect for the game Manic Miners. This tool converts tile arrays into visually appealing images with custom biome colors and patterns, and includes functionalities for generating thumbnails as well.
- Converts 2D tile arrays into PNG images.
- Generates both full-sized screenshots and thumbnails.
- Processes entire directories of map files.
To install the dependencies, run:
npm install
To generate a PNG image from a map file:
import { generatePNGImage } from 'manic-miners-map-renderer';
const result = await generatePNGImage({
filePath: 'path/to/mapfile.dat',
outputFileName: 'output_image.png',
});
To generate images for all map files in a directory:
import { generateMapImage } from 'manic-miners-map-renderer';
const result = await generateMapImage({
type: 'both', // 'png', 'thumbnail', or 'both'
directoryPath: 'path/to/map/files',
progressCallback: progress => {
console.log(`Processed ${progress.processedCount} of ${progress.totalCount}`);
},
});
Ensure you have a .env.local
file with the following configuration:
MMT_CATALOG_DIR=path/to/your/map/files
-
resetdist
: Removes thedist
directory. -
build
: Compiles the TypeScript code. -
start
: Compiles the TypeScript code and starts the application.
-
canvas
: Used for rendering the map tiles. -
chardet
: For detecting the character encoding of map files. -
dotenv
: For loading environment variables. -
sharp
: For image processing.
-
@types/chardet
: Type definitions forchardet
. -
@types/dotenv
: Type definitions fordotenv
. -
@types/node
: Type definitions for Node.js.
Waleed Judah
MIT