Tier 4
Series 305
305B: The Network Var
"If you change a variable like `health = 50` on your computer, nobody else sees it. To the other players, you are still at 100 HP. A Navigator replaces standard variables with NetworkVariables to sync data across the fleet."
The Concept: NetworkVariable<T>
A wrapper that automatically tells the server when a value changes.
* **Read:** Everyone can read it.
* **Write:** Usually only the Server can write to it (Server Authority).
* **OnValueChanged:** An event that fires when the data updates.
* **Read:** Everyone can read it.
* **Write:** Usually only the Server can write to it (Server Authority).
* **OnValueChanged:** An event that fires when the data updates.
Red Flag Detected
The AI Trap: "The Local Variable"
You ask the AI: "Create a health script."
// AI-Generated Code: Desync City
public int health = 100;
void TakeDamage(int dmg) {
// Audit Fail: This happens only on the shooter's screen.
// The victim doesn't know they died.
health -= dmg;
}
This is "State Desynchronization." The game state is now different for every player.
Elite Telemetry
Research shows "Elite" teams achieve 15% faster lead times by keeping AI on a "very tight leash."
- Small Batches Solving one problem at a time prevents logic drift.
- Modular Design Localizing the "blast radius" of AI changes.
- Tight Loops Rapid iteration with constant code review.
The Navigator's Correction
Corrective Protocol
// Corrected: Synced State
public NetworkVariable<int> health = new NetworkVariable<int>(100);
void TakeDamage(int dmg) {
if (IsServer) health.Value -= dmg;
}
Your Pilot Command
> A skilled Navigator directs the AI to use NetworkVariables.