Narrative Identifiers
Many scripting commands, and many parts of Socially Distant's C# API, accept narrative identifiers as parameters. But what are they, why are they useful, how do they work, and what are they for? That's what this page will tell you.
What are Narrative Identifiers?
Let's consider your social media profile in real life. You have a username, likely an @handle
. You also have other attributes associated with your profile that you can change at any time, like your name and "About me" section. You can even have the same name as someone else, and share an avatar with a third person. Or, you can choose not to set any of these attributes on your profile, and the site will show defaults instead.
However, although you can change your username, you can't have the same username as someone else. You are also required to have one, it must be unique, of a certain format (usually not allowing whitespace). Changing that username also changes things like the URL to your profile, and people can no longer technically use it to look up your profile. This is because that username acts as your unique identification, for all intents and purposes.
Furthermore, while other people treat your username as a unique ID to reference your profile by, the social media platform itself generates its own unique identifier for you that never changes and is always bound to you. This value is stored in the database, but is usually only machine-readable. These IDs are used to attribute things like social posts and chat messages to you.
In Socially Distant, all in-game characters - including the player - have a social media profile. These profiles also have the same attributes that yours does in real life. Each profile has a username, an "About Me" section, a profile picture, and a unique machine-readable ID that never changes and is used to attribute social posts to the profile in Socially Distant's save file.
However, there are more things in Socially Distant than social profiles. There are other objects, like computers, chat servers, email messages, and more. These objects are collectively called Narrative Objects. Narrative Objects are "living" objects in the game world, that are stored in the save file, but that are controlled by in-game scripts that all need a human-friendly way of addressing the narrative objects they control. But unlike a social profile, most of these objects don't have a username they can be identified by. This is the role that narrative identifiers fulfill.
How do they work?
Each world object in Socially Distant is assigned a unique ObjectId
value called the object's InstanceId
. This ID isn't predictable across playthroughs, and is only known at the exact time a given object is created by the game.
Narrative Objects also contain a property, saved in the save file alongside the object's InstanceId
, called its NarrativeId
. This is just a nullable string?
property on the world object's data structure.
However, unlike the InstanceId
being generated when creating the world object, the NarrativeId
is specified when creating the world object. This means that it can be used to reference an object without it needing to be created first.
In addition to being well-known, narrative identifiers do not change across playthroughs.
In fact, a full codified list of every narrative identifier used in the game's Career Mode may be found here: Career Mode Narrative Objects
How to use Narrative Identifiers
Narrative Identifiers are just text, and the game doesn't technically care what that text is as long as it isn't an empty string. However, there are some conventions you should follow when coming up with a narrative identifier for an object.
Narrative Identifiers generally take the form of prefix:object_id
, where prefix
denotes the type of narrative object, and object_id
denotes the specific object itself.
Narrative identifiers shouldn't:
- Contain whitespace
- Contain non-printable characters of any kind
- Contain emoji or Unicode private use codepoints (like Socially Distant UI icons)
- Contain colons (
:
), other than the delimiter betweenprefix
andobject_id
- Use the term
player
as theobject_id
. These narrative identifiers are reserved by the codebase for objects specifically belonging to the player, typically not directly stored in the world.
Base-game prefixes
The following narrative ID prefixes are used for objects defined in the base game. Mod authors should maintain their own list of prefixes if defining their own object types.
Prefix | Description |
---|---|
npc |
Social profiles |
dev |
Computers, phones, and other hackable devices |
lan |
Local area networks |
mission |
Missions |
guild |
Chat servers |
district |
Major areas of the city |
isp |
Internet service providers |
news |
News articles |
post |
Social posts |
msg |
Chat mesasges |
mail |
Email messages |
thread |
Conversation threads, either DMs or channels within a guild |
file |
Files spawned on a device by a mission |
location |
Notable locations on the city map |
Important: Placeholder Objects
Narrative identifiers do not require an object to be created with them in order to be considred valid. If you attempt to reference an object by narrative identifier, and said object doesn't exist in the save file, a placeholder will be created on the fly. This placeholder can then be filled out with actual attributes by another script.
Placeholder objects are generated with default values, and are only there so your code functions without needing to immediately come up with names for things or design profile pictures. In cases where the player uninstalls a mod during an active playthrough, this feature also makes sure the save file will still load properly and that any narrative objects created by the missing mod can still be considered valid. That being said, it is not a good idea to load a save file requiring missing mods, and the game will still reject it.