Tilemap Editor Overview¶
The PixelRoot32 Tilemap Editor is a powerful visual tool designed to create complex multi-layered tile-based maps for the PixelRoot32 engine. It simplifies the process of designing game environments, managing tilesets, and exporting optimized C++ code.
What It Does¶
The Tilemap Editor allows you to:
- Visual Design: Paint tiles directly onto a canvas with layers and transparency.
- Tileset Management: Import PNG images as tilesets and select single or multiple tiles.
- Multi-Scene Support: Create multiple scenes within a single project, sharing the same tilesets.
- Onion Skinning: Visualize adjacent scenes as translucent overlays for seamless transitions.
- Multi-Layer Support: Organize each scene into up to 8 layers for parallax effects or depth.
- Optimized Export: Generate C++ header and source files compatible with the PixelRoot32 renderer.
- BPP Support: Export maps in 1bpp, 2bpp, or 4bpp formats to balance memory usage and color depth.
Key Features¶
✅ Visual Editing Tools¶
- Brush: Paint individual tiles or patterns.
- Eraser: Remove tiles from the active layer.
- Rectangle Fill: Quickly fill areas with a specific tile.
- Pipette: Pick an existing tile from the canvas.
✅ Multi-Scene System¶
- Multiple Scenes: Manage levels, rooms, or map sections within one project.
- Onion Skinning: Overlay other scenes with adjustable opacity to ensure continuity.
- Independent Dimensions: Each scene can have its own width and height.
✅ Multi-Layer System¶
- Per-Scene Layers: Each scene maintains its own independent stack of up to 8 layers.
- Visibility Toggle: Hide/show layers to focus on specific parts of the map.
- Opacity Control: Adjust layer transparency for complex blending effects.
- Layer Reordering: Change the render order of your tilemaps.
✅ Tileset Selector¶
- Smart Selection: Drag and select a rectangular area of tiles.
- Multiple Tilesets: Support for multiple tilesets per project (planned).
- Auto-import: Automatically detects tile size from the imported image.
✅ Engine Integration¶
- Workspace Selection: Link the editor to your PixelRoot32 projects directory.
- Direct Export: Files are generated with the correct namespaces and structures for immediate use.
- BPP Compatibility: Ensures exported data matches the engine's expected format for 1bpp, 2bpp, and 4bpp.
Data Formats¶
Project File (.pr32scene)¶
The editor uses a custom JSON-based format to save your project state, including:
- Tileset metadata (path, tile size, spacing).
- Layer data (tile indices, width, height, position).
- Project settings (BPP, namespace).
Exported C++¶
The editor generates modular C++ files for each scene:
- Scene Files:
scene_<name>.handscene_<name>.cppfor each individual scene. - Global Header:
scenes.hacts as a master entry point. - Tilemap Data: One packed array of tile indices per layer (
*_INDICES[]). Each layer is exposed as aTileMap4bpp(orTileMap2bpp/TileMap) with anindicespointer; use the same data for rendering and for tile-based collision in your game code. - Global Assets: Tilesets and palettes are exported once and shared across all scenes to minimize memory footprint.
- Export options: Store data in Flash (ESP32) (default) emits static data with
PROGMEMto reduce RAM use; Legacy format disables Flash attributes for backward compatibility or non-ESP32 builds.