Prerequisites:
- .NET 8.0 SDK or later
- Visual Studio 2022 or JetBrains Rider
- Basic knowledge of C# programming
- Final Fantasy XIV installed with Dalamud
What is a Dalamud Plugin?
Dalamud plugins are .NET assemblies that extend the functionality of Final Fantasy XIV. They have access to the Dalamud API, which provides:- Game state information (player data, inventory, party members, etc.)
- UI rendering capabilities via ImGui
- Command registration for chat commands
- Event hooks for game events
- Inter-plugin communication (IPC)
- Memory manipulation and function hooking
Plugin Architecture
Every Dalamud plugin must:- Implement
IDalamudPlugin- The core plugin interface - Include a manifest - A JSON file describing your plugin
- Accept
IDalamudPluginInterface- Provides access to Dalamud services - Be disposable - Clean up resources when unloaded
Basic Plugin Structure
Setting Up Your Development Environment
Install the .NET SDK
Choose an IDE
Recommended IDEs:
- Visual Studio 2022 (Community edition is free)
- JetBrains Rider (Paid, but excellent for C# development)
- Visual Studio Code with C# extensions
Install Dalamud Development Packages
Dalamud packages are available on NuGet. You’ll primarily need:This package handles:
- Building your plugin manifest
- Packaging your plugin for distribution
- Including required Dalamud assemblies
Plugin Lifecycle
Understanding the plugin lifecycle is crucial:Load
- Dalamud locates your plugin DLL
- Loads the assembly into a separate
AssemblyLoadContext - Finds the type implementing
IDalamudPlugin - Creates an instance via dependency injection
- Your constructor executes
Run
Your plugin is now active:
- Event handlers receive game events
- UI draws on every frame
- Commands are registered and callable
- Services are accessible
Load Reasons
Your plugin receives aPluginLoadReason indicating why it was loaded:
Development Workflow
Build and Test Locally
Build and Test Locally
- Build your project in Debug mode
- Copy output to
devPlugins/YourPlugin/ - Type
/xlpluginsin-game to open the plugin installer - Enable “Dev Plugin Manager” settings
- Load your plugin from the Dev Plugins tab
Hot Reload
Hot Reload
Dev plugins support hot reloading:
- Make changes to your code
- Build the project
- Use
/xldevin-game - Click “Reload” next to your plugin
Debug with Visual Studio
Debug with Visual Studio
- Set build output to your
devPluginsfolder - Start FFXIV with Dalamud
- In Visual Studio: Debug → Attach to Process
- Select
ffxiv_dx11.exe - Set breakpoints in your code
Best Practices
Always Dispose
Properly clean up all resources in
Dispose(). Leaked resources can cause crashes or performance issues.Use Dependency Injection
Request services through constructor parameters. Dalamud will inject them automatically.
Handle Errors Gracefully
Wrap risky operations in try-catch blocks. Uncaught exceptions will crash the game.
Test on Multiple API Levels
Ensure your plugin works with the current Dalamud API level. Update dependencies regularly.
Next Steps
Now that you understand the basics, let’s create your first plugin:Creating Your First Plugin
Follow our step-by-step guide to build a complete plugin