Quests¶
Much of the game's open world is driven by quest phases. Vendors, ambient
NPC conversations, crowds and many smaller interactions. Our multiplayer session
doesn't run them by default, to give you full control on how you want your game
state to look like. quest.QuestsSystem.LoadPhase loads a phase from its .questphase
resource and runs it, so your bundle can bring back exactly the parts of the open world it wants.
The video loads the open world phases below, talks to a vendor, switches the
player's body with re.Ui.ShowBodyGenderSelector and talks to the vendor again.
The player's voice lines switch to the other voice, something that never happens in single player
but is possible in our sessions
Quests are part of the client realm API.
Community sync is work in progress
NPCs that quest phases spawn through communities (crowds, vendors and other populated spots) are not synced between clients yet. Each player sees and talks to their own copy
Loading phases¶
static readonly string[] OpenWorldPhases =
[
"base\\open_world\\community\\global_phase\\open_world_global_commuinity_phase.questphase",
"base\\open_world\\vendors\\open_world_vendors.questphase",
"base\\open_world\\phases\\chats\\open_world_chats.questphase",
"base\\open_world\\phases\\city_entities\\city_entities.questphase",
"base\\open_world\\phases\\radio\\open_world_radio.questphase",
];
static readonly List<ulong> Loaded = [];
static void LoadOpenWorld()
{
// Unlocks content the game gates behind the prologue
var quests = ScriptGameInstance.GetQuestsSystem(ScriptGameInstance.Get());
quests?.SetFact(new CName("q000_done"), 1);
quests?.SetFact(new CName("q101_enable_side_content"), 1);
foreach (var path in OpenWorldPhases)
{
if (quest.QuestsSystem.LoadPhase(new ResRef(path)) is { } handle)
{
Loaded.Add(handle);
}
}
}
LoadPhasereturns a handle forUnloadPhaseandGetPhaseState. Handles belong to the bundle that loaded the phase- A phase that is already loaded, by any bundle, is not loaded a second time. The phase keeps running until every handle to it is unloaded
LoadPhasereturnsnullwhen the path is not in the game depot, the reason is in the client log. A path that exists but is not a quest phase fails later,GetPhaseStatethen returnsFailedand the reason is in the client log too- Phases loaded by a bundle are unloaded when the bundle unloads
Some phases check facts, the game's quest variables, before they enable
their content. Set them with SetFact on the game's quests system as in the
example above.
Open world phases¶
| Phase | Enables |
|---|---|
base\open_world\community\global_phase\open_world_global_commuinity_phase.questphase |
The global communities that populate the city |
base\open_world\vendors\open_world_vendors.questphase |
Vendors |
base\open_world\phases\chats\open_world_chats.questphase |
Ambient NPC conversations |
base\open_world\phases\city_entities\city_entities.questphase |
City entities |
base\open_world\phases\radio\open_world_radio.questphase |
Radio stations (Unknown consequences) |
base\gameplay\devices\binoculars\sightseeing_binoculars_phase.questphase |
Tourist binoculars |
base\open_world\scenes\mirrors\mirror_interactions_control.questphase |
Mirror prompts |
The first five are children of base\open_world\phases\open_world_content.questphase,
the phase that runs the whole open world in the base game. Its other children
add street stories, fixer gigs, combat events, cyberpsychos, the metro,
taxis and quest blockades, which send messages, spawn hostiles or give items.
Load them individually if your bundle wants them.
Phase state¶
quest.QuestsSystem.GetPhaseState(handle) returns:
| State | Meaning |
|---|---|
Unknown |
No phase with this handle (never loaded, or unloaded) |
Loading |
The phase resource is loading |
Running |
The phase is running |
Failed |
The resource failed to load or is not a quest phase, check the client log |
Unloading¶
The phase stops once no handle references it. Stopping ends the phase's
logic, like its scenes and interactions, but NPCs it spawned, communities it
activated, facts and map pins remain. UnloadPhase returns false for
unknown handles.
Blocking phases¶
quest.QuestsSystem.BlockPhase(path) keeps a phase from running. Use it to
keep a part of the open world out of the session, for example a child phase
of a phase you load:
quest.QuestsSystem.BlockPhase(new ResRef("base\\open_world\\phases\\radio\\open_world_radio.questphase"));
- The blocked phase still starts, with nothing in it. Blocks only affect phases started afterwards
- Only phases the game loads from their own
.questphasefile can be blocked. Phases embedded in another phase have no path to filter on UnblockPhase(path)removes your block, also only for phases started afterwards- Blocks belong to the bundle that added them and are removed when it unloads