Table of Contents

Class WorldMapDefinition

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

Everything a scene needs in order to present itself: its player-facing name, the image shown while it loads, the baked overhead map the world map draws, the world-space rectangle that map covers, and the labels and landmarks placed on it.

[CreateAssetMenu(fileName = "WorldMapDefinition", menuName = "FishMMO/World Map Definition")]
public class WorldMapDefinition : ScriptableObject
Inheritance
Object
ScriptableObject
WorldMapDefinition
Inherited Members
ScriptableObject.SetDirty()
ScriptableObject.CreateInstance<T>()
Object.GetEntityId()
Object.GetInstanceID()
Object.GetHashCode()
Object.InstantiateAsync<T>(T)
Object.InstantiateAsync<T>(T, Transform)
Object.InstantiateAsync<T>(T, Vector3, Quaternion)
Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion, Transform)
Object.Instantiate(Object)
Object.Instantiate(Object, Scene)
Object.Instantiate<T>(T, InstantiateParameters)
Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)
Object.Instantiate(Object, Transform)
Object.Instantiate<T>(T)
Object.Instantiate<T>(T, Vector3, Quaternion)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Destroy(Object)
Object.DestroyImmediate(Object)
Object.DontDestroyOnLoad(Object)
Object.DestroyObject(Object)
Object.FindObjectsOfType<T>()
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindObjectOfType<T>()
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Object.FindObjectsByType<T>()
Object.FindObjectsByType<T>(FindObjectsInactive)
Object.ToString()
Object.name
Object.hideFlags

Remarks

Why this asset exists. Per-scene presentation used to be spread across a WorldSceneSettings component (the transition image), the scene name itself (which is what character creation and the loading screen showed the player — "RestBay", not "Rest Bay"), and nowhere at all (the map). One asset per scene gives all of it a single home that is versioned with the scene and reviewable in a diff.

What deliberately stays out. Gameplay data — MaxClients, spawn and respawn positions, teleporters, boundaries — remains on WorldSceneDetails. Those are read on the server, where none of the contents of this asset mean anything, and mixing a capacity limit into the same asset as client map art invites a change to one to be reviewed as a change to the other.

Why the map image is an UnityEngine.AddressableAssets.AssetReference and the sprites are not. WorldSceneDetails holds a reference to this asset and is read by the scene server, so anything hard-referenced here is pulled into a dedicated server build. A baked overhead map is megabytes per scene and would be the largest thing in a build that never draws a frame; an addressable reference is a GUID string and costs nothing. The transition image and the landmark icons are small and are hard references for authoring convenience, matching what WorldSceneSettings already did.

Bounds are optional. A definition with an empty MapBoundsSize falls back to the scene's IBoundary and terrain extents at runtime — see MapBoundsResolver. Authoring bounds is for scenes whose playable area is a deliberate subset of what a boundary happens to cover.

Fields

BoundsAreDerived

True when MapBoundsCenter and MapBoundsSize were derived from the scene rather than authored, and may therefore be re-derived.

[HideInInspector]
public bool BoundsAreDerived

Field Value

bool

Remarks

Cleared by FishMMO.Shared.WorldMapDefinition.OnValidate() whenever the values are edited in the inspector, so touching either field in the editor is what promotes derived bounds to authored ones — there is no separate box to tick and no way to edit the bounds and have the edit thrown away by the next rebuild.

Description

Flavour text shown under the name on the loading screen and the world map header.

[TextArea(2, 4)]
[Tooltip("Optional flavour text shown on the loading screen and the world map header.")]
public string Description

Field Value

string

DisplayName

Player-facing name of the scene. Falls back to SceneName when empty.

[Tooltip("Player-facing name shown on the map, the loading screen and character creation.")]
public string DisplayName

Field Value

string

FogCellSize

Size of one reveal cell in world metres. Zero uses the client default.

[Tooltip("Size of one fog reveal cell in metres. Zero uses the client default (4m).")]
public float FogCellSize

Field Value

float

FogOfWarEnabled

Whether unexplored parts of this scene are hidden until the player walks near them.

[Header("Fog of War")]
[Tooltip("Hide unexplored areas until the player walks near them.")]
public bool FogOfWarEnabled

Field Value

bool

Remarks

Off for scenes where concealment makes no sense: a one-room shop interior, an arena, a tutorial area. A scene with fog disabled reads as fully explored everywhere.

MapBackground

Colour drawn behind the map, visible where the image has no coverage.

[Tooltip("Colour drawn behind the map image.")]
public Color MapBackground

Field Value

Color

MapBoundsCenter

Centre of the rectangle the map image covers, in world space. Y is ignored.

[Header("Bounds (leave size zero to derive from the scene)")]
[Tooltip("Centre of the mapped area in world space. Y is ignored.")]
public Vector3 MapBoundsCenter

Field Value

Vector3

MapBoundsSize

Size of the rectangle the map image covers, in world metres. Y is ignored. A zero size means "derive from the scene's boundary and terrain at bake time".

[Tooltip("Size of the mapped area in world metres. Y is ignored. Zero derives from the scene.")]
public Vector3 MapBoundsSize

Field Value

Vector3

MapImage

The baked overhead map texture, loaded on demand by the client.

[Header("Map Image")]
[Tooltip("Baked overhead capture of the scene. Produced by FishMMO/World Map/Bake Maps.")]
public AssetReferenceTexture2D MapImage

Field Value

AssetReferenceTexture2D

MapTint

Tint multiplied into the map image when it is drawn.

[Tooltip("Tint multiplied into the map image when drawn.")]
public Color MapTint

Field Value

Color

MinimapDefaultRange

The half-extent the minimap opens at.

[Tooltip("Minimap zoom used before the player has changed it.")]
public float MinimapDefaultRange

Field Value

float

MinimapMaximumRange

Largest half-extent, in world metres, the minimap may be zoomed out to.

[Tooltip("Furthest minimap zoom, as the camera's orthographic half-size in metres.")]
public float MinimapMaximumRange

Field Value

float

Remarks

Clamped hard at runtime rather than merely defaulted. The minimap is a live camera, so its range is the one map value a modified client could widen for real information; the renderer re-applies this bound every time it renders.

MinimapMinimumRange

Smallest half-extent, in world metres, the minimap may be zoomed in to.

[Header("Zoom")]
[Tooltip("Closest minimap zoom, as the camera's orthographic half-size in metres.")]
public float MinimapMinimumRange

Field Value

float

NorthOffsetDegrees

Rotation of the map relative to world north, in degrees clockwise.

[Tooltip("Rotation of the map relative to world north, in degrees clockwise. Zero puts +Z up.")]
public float NorthOffsetDegrees

Field Value

float

Remarks

Zero means +Z on the map points up. A scene laid out along a diagonal can be rotated so its coastline runs across the map rather than corner to corner, without moving anything in the world.

PointsOfInterest

Landmarks drawn on the map, baked from MapPointOfInterest.

public List<MapPointOfInterestDetails> PointsOfInterest

Field Value

List<MapPointOfInterestDetails>

RegionLabels

Named areas drawn across the map, baked from MapRegionLabel.

[Header("Authored Content (baked from the scene)")]
public List<MapRegionLabelDetails> RegionLabels

Field Value

List<MapRegionLabelDetails>

SceneName

Name of the Unity scene this definition describes. Must match the scene file name, because that is the key Scenes uses.

[Header("Identity")]
[Tooltip("Scene file name this definition describes. Must match exactly.")]
public string SceneName

Field Value

string

SceneTransitionImage

The image displayed while this scene loads.

[Tooltip("Image displayed while this scene loads.")]
public Sprite SceneTransitionImage

Field Value

Sprite

Remarks

Moved here from WorldSceneSettings. It is a per-scene presentation choice made by the same person choosing the map art, and having it on a component in the scene meant it could only be found by opening the scene.

Properties

HasAuthoredBounds

Whether the bounds were typed in by a person, as opposed to derived from the scene.

public bool HasAuthoredBounds { get; }

Property Value

bool

Remarks

The distinction is what stops a derive from becoming permanent. The scene rebuild writes derived bounds into the same two fields the inspector edits, so without this flag the very next rebuild would see a non-empty size, conclude somebody had authored it, and never derive again — freezing every scene's map at whatever its boundaries happened to be the first time the cache was built.

HasBounds

Whether usable bounds are present, however they got there.

public bool HasBounds { get; }

Property Value

bool

MapRect

The world-space rectangle the map covers, on the XZ plane.

public Rect MapRect { get; }

Property Value

Rect

Remarks

Returns an empty rect when there are no bounds at all, so callers can tell "unknown" from "genuinely tiny". MapBoundsResolver is what fills the gap.

ResolvedDisplayName

The name to show the player for this scene.

public string ResolvedDisplayName { get; }

Property Value

string

Methods

FindRegion(Vector3)

The region containing a world position, most specific first.

public MapRegionLabelDetails FindRegion(Vector3 worldPosition)

Parameters

worldPosition Vector3

Position to name.

Returns

MapRegionLabelDetails

The containing region, or null when the position is in no named region.

Remarks

Smallest containing region wins. Regions are expected to nest — a district inside a city inside a province — and the player wants the name of the thing they are standing in, not the name of the continent it is on.

SetDerivedBounds(Rect)

Records bounds worked out from the scene, marking them re-derivable.

public void SetDerivedBounds(Rect rect)

Parameters

rect Rect

The derived rectangle, on the XZ plane.