Skip to content

Latest commit

 

History

History
61 lines (43 loc) · 2.64 KB

File metadata and controls

61 lines (43 loc) · 2.64 KB

Map Generator

A desktop GUI application for procedurally generating tile-based maps with asset-based texturing. Paint terrain types onto a canvas and generate detailed maps with smooth transitions, height maps, and layered forest vegetation.

Features

  • Terrain Painting: Paint terrain types onto a canvas using a circular brush
  • Layer System: Multiple painting layers with opacity control and border effect toggles
  • Texture Support: Load custom texture sets with automatic tiling
  • ID Maps: Element-aware boundary handling that keeps texture elements (stones, tiles) intact at borders
  • Perlin Noise Edges: Natural, organic terrain boundaries using Perlin noise
  • Border Transitions: Automatic placement of transition segments between terrain types
  • Multiple View Modes: Switch between draw mode, generated preview, border nodes, and height map visualization
  • Export: Save generated maps as PNG

Running

python main.py

Usage

  1. Select Terrain: Choose a terrain type from the dropdown (grass, water, dirt, etc.)
  2. Adjust Brush: Use the slider to set brush size
  3. Paint: Click and drag on the canvas to paint terrain
  4. Manage Layers: Add/remove layers, toggle visibility and border effects
  5. Preview: Click "Preview Generated Map" to see the composited result
  6. Export: Use File > Export to save your map as PNG

Asset Structure

assets/
├── perlin.png                   # Perlin noise texture for border effects
├── textures/                    # Terrain textures
│   └── {name}/
│       ├── {name}_texture.png   # Base texture (required)
│       └── {name}_id.png        # ID map for element-aware cutoff (optional)
├── {terrain1}_to_{terrain2}/    # Transition segments (10.png, 25.png, etc.)
├── grass_assets/                # Grass detail sprites
├── forest_floor/                # Floor vegetation layer
├── forest_brush/                # Bushes/shrubs layer
└── forest_trees/                # Tree sprites (top layer)

Adding Custom Textures

  1. Create a folder: assets/textures/{name}/
  2. Add {name}_texture.png - your texture image
  3. Optionally add {name}_id.png - an ID map where each unique color identifies a distinct element

The new terrain will automatically appear in the terrain dropdown when assets are loaded.

ID Maps

ID maps use unique colors to identify individual elements within a texture (e.g., individual stones in a cobblestone texture). At terrain boundaries, elements are included or excluded as whole units based on a >50% coverage threshold, preventing elements from being cut through.