Procedural Generation

This guide demonstrates how to combine Maps4FS with Giants Editor's Procedural Generator to create realistic terrain features including textures, foliage, trees, and other 3D objects based on real-world geographic data.

Overview

The procedural generation workflow leverages publicly available geographic information to automatically place and distribute map elements, creating more authentic and detailed environments with minimal manual effort.

Key Benefits:

  • Automated texture placement based on real terrain data

  • Realistic foliage and tree distribution

  • Reduced manual editing time

  • Geographic accuracy in object placement

Prerequisites & Installation

Step 1: Download PG Scripts

  1. Click the Code Button β†’ Download ZIP

Download Scripts

Step 2: Install Scripts

  1. Extract the downloaded ZIP file

  2. Navigate to your Farming Simulator 25 installation directory

  3. Copy the .lua files to: Farming Simulator 25\data\maps\proceduralPlacements\

⚠️ Important: The .lua files must be placed directly in the proceduralPlacements folder, not in a subfolder.

Unzip Scripts

Implementation Workflow

Step 3: Prepare Your Map

  1. Generate your map using Maps4FS following standard procedures

  2. Open the map in Giants Editor

  3. Remove the Trees group object to prevent conflicts with procedural generation

Remove Trees

Step 4: Configure Procedural Placement

  1. Open Window β†’ Procedural Placement...

  2. Navigate to the Rule tab

  3. Save your map before proceeding (critical step to prevent data loss)

  4. Click Place Objects to begin generation

Place Objects

⚠️ Processing Note: Large rulesets may take several minutes to complete. The editor will appear unresponsive during generation - this is normal behavior.

Step 5: Review and Iterate

After generation completes, you can:

  • Fine-tune rulesets and masks for optimal results

  • Re-run generation with modified parameters

  • Use results as a foundation for detailed manual editing

Result

Advanced Customization

Modifying Texture Rules

Purpose: Adjust which textures are applied to specific terrain areas

  1. Open Window β†’ Procedural Placement... β†’ Rule tab

  2. Select the target rule (e.g., T_Forests)

  3. Add layers: Use the Add Object button

  4. Remove layers: Click the X buttons next to unwanted layers

  5. Apply changes with Place Objects

Change Texture

Adjusting Field Boundaries

Purpose: Control field size and padding for realistic agricultural layouts

  1. Open Window β†’ Procedural Placement... β†’ Rule tab

  2. Select the field rule (e.g., F_Acres)

  3. Adjust boundaries:

    • Increase borderIn: Shrinks field area (more padding)

    • Increase borderOut: Expands field area (less padding)

  4. Update related rules: Modify corresponding texture rules (e.g., T_Acres)

  5. Apply changes with Place Objects

Change Padding

Creating Custom I3D Object References

Purpose: Add custom objects (trees, buildings, decorations) to procedural generation

Step 1: Register New Objects

  1. Open Window β†’ Procedural Placement... β†’ Objects tab

  2. Click Add i3d reference

  3. Browse and select your target object

Resource Location: Default game trees are located in Farming Simulator 25\data\maps\trees

  1. Assign a descriptive name for easy identification

Create Object

Step 2: Create Placement Rules

  1. Navigate to the Rules tab

  2. Click Add Rule

  3. Enter a descriptive rule name (e.g., R_Grasslands)

  4. Select PG_Mask_Fill.lua from the script dropdown

Select Script

Step 3: Configure Rule Parameters

  1. Object Min Distance: Set minimum spacing between objects

  2. genMaskName: Specify the target mask (e.g., Grasslands)

  3. Add Object: Select your previously created object reference

  4. Click Apply to save configuration

  5. Click Place Objects to execute the rule

Create Object Rule

Ruleset Architecture

Rule Naming Conventions

Understanding the default ruleset structure helps optimize your procedural generation workflow:

Prefix Classifications:

  • MaskName β†’ Loads and links masks with genMaskName parameters

  • T_ β†’ Texture filling operations for terrain surfaces

  • F_ β†’ Foliage placement and distribution

  • Clear_ β†’ Object removal operations within specified masks

  • R_ β†’ I3D reference object placement (trees, structures)

  • Subtract_ β†’ Layer subtraction operations for mask refinement

Processing Order

Rules execute in hierarchical order:

  1. Mask Loading β†’ Initialize geographic data layers

  2. Mask Operations β†’ Process and refine data layers

  3. Texturing β†’ Apply surface materials

  4. Foliage β†’ Place vegetation elements

  5. References β†’ Position 3D objects

Performance Optimization

Strategy 1: Selective Rule Execution

For iterative development and testing:

  1. Click Disable Main Rules to deactivate all rules

  2. Manually activate only the rules you want to test

  3. Press Apply for each selected rule

  4. Execute with Place Objects

Restoration: Use Enable Main Rules or restart Giants Editor to reactivate all rules.

Strategy 2: Manage Reset Operations

The default ClearAll rule provides a complete reset but significantly impacts performance.

  • During development: Disable for faster iteration

  • For final generation: Re-enable for complete clean slate

Configuration Integration

Generating Custom Masks

Create procedural masks directly from Maps4FS geographic data:

This configuration generates data/masks/PG_buildings.png based on geographic areas tagged as buildings.

Multi-Mask Generation

Generate multiple mask variations from single geographic data:

This creates both PG_meadows and PG_grasslands masks from meadow-tagged areas, enabling varied terrain treatment options.

Last updated