NightCoop
For mod authors

NightCoop SDK

Make your Cyberpunk 2077 mod work in a co-op session. It talks to the same mod on the partners’ machines, keeps shared state through the host and puts its own data on the players, cars and NPCs everyone sees.

The SDK and its documentation are in English.

C · RED4ext redscript Cyber Engine Tweaks · Lua MIT

Version 1 · 31 files · SHA-256 of the archive 52993842cf342c8a…

Inside

What your mod gets

One core, three ways in: a RED4ext plugin, redscript or Cyber Engine Tweaks, and a mod may mix them. Without NightCoop, or with its SDK switched off, the calls do nothing and your mod runs as before.

Channels

Messages to your mod on other machines

Reliable or not, to one player, to the host or to everyone who has your mod.

Channels
Shared state

Facts the host keeps

Keys and values, the same for everyone, late joiners included. A guest’s write is a request the host may refuse.

Shared state
Entity state

Your data on what everyone sees

Attached to a player, a car or an NPC by its owner and delivered to every copy of it, on every machine.

Entity state
Spawns

Your spawns, for everyone

Entities your mod spawns appear for the partners too; NightCoop says who leads each one and hands it over.

Shared spawns
NPCs

Effects on NPCs a partner leads

Statuses, damage and pushes reach the machine where the NPC really lives, instead of a copy that only follows it.

Effects on NPCs
Pose and actions

A body from VR or motion capture

Feed a pose and the partners see it on your body; call NightCoop’s own actions by name.

Pose, actions
Fallbacks

Content a partner does not have

A car, a weapon, a radio station or a pose from your mod: what NightCoop shows a partner without it, and how you pick it.

Content fallbacks
Interface

The co-op menu and votes

Your items in NightCoop’s menu, your questions in its voting window, and what each partner is doing right now.

Menu, votes, partners
No code

A mod made only of data

A car, clothes, a tweak or a quest phase: a small *.nightcoop file tells NightCoop what it needs in a session.

Manifest
Start here

From a single-player mod to a co-op one

The order the guides are written for. The concepts take ten minutes and save you the usual bugs.

  1. Read the conceptsSessions, the host’s authority, who owns what: Concepts.
  2. Pick your languageConnect and register, and keep working without NightCoop: C / RED4ext, redscript or Cyber Engine Tweaks.
  3. Sort what your mod doesWhat stays local, what goes through the host, what goes on an entity: Make your mod co-op.
  4. Run an exampleA shared counter in C++, redscript and Lua: Examples.
  5. Test with two playersWhen something does not arrive: Troubleshooting.
  6. Before you replace a game function@replaceMethod, a CET Override or a detour: read What not to hook first.
Documentation

Every page of the SDK

  1. StartConceptsSession, host and guests, authority, ownership, "in the host's world", the mod passport
  2. StartStart: C / RED4extRED4ext plugin: find NightCoop, register, hooks, unregister, shutdown
  3. StartStart: redscript@if(ModuleExists("NightCoop")), registering in a ScriptableSystem, events
  4. StartStart: Cyber Engine TweaksThe same class from Lua, polling in onUpdate, the helper sdk/cet/nightcoop_sdk.lua
  5. GuideMake your mod co-opStep by step: turning a single-player mod into a co-op one; a checklist by kind of mod; common mistakes
  6. CodeExamplesA shared counter in C++, redscript and Lua: registering, shared state, a channel message
  7. ReferenceAPI referenceEvery function: C name, script name, what it does, return codes
  8. ReferenceLimits and versionsSizes, rates, queues, NCSDK_VERSION, how the interface grows, the mod's protocol
  9. GuideShared spawnsEntities your mod spawns: share, keep local, who leads (handoff to the nearest player, vehicles led by the driver), CET spawns
  10. GuideEffects on NPCsEffects on NPCs a partner leads (statuses, damage, pushes, time, sides, kills, roles), your own logic on the owner's machine, slowing your world
  11. GuideContent fallbacksContent a partner may not have: what NightCoop shows instead (cars, weapons, radio, weather, poses), how your mod names a fallback
  12. GuideManifestA mod without code (TweakXL, ArchiveXL, quest phases): the *.nightcoop file next to it
  13. ReferenceWhat not to hookFunctions co-op relies on (script, native), its keys, data; what NightCoop finds itself and what it cannot find; hookDeclare
  14. GuideTroubleshootingLog lines, NightCoopSdkStatus(), switches
  15. ReferenceSecurityThreat model, what a partner can and cannot do through the SDK, checklists for port authors and reviewers
  16. CodePortsLet There Be Flight in co-op: a full mod built only on this SDK
Code

Examples and ports

The examples show the core in a few dozen lines. The ports are full mods made co-op on the public SDK alone: each is installed next to the mod it bridges, and neither mod is changed.

Example · C++

RED4ext plugin

Finds NightCoop, registers, counts on the host, checks a guest’s request in a hook.

counter.cpp
Example · redscript

A scriptable system

Registers in OnAttach, listens to events, compiles without NightCoop.

CoopCounter.reds
Example · Lua

Cyber Engine Tweaks

The helper nightcoop_sdk.lua, a hotkey and polling in onUpdate.

init.lua
Port · MIT

Let There Be Flight

A full mod in co-op, built only on this SDK: the driver’s flight on the partners’ mirrors, thrusters and sound included; passengers in a flying car.

Flight port
Files

What is in the archive

The same files one by one. NightCoop installs its own .reds and adds them to the redscript compilation itself: read them here, never ship them with your mod. Ship only your own files and guard your NightCoop code with @if(ModuleExists("NightCoop")).

FileWhatSize
LICENSEMIT: the SDK and the port's own code1.0 KBDownload
README.mdWhat the SDK is: its layout, the port, shipping, the license2.6 KBDownload
SECURITY.mdThreat model: what a partner can and cannot do through the SDK, checklists15.9 KBDownload
cet/nightcoop_sdk.luaLua helper for Cyber Engine Tweaks mods: registration, polling in onUpdate37.4 KBDownload
docs/README.mdThe contents of the guides3.3 KBDownload
docs/api.mdGuide: API reference47.1 KBDownload
docs/concepts.mdGuide: Concepts9.6 KBDownload
docs/content-fallbacks.mdGuide: Content a partner may not have8.8 KBDownload
docs/do-not-hook.mdGuide: What not to hook: functions co-op relies on46.0 KBDownload
docs/getting-started-c.mdGuide: Getting started: C / C++ (RED4ext plugin)6.8 KBDownload
docs/getting-started-cet.mdGuide: Getting started: Cyber Engine Tweaks (Lua)5.6 KBDownload
docs/getting-started-redscript.mdGuide: Getting started: redscript5.6 KBDownload
docs/limits-and-versions.mdGuide: Limits and versions5.1 KBDownload
docs/make-your-mod-coop.mdGuide: Make your mod co-op11.2 KBDownload
docs/manifest.mdGuide: The manifest: a mod without code3.2 KBDownload
docs/npc-effects.mdGuide: Effects on NPCs a partner leads17.3 KBDownload
docs/shared-spawns.mdGuide: Shared spawns11.8 KBDownload
docs/troubleshooting.mdGuide: Troubleshooting7.1 KBDownload
examples/c-counter/README.mdThe C++ example: what it does, building, what you should see2.6 KBDownload
examples/c-counter/build.ps1Builds the plugin with MSVC2.8 KBDownload
examples/c-counter/counter.cppA RED4ext plugin with a shared counter10.2 KBDownload
examples/lua-counter/README.mdThe Lua example: what it does, installing, what you should see2.0 KBDownload
examples/lua-counter/init.luaA Cyber Engine Tweaks mod with a shared counter3.0 KBDownload
examples/redscript-counter/CoopCounter.redsA redscript mod with a shared counter4.4 KBDownload
examples/redscript-counter/README.mdThe redscript example: what it does, installing, using1.9 KBDownload
include/nightcoop_sdk.hThe C interface for RED4ext plugins, the source of truth for names and signatures72.6 KBDownload
ports/flight/README.mdThe Let There Be Flight port: the driver's flight on the partners' screens2.5 KBDownload
ports/flight/THIRD_PARTY.mdNotice of Let There Be Flight (MIT)1.4 KBDownload
ports/flight/r6/scripts/NightCoopFlight/NightCoopFlight.redsThe port: one redscript file30.0 KBDownload
redscript/NightCoop/NightCoopSdk.redsmodule NightCoop with the enums11.1 KBDownload
redscript/NightCoop/NightCoopSdkNative.redsThe class NightCoopSdk and the event class, for redscript; CET reaches the same class22.4 KBDownload
Before you ship

Versions, license, security

Version
This is the first version of the SDK, and everything on these pages belongs to it. NightCoop installs its own .reds with the build; ask at run time whether the SDK is there: NightCoopSdkGet returns NULL in C and NightCoopSdk.Version() returns 0 in scripts when there is no SDK or the player switched it off. How the interface grows without breaking your mod: Limits and versions.
License
The SDK (the header, the .reds, the Lua helper, the guides, the examples and the port’s own code) is MIT: use it in any mod, open or closed. The port keeps the notice of the mod it bridges.
Security
A partner’s data is untrusted. What a partner can and cannot do through the SDK, what the host and the player can switch off, and checklists for port authors and reviewers: Security. Report a vulnerability privately to the moderators on our Discord, not in public channels.