You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Matteo Benedetto ef5715c901 Update project overview and version in Copilot instructions; enhance clarity and detail 2 months ago
.github Update project overview and version in Copilot instructions; enhance clarity and detail 2 months ago
config Add procedural pixelated textures for tiles 2 months ago
docs Add procedural pixelated textures for tiles 2 months ago
src Update project overview and version in Copilot instructions; enhance clarity and detail 2 months ago
.gitignore Initial release v1.0.0 - Isometric Terrain Generator 2 months ago
README.md Add procedural pixelated textures for tiles 2 months ago
main.py Initial release v1.0.0 - Isometric Terrain Generator 2 months ago
requirements.txt Initial release v1.0.0 - Isometric Terrain Generator 2 months ago
test_texture.py Add procedural pixelated textures for tiles 2 months ago

README.md

Isometric Terrain Generator

A RollerCoaster Tycoon-style isometric terrain generator using Python, Pygame, and OpenGL.

Project Structure

shader/
├── config/
│   ├── __init__.py
│   └── settings.py          # Configuration settings for the entire application
├── src/
│   ├── __init__.py
│   ├── app.py              # Main application class
│   ├── camera/
│   │   ├── __init__.py
│   │   └── camera.py       # Camera control and positioning
│   ├── terrain/
│   │   ├── __init__.py
│   │   └── generator.py    # Terrain generation using Perlin noise
│   └── rendering/
│       ├── __init__.py
│       └── terrain_renderer.py  # OpenGL rendering logic
├── main.py                 # Application entry point
├── isometric_terrain.py    # Original monolithic version (legacy)
├── requirements.txt
└── README.md

Features

  • 20×20 grid of 30px×30px isometric tiles
  • Procedural terrain generation using Perlin noise with random seeds
  • Procedural texture decorations - Each tile has unique pixelated patterns (RCT-style)
  • Multiple biomes based on elevation (water, sand, grass, rock, snow)
  • Real-time camera controls
  • Dynamic regeneration - Press R for new terrain and textures
  • Configurable settings via config/settings.py

Installation

  1. Activate the virtual environment:
source venv/bin/activate
  1. Install dependencies (if not already installed):
pip install -r requirements.txt

Usage

Run the new organized version:

source venv/bin/activate && python main.py

Or run the legacy version:

source venv/bin/activate && python isometric_terrain.py

Controls

  • UP/DOWN Arrow: Zoom in/out
  • LEFT/RIGHT Arrow: Adjust camera height
  • R Key: Regenerate terrain (new version only)
  • ESC: Exit application

Configuration

All settings can be modified in config/settings.py:

Terrain Settings

  • grid_size: Number of tiles (default: 20×20)
  • tile_width/tile_depth: Size of each tile in pixels (default: 30px)
  • noise_scale: Controls terrain variation frequency
  • height_multiplier: Controls terrain elevation range
  • enable_smoothing: Enable/disable terrain smoothing

Camera Settings

  • initial_distance: Starting zoom level
  • initial_height: Starting camera height
  • zoom_speed: How fast zoom in/out works
  • min_distance/max_distance: Zoom limits

Rendering Settings

  • background_color: Sky color
  • grid_line_width: Thickness of tile borders
  • light_position: Light source position
  • light_ambient/light_diffuse: Lighting properties
  • side_face_color: Uniform color for lateral tile faces
  • texture_enabled: Enable/disable procedural textures (default: true)
  • texture_detail_scale: Controls texture pattern size
  • texture_variation: Amount of color variation (0.0-1.0)
  • texture_spots_threshold: Controls dark spot frequency

Biome Configuration

  • BIOME_COLORS: RGB colors for each biome type
  • BIOME_THRESHOLDS: Height thresholds for biome transitions

Architecture

Separation of Concerns

The code is organized into logical modules:

  1. Configuration (config/settings.py)

    • Centralized settings management
    • Easy to modify without touching code
  2. Camera (src/camera/camera.py)

    • Handles view projection and positioning
    • Processes user input for camera movement
    • Manages camera constraints
  3. Terrain Generation (src/terrain/generator.py)

    • Procedural heightmap generation using Perlin noise
    • Optional terrain smoothing
    • Configurable noise parameters
  4. Rendering (src/rendering/terrain_renderer.py)

    • OpenGL rendering of terrain mesh
    • Procedural texture generation - 16×16 pixelated textures per tile
    • Biome coloring based on elevation
    • Wireframe grid overlay
    • Shaded side faces for depth
    • Texture caching for performance
  5. Application (src/app.py)

    • Main application loop
    • Event handling
    • Coordinates all components

Extending the Project

Adding New Biomes

  1. Add color to BIOME_COLORS in config/settings.py
  2. Add threshold to BIOME_THRESHOLDS
  3. Update get_color_for_height() in terrain_renderer.py

Modifying Terrain Generation

Edit parameters in config/settings.py:

  • Adjust noise_scale for more/less variation
  • Change noise_octaves for detail level
  • Modify height_multiplier for elevation range
  • Each generation uses a random seed for unique terrains

Customizing Textures

Edit texture parameters in RENDERING section:

  • texture_variation: Increase for more dramatic color changes
  • texture_detail_scale: Lower values = larger patterns
  • texture_spots_threshold: Lower values = more dark spots
  • Textures are 16×16 pixels with GL_NEAREST filtering for retro look

Adding Camera Features

Extend the Camera class in src/camera/camera.py:

  • Add rotation controls
  • Implement smooth camera transitions
  • Add camera presets

License

This project is provided as-is for educational purposes.