Table of Contents

Class WorldGeneratorRegistry

Namespace
TileWorld.Engine.World.Generation
Assembly
TileWorld.Engine.dll

Stores gameplay-provided world generators and resolves them by stable metadata identifier.

public sealed class WorldGeneratorRegistry
Inheritance
WorldGeneratorRegistry
Inherited Members

Remarks

The engine does not ship with a concrete terrain algorithm. Games and test hosts are expected to register their own generator implementations and pass the registry into WorldRuntimeOptions.

Methods

Register(IWorldGenerator)

Registers a concrete world generator under its declared metadata identifier.

public void Register(IWorldGenerator generator)

Parameters

generator IWorldGenerator

The generator implementation to register.

RegisterAlias(string, IWorldGenerator)

Registers an alias that resolves to an already-constructed generator.

public void RegisterAlias(string alias, IWorldGenerator generator)

Parameters

alias string

The alternate metadata identifier that should resolve to the generator.

generator IWorldGenerator

The generator implementation that should be returned for the alias.

ResolveOrDefault(string, IWorldGenerator)

Resolves a registered generator or returns the provided fallback implementation.

public IWorldGenerator ResolveOrDefault(string generatorId, IWorldGenerator fallbackGenerator)

Parameters

generatorId string

The metadata identifier to resolve.

fallbackGenerator IWorldGenerator

The fallback generator that should be returned when no registration exists.

Returns

IWorldGenerator

The resolved generator when present; otherwise the supplied fallback generator.

TryResolve(string, out IWorldGenerator)

Attempts to resolve a registered generator by metadata identifier.

public bool TryResolve(string generatorId, out IWorldGenerator generator)

Parameters

generatorId string

The metadata identifier to resolve.

generator IWorldGenerator

The resolved generator when registration exists.

Returns

bool

true when a registration exists for the supplied identifier.