Skip to main content
Thank you for your interest in contributing to Nitrox Unlocked! This guide will help you get started with development, understand our standards, and submit your contributions.

Getting Started

Prerequisites

Before you begin, ensure you have:

Development Tools

  • Visual Studio 2022 or JetBrains Rider
  • .NET 7 SDK or later
  • Git for version control

Game Requirements

  • Subnautica installed
  • Knowledge of C# and Unity basics
  • Familiarity with Harmony patching (helpful)

Development Setup

1

Clone the Repository

git clone https://github.com/Papela/Nitrox-Cracked-Mod.git
cd Nitrox-Cracked-Mod
2

Open Solution

Open Nitrox.sln in Visual Studio or Rider. The solution contains all projects:
  • Nitrox.Launcher
  • NitroxPatcher
  • NitroxClient
  • Nitrox.Server.Subnautica
  • Nitrox.Model
  • Nitrox.Model.Subnautica
  • Nitrox.Test
3

Configure Subnautica Path

The build system will prompt you for your Subnautica installation path on first build. This is needed to reference the game’s assemblies.
4

Build the Solution

dotnet build Nitrox.sln
Or use your IDE’s build function (Ctrl+Shift+B in Visual Studio).
5

Run Nitrox Launcher

Set Nitrox.Launcher as the startup project and run it. The launcher will help you configure and start the game with Nitrox.
The first build may take a few minutes as it resolves NuGet packages and references Subnautica’s assemblies.

Project Structure

Understanding the codebase organization:
Nitrox-Cracked-Mod/
├── Nitrox.Launcher/          # Desktop application (Avalonia UI)
├── NitroxPatcher/            # Harmony patches and game injection
│   ├── Patches/
│   │   ├── Dynamic/          # Multiplayer-only patches
│   │   └── Persistent/       # Always-active patches
│   └── Main.cs               # Entry point
├── NitroxClient/             # Client-side multiplayer logic
│   ├── Communication/        # Networking layer
│   ├── GameLogic/            # Client game systems
│   └── MonoBehaviours/       # Unity components
├── Nitrox.Server.Subnautica/ # Dedicated server
│   └── Models/               # Server-side systems
├── Nitrox.Model/             # Shared core library
│   ├── Packets/              # Packet base classes
│   └── DataStructures/       # Common data types
├── Nitrox.Model.Subnautica/  # Subnautica-specific models
│   └── Packets/              # Game-specific packets
└── Nitrox.Test/              # Unit and integration tests

Building From Source

Build Configurations

  • Debug: Includes debug symbols, extended timeouts, verbose logging
  • Release: Optimized for production use
# Debug build
dotnet build -c Debug

# Release build
dotnet build -c Release

Common Build Issues

Ensure your Subnautica path is correctly configured. Check Directory.Build.targets for the path resolution logic.
dotnet restore --force
dotnet nuget locals all --clear
Clean and rebuild the entire solution:
dotnet clean
dotnet build

Code Standards

We follow specific coding standards to maintain code quality:

General Principles

Clean & Minimal

Write concise, readable code. Avoid unnecessary complexity or over-engineering.

No AI Bloat

If using AI for code generation, review and simplify before submitting. We prefer human-written, thoughtful code.

C# Style Guide

// ✅ Good: Clear, concise, follows conventions
public class PlayerMovementHandler
{
    private readonly IPacketSender packetSender;
    
    public PlayerMovementHandler(IPacketSender packetSender)
    {
        this.packetSender = packetSender;
    }
    
    public void SendMovementUpdate(Vector3 position, Quaternion rotation)
    {
        packetSender.Send(new PlayerMovement(position, rotation));
    }
}

// ❌ Bad: Over-commented, verbose
public class PlayerMovementHandler
{
    // This is the packet sender that we use to send packets
    private readonly IPacketSender packetSender;
    
    /// <summary>
    /// Constructor that initializes the packet sender
    /// </summary>
    /// <param name="packetSender">The packet sender to use</param>
    public PlayerMovementHandler(IPacketSender packetSender)
    {
        // Set the packet sender field to the provided value
        this.packetSender = packetSender;
    }
    
    // This method sends a movement update to the server
    public void SendMovementUpdate(Vector3 position, Quaternion rotation)
    {
        // Create a new player movement packet
        PlayerMovement packet = new PlayerMovement(position, rotation);
        // Send the packet using the packet sender
        packetSender.Send(packet);
    }
}

Commenting Guidelines

/// <summary>
/// Prevents the Aurora explosion from triggering when a player is in creative mode,
/// as it would desync the timeline for other players still in survival mode.
/// </summary>
public static bool Prefix(AuroraExplosion __instance)
{
    return !localPlayer.IsCreativeMode;
}
Key principle: Explain WHY, not WHAT. The code itself shows what it does.

Patch Documentation

Harmony patches should have comments explaining the purpose:
namespace NitroxPatcher.Patches.Dynamic;

/// <summary>
/// Synchronizes base piece deconstruction across all players.
/// Uses transpiler to inject packet sending at precise points in the deconstruction flow.
/// </summary>
public sealed partial class BaseDeconstructable_Deconstruct_Patch : NitroxPatch, IDynamicPatch
{
    // Implementation...
}

Making Contributions

Finding Issues to Work On

  1. Check the GitHub Issues
  2. Look for issues labeled good first issue or help wanted
  3. Comment on the issue to indicate you’re working on it
  4. Ask questions if anything is unclear

Creating a Pull Request

1

Create a Feature Branch

git checkout -b feature/your-feature-name
Use descriptive branch names:
  • feature/add-inventory-sync
  • fix/base-deconstruction-crash
  • refactor/packet-serialization
2

Make Your Changes

Write clean, focused commits:
git add .
git commit -m "Add inventory synchronization for storage containers"
Commit messages should be concise and descriptive.
3

Test Your Changes

  • Build the solution without errors
  • Test in-game (both single player and multiplayer if applicable)
  • Verify no regressions in existing features
  • Add unit tests for new functionality when possible
4

Push and Create PR

git push origin feature/your-feature-name
Go to GitHub and create a Pull Request with:
  • Clear title describing the change
  • Brief description (not 50 paragraphs!)
  • Reference any related issues

Pull Request Guidelines

Keep PR descriptions concise. We don’t have resources to read 50 paragraphs explaining why you changed 5 lines of code. Only elaborate if the purpose isn’t obvious.
Good PR description:
## Summary
Adds synchronization for storage container contents when items are added/removed.

Fixes #123

## Changes
- Added StorageContainerSync packet
- Patched ItemsContainer.AddItem and RemoveItem
- Server broadcasts changes to other players

## Testing
Tested with multiple players adding/removing items from lockers simultaneously.
Bad PR description (too verbose):
## Introduction
I noticed that when I was playing with my friend, the storage containers...
[47 more paragraphs explaining the entire history of the bug and your thought process]

AI Usage Policy

You’re free to use AI tools to assist with code generation, but please review and refine the output before submitting.

Guidelines

  • Review AI code carefully: Nitrox interacts intimately with Subnautica’s codebase, which AI models don’t have access to
  • Never upload Subnautica source code to AI: The game’s code is copyrighted and uploading it violates copyright law
  • Simplify AI output: Remove unnecessary verbosity, comments, and over-engineering
  • Understand the code: Don’t submit code you don’t understand

What NOT to do:

// ❌ AI-generated code with excessive comments and unnecessary complexity

/// <summary>
/// This interface represents a factory that creates instances of player objects
/// in the multiplayer environment. It provides a abstraction layer for player
/// creation that allows for dependency injection and testability.
/// </summary>
public interface IPlayerFactory
{
    /// <summary>
    /// Creates a new player instance with the specified parameters.
    /// </summary>
    /// <param name="id">The unique identifier for the player</param>
    /// <param name="name">The display name of the player</param>
    /// <returns>A new instance of the Player class</returns>
    Player CreatePlayer(ushort id, string name);
}

// Just do this instead:
public interface IPlayerFactory
{
    Player CreatePlayer(ushort id, string name);
}

Testing

Running Tests

Nitrox includes a test project:
dotnet test Nitrox.Test/Nitrox.Test.csproj

Writing Tests

Add tests for new functionality:
[TestClass]
public class PacketSerializationTests
{
    [TestMethod]
    public void ChatMessage_SerializesAndDeserializes()
    {
        // Arrange
        var original = new ChatMessage(123, "Hello world");
        
        // Act
        byte[] serialized = original.Serialize();
        Packet deserialized = Packet.Deserialize(serialized);
        
        // Assert
        Assert.IsInstanceOfType(deserialized, typeof(ChatMessage));
        var chatMsg = (ChatMessage)deserialized;
        Assert.AreEqual(123, chatMsg.PlayerId);
        Assert.AreEqual("Hello world", chatMsg.Text);
    }
}

Debugging

Debugging the Patcher

  1. Set NitroxPatcher as startup project
  2. In project properties, set:
    • Executable: Path to Subnautica.exe
    • Arguments: --nitrox "path/to/nitrox/launcher"
  3. Set breakpoints in your patch code
  4. Press F5 to debug

Debugging the Server

  1. Set Nitrox.Server.Subnautica as startup project
  2. Set breakpoints in server code
  3. Press F5 to start server in debug mode
  4. Connect with a client

Logging

Use the Log class for debugging:
Log.Debug("Detailed debug information");
Log.Info("General information");
Log.Warn("Warning message");
Log.Error("Error occurred");
Log.Error(exception, "Error with exception");
Logs are written to:
  • Client: Subnautica’s log directory
  • Server: Server’s working directory

Getting Help

Discord Community

Join our Discord server for real-time help and discussion with other developers.

GitHub Issues

Report bugs or request features through GitHub Issues.

Code Review Process

When you submit a PR:
  1. Automated Checks: GitHub Actions will run builds and tests
  2. Code Review: Maintainers will review your code for:
    • Code quality and style
    • Functionality and correctness
    • Performance implications
    • Potential bugs or edge cases
  3. Feedback: You may receive comments requesting changes
  4. Approval: Once approved, your PR will be merged
Be patient with the review process. Maintainers are volunteers and may take time to review PRs thoroughly.

Best Practices

Performance

  • Avoid allocating in hot paths (every frame)
  • Use object pooling for frequently created objects
  • Cache references instead of repeated GetComponent calls
  • Profile before optimizing (don’t prematurely optimize)

Networking

  • Choose appropriate delivery methods for packets
  • Batch related updates when possible
  • Validate all input from clients on the server
  • Never trust client data for authoritative actions

Patching

  • Use dynamic patches for multiplayer-only features
  • Document why you’re patching (not just what)
  • Test patches with game updates (they may break)
  • Prefer simple patches over complex transpilers

License

Nitrox Unlocked is licensed under GNU GPL v3. By contributing, you agree that your contributions will be licensed under the same terms.

Disclaimer

This project is a modified version of the original Nitrox mod. It is not affiliated with or supported by the official Nitrox team. Use at your own risk.
Official Nitrox support is not responsible for helping with this version. All support should be directed to this project’s community channels.

Thank You!

Your contributions help make Nitrox Unlocked better for everyone. Whether it’s code, documentation, bug reports, or community support, every contribution matters. If you found this project helpful, please give it a star on GitHub! ⭐

Architecture

Learn about the project structure

Patching System

Understand Harmony patching

Networking

Explore the networking layer

Build docs developers (and LLMs) love