Table of Contents

Interface ISceneInstanceDetails

Namespace
FishMMO.Server.Core.World.SceneServer
Assembly
FishMMO.Server.dll

Engine-agnostic, read-only view of a scene instance managed by a scene server. This interface mirrors the implementation-level SceneInstanceDetails while avoiding engine-specific types so core code can safely consume the data.

public interface ISceneInstanceDetails

Remarks

Implementations should document any threading guarantees for the exposed properties and keep the values (for example CharacterCount and LastExit) updated as instance state changes.

Properties

CharacterCount

Current number of characters present in the scene instance. Implementations should keep this value up-to-date to support capacity checks and stale instance detection.

int CharacterCount { get; set; }

Property Value

int

CreatedUtc

When the scene row this instance was loaded for was created.

DateTime CreatedUtc { get; set; }

Property Value

DateTime

Remarks

The row's creation time rather than the moment the scene finished loading, so the age this yields includes the time spent queued and loading. That is the age a lifetime cap has to measure: an instance that took a minute to come up has still been occupying a slot for that minute.

Distinct from LastExit, which measures how long an instance has been empty. The two bound different things — an abandoned instance and an endless one — and neither substitutes for the other.

Difficulty

Difficulty index this instance was opened at, into the dungeon's own difficulty list.

int Difficulty { get; set; }

Property Value

int

Remarks

Meaningful only alongside Name: every dungeon declares its own list, and there is no global set of difficulty levels. Zero for an open-world scene and for a dungeon that declares no difficulties.

Handle

Runtime handle assigned to the loaded scene by this process's scene manager. Valid only inside the scene server that loaded it, and never to be persisted or sent to another process as an identifier — see SceneID.

int Handle { get; set; }

Property Value

int

IsPrivate

Whether the owning party has hidden this instance from the dungeon finder's list.

bool IsPrivate { get; set; }

Property Value

bool

Remarks

A lock on the front door, not on the instance. A private instance is still enterable by the party that owns it — which is what keeps re-entry working for a run that has been closed to strangers — it simply stops being offered to everybody else.

LastExit

Timestamp when the last character exited the instance. Useful for stale instance detection and cleanup heuristics.

DateTime LastExit { get; set; }

Property Value

DateTime

Name

The canonical name of the scene (for example: "ForestZone").

string Name { get; set; }

Property Value

string

OwnerCharacterID

Character the instance was created for. Zero for an open-world scene.

long OwnerCharacterID { get; set; }

Property Value

long

Remarks

Taken from the scene row's character_id, which the dungeon finder stamps when it requests the instance. Records who opened the run, which is not the same as who leads it: leadership is the owning party's and moves with it — see PartyID. The owner is the fallback authority for a run that has no party at all.

PartyID

Party that owns this instance, or 0 when an ungrouped character opened it.

long PartyID { get; set; }

Property Value

long

Remarks

The durable identity of an instance's group, and the anchor for everything about controlling it: the instance's leader is this party's leader, kick authority is that leader's, and the dungeon finder resolves a party's own instance through this rather than through whoever happened to create it — so the run stays findable after its opener has left or logged out.

SceneID

Database ID of the scenes row this instance was loaded for. The identity of the instance everywhere outside the hosting process.

long SceneID { get; set; }

Property Value

long

Remarks

Handle cannot serve this purpose. It is the scene manager's own identifier for a loaded scene, assigned from a per-process counter, so two scene servers running the same build and loading the same scenes in the same order routinely allocate identical handles. Using it as a cross-process identity meant the world server's handle-to-server map collided between scene servers, and a scene server happily accepted a character routed to a different server's instance because the handle and scene name both matched. The row id is unique by construction.

SceneServerID

The scene server identifier that created/hosts this instance. Useful for tracing which scene server owns the instance in multi-server deployments.

long SceneServerID { get; set; }

Property Value

long

SceneType

The logical scene type (for example open world, instanced dungeon, PvP arena). Consumers may use this to apply different connection or persistence logic.

SceneType SceneType { get; set; }

Property Value

SceneType

StalePulse

Indicates whether the scene is stale (no characters present).

bool StalePulse { get; }

Property Value

bool

VacatedDeliberately

True when the instance emptied because its occupants CHOSE to leave, rather than because they went away.

bool VacatedDeliberately { get; set; }

Property Value

bool

Remarks

An empty instance means two very different things. Everyone walked out of the dungeon: the run is over, nobody is coming back, and holding the scene for a timeout wastes a placement slot. The last player's connection dropped: the run is not over, and reaping immediately would destroy their progress before they could reconnect to it.

Set by CharacterSystem.TryLeaveInstance, which is the only voluntary route out — the leave-instance broadcast, the /leaveinstance command, and the forced return when an instance is being closed. Cleared whenever anybody is present again, so a returning player does not inherit the previous departure's verdict.

Note this is not the same distinction combat logout makes: that keeps a disconnected body counted as PRESENT so the scene never looks empty at all. This covers the case where the scene really is empty and the question is how long to hold it.

WorldServerID

The world server identifier that owns this scene instance. This links the instance to a specific world server record in central services.

long WorldServerID { get; set; }

Property Value

long

Methods

AddCharacterCount(int)

Adds to the current character count for the scene instance.

void AddCharacterCount(int count)

Parameters

count int

Amount to add to the character count. May be negative to decrement. Implementations should clamp the resulting count to zero if necessary.

Remarks

This method is a convenience used by scene server implementations to update the CharacterCount. Callers should prefer atomic or synchronized implementations when updating counts from multiple threads.