CMapMaker
Overview
UCMapMaker is the core object responsible for building the minimap. It computes a hexagonal tile grid scaled down from the world room layout, creates an UInstancedStaticMeshComponent with one instance per hex tile, and encodes cluster/room identity into per-instance custom data for material-driven rendering.
The build pipeline is asynchronous: drawMap runs off the game thread, enqueues results, and updateMap_sync dequeues and creates ISM instances on the game thread.
Instantiation
| Name | Description |
|---|---|
| instantiate | Static factory. Creates the UCMapMaker singleton, stores scene component, stream, config, and creates a UCSplinator for spline borders |
Build Pipeline
| Name | Description |
|---|---|
| buildASync | Entry point called by the spawner. Runs drawMap async then updateMap_sync on game thread |
| wantDraw | Guards against redundant draws: returns false if queue is not empty or map is already built |
| drawMap | Enqueues map data for processing (currently a placeholder for future expansion) |
| updateMap_sync | Dequeues data, computes hex grid from room layout, creates ISM instances |
Hex Grid Generation
The updateMap_sync method performs the following steps:
- Scales the root cluster rectangle by
mapScale(0.125) - Iterates all cluster rooms via
RoomUtility::iterateOnClusterRoom, building a location map of room centers - Converts the cluster bounding box to axial hex coordinates using
FCTile::pixelToHexCoord - Creates or clears an
UInstancedStaticMeshComponentwith the configuredtileMesh - Iterates the hex grid row by row, converting each axial coordinate back to pixel space via
FCTile::hexCoordToPixel - For each tile, finds the closest room and writes
clusterId * 0.03 + roomId * 0.07as custom data for material use