Skip to content

Chapter 2.3: mod.cpp & Workshop

Home | << Previous: config.cpp Deep Dive | mod.cpp & Workshop | Next: Minimum Viable Mod >>


Indice dei Contenuti


Panoramica

mod.cpp sits at the root of your mod folder (next to the Addons/ directory). The DayZ launcher reads it to display your mod's name, logo, description, and author in the mod selection screen.

Punto chiave: mod.cpp is NOT compiled. E' not Enforce Script. E' a simple key-value file read by the launcher. Non ci sono classes, no semicolons after closing braces, no arrays with [] syntax (with one exception for Workshop script modules -- vedi below).


Where mod.cpp Lives

@MyMod/                       <-- Workshop/launch folder (prefixed with @)
  mod.cpp                     <-- This file
  Addons/
    MyMod_Scripts.pbo
    MyMod_Data.pbo
  Keys/
    MyMod.bikey
  meta.cpp                    <-- Auto-generated by Workshop publisher

The @ prefix on the folder name is convention for Steam Workshop mods but not strictly richiesto.


Riferimento Completo dei Campi

FieldTypeScopoObbligatorio
namestringMod display nameYes
picturestringLarge image in expanded descriptionNo
logostringLogo below the game menuNo
logoSmallstringSmall icon next to mod name (collapsed)No
logoOverstringLogo on mouse hoverNo
tooltipstringTooltip on mouse hoverNo
tooltipOwnedstringTooltip when mod is installedNo
overviewstringLonger description in mod detailsNo
actionstringURL link (website, Discord, GitHub)No
actionURLstringAlternative to action (same purpose)No
authorstringAuthor nameNo
authorIDstringSteam64 ID of the authorNo
versionstringVersion stringNo
typestring"mod" or "servermod"No
extraintReserved field (always 0)No

Dettagli dei Campi

name

The display name shown in the DayZ launcher mod list and in-game mod screen.

cpp
name = "MyFramework";

Puoi use string table references for localization:

cpp
name = "$STR_DF_NAME";    // Resolves via stringtable.csv

picture

Path to a larger image displayed when the mod description is expanded. Supports .paa, .edds, and .tga formats.

cpp
picture = "MyMod/GUI/images/logo_large.edds";

The path is relative to the mod root. If empty or omitted, no image is shown.

The principale logo displayed below the game menu when the mod is loaded.

cpp
logo = "MyMod/GUI/images/logo.edds";

logoSmall

Small icon shown next to the mod name when the description is collapsed (not expanded).

cpp
logoSmall = "MyMod/GUI/images/logo_small.edds";

logoOver

The logo that appears when the user hovers their mouse over the mod logo. Often the same as logo but can be a highlighted/glowing variant.

cpp
logoOver = "MyMod/GUI/images/logo_hover.edds";

tooltip / tooltipOwned

Short text shown when hovering over the mod in the launcher. tooltipOwned is shown when the mod is installed (downloaded from Workshop).

cpp
tooltip = "MyFramework - Admin Panel & Framework";
tooltipOwned = "MyFramework - Central Admin Panel & Shared Library";

overview

A longer description displayed in the mod details panel. Questo e' your "about" text.

cpp
overview = "MyFramework provides a centralized admin panel and shared library for all MyMod mods. Manage configurations, permissions, and mod integration from a single in-game interface.";

action / actionURL

A clickable URL associated with the mod (typically a website, Discord invite, or GitHub repository). Entrambi fields serve the same purpose -- use whichever one you prefer.

cpp
action = "https://github.com/mymod/repo";
// OR
actionURL = "https://discord.gg/mymod";

author / authorID

The author name and their Steam64 ID.

cpp
author = "MyMod Team";
authorID = "76561198000000000";

authorID is used by the Workshop to link to the author's Steam profile.

version

A version string. Can be any format -- the engine does not parse or validate it.

cpp
version = "1.0.0";

Some mods point to a version file in config.cpp invece:

cpp
versionPath = "MyMod/Scripts/Data/Version.hpp";   // This goes in config.cpp, NOT mod.cpp

type

Declares whether this is a regular mod or server-only mod. When omitted, the default is "mod".

cpp
type = "mod";           // Loaded via -mod= (client + server)
type = "servermod";     // Loaded via -servermod= (server only, not sent to clients)

extra

Reserved field. Sempre set to 0 or omit entirely.

cpp
extra = 0;

Mod Client vs Mod Server

DayZ supports two mod loading mechanisms:

Client Mod (-mod=)

  • Downloaded by clients from Steam Workshop
  • Scripts run on BOTH client and server
  • Can include UI, HUD, models, textures, sounds
  • Requires key signing (.bikey) for server join
// Launch parameter:
-mod=@MyMod

// mod.cpp:
type = "mod";

Server Mod (-servermod=)

  • Runs ONLY on the server dedicato
  • Clients never download it
  • Non puo' include client-side UI or 5_Mission client code
  • No key signing richiesto
// Launch parameter:
-servermod=@MyModServer

// mod.cpp:
type = "servermod";

Split Mod Pattern

Many mods ship as TWO packages -- a client mod and a server mod:

@MyMissions/           <-- Client mod (-mod=)
  mod.cpp                   type = "mod"
  Addons/
    MyMissions.pbo     Scripts: UI, entity rendering, RPC receive

@MyMissionsServer/     <-- Server mod (-servermod=)
  mod.cpp                   type = "servermod"
  Addons/
    MyMissionsServer.pbo   Scripts: spawning, logic, state management

This keeps server-side logic private (never sent to clients) and reduces client download size.


Metadati Workshop

meta.cpp (Auto-Generated)

When you publish to Steam Workshop, the DayZ tools auto-generate a meta.cpp file:

cpp
protocol = 2;
publishedid = 2900000000;    // Steam Workshop item ID
timestamp = 1711000000;       // Unix timestamp of last update

Non edit meta.cpp manually. E' managed by the publishing tools.

Workshop Interaction

The DayZ launcher reads both mod.cpp and meta.cpp:

  • mod.cpp provides the visual metadata (name, logo, description)
  • meta.cpp links the local files to the Steam Workshop item
  • The Steam Workshop page has its own title, description, and images (managed through Steam's web interface)

The mod.cpp fields are what players vedi in the in-game mod list. The Workshop page is what they vedi on Steam. Keep them consistent.

Raccomandazioni per le Immagini Workshop

ImageScopoConsigliato Size
pictureExpanded mod description512x512 or similar
logoMenu logo128x128 to 256x256
logoSmallCollapsed list icon64x64 to 128x128

Use .edds format for best compatibility. .paa and .tga also work. PNG and JPG do NOT work in mod.cpp image fields.


Campi Obbligatori vs Opzionali

Absolute Minimum

A functional mod.cpp needs only:

cpp
name = "My Mod";

Questo e' tutto. One line. The mod will load and function. Everything else is cosmetic.

Consigliato Minimum

For a Workshop-published mod, include at least:

cpp
name = "My Mod Name";
author = "YourName";
version = "1.0";
overview = "What this mod does in one sentence.";

Full Professional Setup

cpp
name = "My Mod Name";
picture = "MyMod/GUI/images/logo_large.edds";
logo = "MyMod/GUI/images/logo.edds";
logoSmall = "MyMod/GUI/images/logo_small.edds";
logoOver = "MyMod/GUI/images/logo_hover.edds";
tooltip = "Short description";
overview = "Full description of your mod's features.";
action = "https://discord.gg/mymod";
author = "YourName";
authorID = "76561198000000000";
version = "1.2.3";
type = "mod";

Esempi Reali

MyFramework (Client Mod)

cpp
name = "MyFramework";
picture = "";
actionURL = "";
tooltipOwned = "MyFramework - Central Admin Panel & Shared Library";
overview = "MyFramework provides a centralized admin panel and shared library for all MyMod mods. Manage configurations, permissions, and mod integration from a single in-game interface.";
author = "MyMod Team";
version = "1.0.0";

MyFramework Server (Server Mod -- Minimal)

cpp
name = "MyFramework Server";
author = "MyMod Team";
version = "1.0.0";
extra = 0;
type = "mod";

Community Framework

cpp
name = "Community Framework";
picture = "JM/CF/GUI/textures/cf_icon.edds";
logo = "JM/CF/GUI/textures/cf_icon.edds";
logoSmall = "JM/CF/GUI/textures/cf_icon.edds";
logoOver = "JM/CF/GUI/textures/cf_icon.edds";
tooltip = "Community Framework";
overview = "This is a Community Framework for DayZ SA. One notable feature is it aims to resolve the issue of conflicting RPC type ID's and mods.";
action = "https://github.com/Arkensor/DayZ-CommunityFramework";
author = "CF Mod Team";
authorID = "76561198103677868";
version = "1.5.8";

VPP Admin Tools

cpp
picture = "VPPAdminTools/data/vpp_logo_m.paa";
logoSmall = "VPPAdminTools/data/vpp_logo_ss.paa";
logo = "VPPAdminTools/data/vpp_logo_s.paa";
logoOver = "VPPAdminTools/data/vpp_logo_s.paa";
tooltip = "Tools helping in administrative DayZ server tasks";
overview = "V++ Admin Tools built for the DayZ community servers!";
action = "https://discord.dayzvpp.com";

Note: VPP omits name and author -- it still works, but the mod name defaults to the folder name in the launcher.

DabsFramework (With Localization)

cpp
name = "$STR_DF_NAME";
picture = "DabsFramework/gui/images/dabs_framework_logo.paa";
logo = "DabsFramework/gui/images/dabs_framework_logo.paa";
logoSmall = "DabsFramework/gui/images/dabs_framework_logo.paa";
logoOver = "DabsFramework/gui/images/dabs_framework_logo.paa";
tooltip = "$STR_DF_TOOLTIP";
overview = "$STR_DF_DESCRIPTION";
action = "https://dab.dev";
author = "$STR_DF_AUTHOR";
authorID = "76561198247958888";
version = "1.0";

DabsFramework uses $STR_ string table references for all text fields, enabling multi-language support for the mod listing itself.

MyAI Mod (Client Mod with Script Modules in mod.cpp)

cpp
name = "MyAI Mod";
picture = "";
actionURL = "";
tooltipOwned = "MyAI Mod - Intelligent Bot Framework for DayZ";
overview = "Advanced AI bot framework with human-like perception, combat tactics, and developer API";
author = "MyMod";
version = "1.0.0";
type = "mod";
dependencies[] = {"Game", "World", "Mission"};
class Defs
{
    class gameScriptModule
    {
        value = "";
        files[] = {"MyAI/Scripts/3_Game"};
    };
    class worldScriptModule
    {
        value = "";
        files[] = {"MyAI/Scripts/4_World"};
    };
    class missionScriptModule
    {
        value = "";
        files[] = {"MyAI/Scripts/5_Mission"};
    };
};

Note: This mod places script module definitions in mod.cpp rather than config.cpp. Entrambi locations work -- the engine reads both files. Tuttavia, the standard convention is to put CfgMods and script module definitions in config.cpp. Placing them in mod.cpp is an alternative approach used by some mods.


Consigli e Buone Pratiche

1. Keep mod.cpp Simple

mod.cpp is metadata only. Non try to put game logic, class definitions, or anything complex here. Se need script modules, put them in config.cpp.

2. Use .edds for Images

.edds is the standard DayZ texture format for UI elements. Use DayZ Tools (TexView2) to convert from PNG/TGA to .edds.

3. Match Your Workshop Page

Keep the name, overview, and author fields consistent with your Steam Workshop page. Players vedi both.

4. Version Consistently

Pick a versioning scheme (e.g., 1.0.0 semantic versioning) and update it with each release. Some mods use a Version.hpp file referenced in config.cpp for centralized version management.

5. Test Without Images First

During development, leave image paths empty. Add logos last, after everything works. Missing images do not prevent the mod from loading.

6. Server Mods Need Less

Server-only mods need minimal mod.cpp since players never vedi them in a launcher:

cpp
name = "My Server Mod";
author = "YourName";
version = "1.0.0";
type = "servermod";

Precedente: Chapter 2.2: config.cpp Deep DiveSuccessivo: Chapter 2.4: Your First Mod -- Minimum Viable

Released under CC BY-SA 4.0 | Code examples under MIT License