Table of Contents

Class FogOfWarStore

Namespace
FishMMO.Client
Assembly
FishMMO.Client.dll

Reads and writes a character's explored-territory maps on the local machine.

public static class FogOfWarStore
Inheritance
FogOfWarStore
Inherited Members

Remarks

Why it never goes to the server. Exploration is a per-character convenience that changes several times a second and is worth nothing to anybody else. Sending it would mean a write path, a table, a migration and a sync broadcast for data whose entire purpose is to decide which pixels are dark. A player who reinstalls loses their revealed map and re-walks it, which is a fair trade for a subsystem that costs the server nothing.

What the signature is for, and what it is not. Each file carries an HMAC over its contents, keyed from the character and a build constant. That detects a file edited by hand or copied from another character, and it makes the failure loud instead of silent — a mismatched file is discarded and exploration starts again rather than being trusted. It is explicitly not a defence against a determined player: the key is in the binary, so anybody willing to extract it can forge a fully-revealed map.

That is acceptable because of where the value lives. Revealing the map early gains a player nothing the game rewards — the Cartography skill this feeds must be advanced by the server, from the positions it already receives, and never from anything read out of this file. Keep it that way and forging the file buys a nicer-looking minimap and no progression at all.

Fields

DirectoryName

Folder, under the install directory, holding every character's maps.

public const string DirectoryName = "Cartography"

Field Value

string

Methods

CharacterDirectory(long)

The folder holding one character's explored maps.

public static string CharacterDirectory(long characterID)

Parameters

characterID long

The character's ID.

Returns

string

An absolute path. The folder may not exist yet.

DeleteAll(long)

Deletes every explored map belonging to a character.

public static void DeleteAll(long characterID)

Parameters

characterID long

The character's ID.

Remarks

Offered so the options panel can give the player a way to start their maps again, and so a character deleted on the server does not leave its maps behind forever.

FilePath(long, string)

The file holding one character's explored map for one scene.

public static string FilePath(long characterID, string sceneName)

Parameters

characterID long

The character's ID.

sceneName string

The scene's name.

Returns

string

An absolute path. The file may not exist yet.

Load(long, string, Rect, float)

Loads a character's explored map for a scene.

public static FogOfWarMap Load(long characterID, string sceneName, Rect worldRect, float cellSize)

Parameters

characterID long

The character's ID.

sceneName string

The scene's name.

worldRect Rect

The rectangle the map must cover.

cellSize float

The cell size the map must use.

Returns

FogOfWarMap

The stored map, or null when there is no usable file. A null return is the normal case for a character who has not been to the scene before and is not an error.

Save(long, string, FogOfWarMap)

Writes a character's explored map for a scene.

public static bool Save(long characterID, string sceneName, FogOfWarMap map)

Parameters

characterID long

The character's ID.

sceneName string

The scene's name.

map FogOfWarMap

The map to write.

Returns

bool

True when the file was written.