Overview
The Map Editor is a graphical application for creating and editing GRPG game maps. It provides a visual interface for placing tiles and objects on a 16x16 grid to create map chunks.Installation
Build the map editor from source:Running the Editor
Launch the map editor:- Editor: 16x16 grid for map editing
- Controls: Action buttons and chunk coordinate inputs
- Selector: Tabs for selecting tiles and objects
Interface Layout
Editor Panel
The main editing area displays a 16x16 grid (256 tiles total) where you can place tiles and objects by clicking.Controls Panel
The controls panel provides the following buttons and inputs: Asset Loading:- Load Textures: Load a
.grpgtextexture pack file - Load Tiles: Load a
.grpgtiletiles definition file - Load Objs: Load a
.grpgobjobjects definition file
- Save Map: Save the current map to a
.grpgmapfile - Load Map: Load an existing
.grpgmapfile
- Set all empty tiles to currently selected: Fill all empty tiles with the selected tile
- Clear Grid: Wipe the entire grid (with confirmation dialog)
- Enable Eraser: Activate eraser mode to remove tiles/objects
- Chunk X: Input field for the map chunk’s X coordinate
- Chunk Y: Input field for the map chunk’s Y coordinate
Both Chunk X and Chunk Y must be set before saving a map.
Selector Panel
The selector panel has two tabs: Tiles Tab:- Displays all loaded tiles in a grid
- Click a tile image to select it for placement
- Shows the currently selected tile
- Displays all loaded objects in a grid
- Objects show flags:
(s)for STATE,(i)for INTERACT - Click an object image to select it for placement
- Shows the currently selected object
Workflow
Load Assets
Load the required asset files in order:
- Click Load Textures and select your
.grpgtexfile - Click Load Tiles and select your
.grpgtilefile - Click Load Objs and select your
.grpgobjfile
Place Tiles
- Switch to the Tiles tab in the Selector panel
- Click a tile to select it
- Click on the grid to place the tile
- Repeat until all 256 tiles are filled
Place Objects (Optional)
- Switch to the Objs tab in the Selector panel
- Click an object to select it
- Click on the grid to place the object
Editing Features
Tile Placement
Tiles form the base layer of the map. Every grid cell must have a tile before the map can be saved.- Select a tile from the Tiles tab
- Click on the grid to place it
- The tile’s texture is displayed in the grid cell
Object Placement
Objects are placed on top of tiles and are optional.- Select an object from the Objs tab
- Click on a grid cell to place the object
- Objects can have multiple states (indicated by the STATE flag)
- Interactive objects show an
(i)flag
Eraser Mode
Enable eraser mode to remove tiles or objects:- Click Enable Eraser
- Click on grid cells to erase their contents
- Select a tile or object to exit eraser mode
Bulk Operations
Fill Empty Tiles:- Select a tile
- Click Set all empty tiles to currently selected
- All unfilled tiles will be set to the selected tile
- Click Clear Grid
- Confirm the dialog
- All tiles and objects are removed from the grid
Map File Format
Maps are saved in the.grpgmap binary format with the following structure:
Header:
- Magic:
GRPGMAP\x00(8 bytes) - Chunk X: uint16 (2 bytes)
- Chunk Y: uint16 (2 bytes)
- Tiles: 256 tile IDs (uint8 each)
- Objs: 256 object IDs (uint16 each, 0 = no object)
The map file references tiles and objects by their IDs from the loaded
.grpgtile and .grpgobj files.Validation
The editor performs validation before saving:Loading Existing Maps
To load and edit an existing map:- Load textures first (required)
- Click Load Map
- Select a
.grpgmapfile - The chunk coordinates, tiles, and objects will be loaded into the editor
- Make your edits
- Save the map
Source Code
The map editor source code is located at:main.go:17- Application entry point and UI layoutmap.go:12- Map save/load functionalityassets.go:33- Asset loading (textures, tiles, objects)grid.go- Grid rendering and interactionselector.go:27- Tile and object selector tabscontrols.go:11- Control button implementations