Skip to content

A mod for the Unity game Valhiem that procedurally generates roads in the world.

Notifications You must be signed in to change notification settings

jneb802/ProceduralRoads

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ProceduralRoads

A Valheim mod that generates procedural roads connecting locations across your world.

Features

  • Automatically generates roads from spawn to nearby points of interest
  • Terrain-aware pathfinding that follows natural contours
  • Configurable road width, length, and count

Installation

  1. Install BepInEx
  2. Install Jotunn
  3. Drop ProceduralRoads.dll into BepInEx/plugins/

Configuration

Edit warpalicious.ProceduralRoads.cfg in BepInEx/config/:

Setting Default Description
RoadWidth 4 Road width in meters (2-10)
IslandRoadPercentage 50 Percentage of islands that will have roads (0-100). Largest islands selected first.
CustomLocations (empty) Comma-separated list of location names to include in road generation

Custom Locations via Config

Use the CustomLocations setting to add locations from other mods (e.g., Expand World Data):

CustomLocations = Runestone_Boars,Runestone_Greydwarfs,MerchantCamp

API for Mod Authors

Other mods can register locations for road generation programmatically.

Direct Reference (if embedding or referencing the DLL)

using ProceduralRoads;

// Register a location
RoadNetworkGenerator.RegisterLocation("MyCustomLocation");

// Unregister if needed
RoadNetworkGenerator.UnregisterLocation("MyCustomLocation");

// Get all registered locations
IReadOnlyCollection<string> locations = RoadNetworkGenerator.GetRegisteredLocations();

Reflection (soft dependency, no DLL reference required)

private static void RegisterRoadLocation(string locationName)
{
    var assembly = AppDomain.CurrentDomain.GetAssemblies()
        .FirstOrDefault(a => a.GetName().Name == "ProceduralRoads");

    if (assembly == null) return;

    var generatorType = assembly.GetType("ProceduralRoads.RoadNetworkGenerator");
    var method = generatorType?.GetMethod("RegisterLocation", 
        System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);

    method?.Invoke(null, new object[] { locationName });
}

Available API Methods

Method Signature Description
RegisterLocation void RegisterLocation(string locationName) Add a location to road generation
UnregisterLocation void UnregisterLocation(string locationName) Remove a location from road generation
GetRegisteredLocations IReadOnlyCollection<string> GetRegisteredLocations() Get all registered location names

Notes

  • Register locations during mod initialization (Awake/Start)
  • Location names must match the prefab name exactly (e.g., Runestone_Boars, not Runestone Boars)
  • Both API registrations and config entries are merged at generation time

License

MIT License - see LICENSE.md

About

A mod for the Unity game Valhiem that procedurally generates roads in the world.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages