Chapter 2.3: mod.cpp & Workshop
Domů | << Předchozí: config.cpp do hloubky | mod.cpp a Workshop | Další: Minimální funkční mod >>
Shrnutí: The
mod.cppfile is pure metadata -- it controls how your mod appears in the DayZ launcher, ve hře mod list, and Steam Workshop. It has no effect on gameplay, scripting, or pořadí načítání. Ifconfig.cppis engine,mod.cppis the paint job.
Obsah
- Overview
- Where mod.cpp Lives
- All Fields Reference
- Field Details
- Client Mod vs Server Mod
- Workshop Metadata
- Required vs Optional Fields
- Real Examples
- Tips and Best Practices
Přehled
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.
Key point: mod.cpp is NOT compiled. It is not Enforce Script. It is a simple key-value file read by the launcher. Existují no classes, no semicolons after closing braces, no arrays with [] syntax (with one exception for Workshop script modules -- viz níže).
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 publisherThe @ prefix on the folder name is convention for Steam Workshop mods but not strictly povinný.
All Fields Reference
| Field | Type | Purpose | Required |
|---|---|---|---|
name | string | Mod display name | Yes |
picture | string | Large image in expanded description | No |
logo | string | Logo níže the game menu | No |
logoSmall | string | Small icon next to mod name (collapsed) | No |
logoOver | string | Logo on mouse hover | No |
tooltip | string | Tooltip on mouse hover | No |
tooltipOwned | string | Tooltip when mod is installed | No |
overview | string | Longer description in mod details | No |
action | string | URL link (website, Discord, GitHub) | No |
actionURL | string | Alternative to action (same purpose) | No |
author | string | Author name | No |
authorID | string | Steam64 ID of the author | No |
version | string | Version string | No |
type | string | "mod" or "servermod" | No |
extra | int | Reserved field (always 0) | No |
Field Details
name
The display name shown in the DayZ launcher mod list and ve hře mod screen.
name = "My Framework";You can use string table references for lokálníization:
name = "$STR_DF_NAME"; // Resolves via stringtable.csvpicture
Path to a larger image displayed when the mod description is expanded. Supports .paa, .edds, and .tga formats.
picture = "MyMod/GUI/images/logo_large.edds";The path is relative to the mod root. If prázdný or omitted, no image is shown.
logo
The primary logo displayed níže the game menu when the mod is loaded.
logo = "MyMod/GUI/images/logo.edds";logoSmall
Small icon shown next to the mod name when the description is collapsed (not expanded).
logoSmall = "MyMod/GUI/images/logo_small.edds";logoOver
The logo that appears when the user hovers their mouse over the mod logo. Often the stejný as logo but can be a highlighted/glowing variant.
logoOver = "MyMod/GUI/images/logo_hover.edds";přílišltip / přílišltipOwned
Short text shown when hovering over the mod in the launcher. tooltipOwned is shown when the mod is installed (downloaded from Workshop).
tooltip = "MyMod Core - Admin Panel & Framework";
tooltipOwned = "My Framework - Central Admin Panel & Shared Library";overview
A longer description displayed in the mod details panel. This is your "about" text.
overview = "My Framework provides a centralized admin panel and shared library for all framework mods. Manage configurations, permissions, and mod integration from a single in-game interface.";action / actionURL
A clickable URL associated with the mod (typicky a website, Discord invite, or GitHub repository). Oba fields serve the stejný purpose -- use whichever one you prefer.
action = "https://github.com/mymod/repo";
// OR
actionURL = "https://discord.gg/mymod";author / authorID
The author name and their Steam64 ID.
author = "Documentation Team";
authorID = "76561198000000000";authorID is used by the Workshop to link to the author's Steam profile.
version
A version string. Can be jakýkoli format -- engine ne parse or platnýate it.
version = "1.0.0";Some mods point to a version file in config.cpp místo toho:
versionPath = "MyMod/Scripts/Data/Version.hpp"; // This goes in config.cpp, NOT mod.cpptype
Declares whether this is a regular mod or server-only mod. When omitted, the výchozí is "mod".
type = "mod"; // Loaded via -mod= (client + server)
type = "servermod"; // Loaded via -servermod= (server only, not sent to clients)extra
Reserved field. Vždy set to 0 or omit celýly.
extra = 0;Client Mod vs Server Mod
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 dedicated server
- Clients nikdy download it
- Cannot include client-side UI or
5_Missionclient code - No key signing povinný
// Launch parameter:
-servermod=@MyModServer
// mod.cpp:
type = "servermod";Split Mod Pattern
Many mods ship as TWO packages -- a client mod and a server mod:
@MyMod_Missions/ <-- Client mod (-mod=)
mod.cpp type = "mod"
Addons/
MyMod_Missions.pbo Scripts: UI, entity rendering, RPC receive
@MyMod_MissionsServer/ <-- Server mod (-servermod=)
mod.cpp type = "servermod"
Addons/
MyMod_MissionsServer.pbo Scripts: spawning, logic, state managementThis keeps server-side logic private (never sent to clients) and reduces client download size.
Workshop Metadata
meta.cpp (Auto-Generated)
Když publish to Steam Workshop, the DayZ přílišls auto-generate a meta.cpp file:
protocol = 2;
publishedid = 2900000000; // Steam Workshop item ID
timestamp = 1711000000; // Unix timestamp of last updateDo not edit meta.cpp ručně. It je spravován the publishing přílišls.
Workshop Interaction
The DayZ launcher reads oba mod.cpp and meta.cpp:
mod.cppprovides the visual metadata (name, logo, description)meta.cpplinks the lokální 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 hráči viz in the ve hře mod list. The Workshop page is what they viz on Steam. Udržujte them consistent.
Workshop Image Recommendations
| Image | Purpose | Recommended Size |
|---|---|---|
picture | Expanded mod description | 512x512 or similar |
logo | Menu logo | 128x128 to 256x256 |
logoSmall | Collapsed list icon | 64x64 to 128x128 |
Use .edds format for best compatibility. .paa and .tga také work. PNG and JPG do NOT work in mod.cpp image fields.
Required vs Optional Fields
Absolute Minimum
A functional mod.cpp needs pouze:
name = "My Mod";That is it. One line. The mod will load and function. Everything else is cosmetic.
Recommended Minimum
For a Workshop-published mod, include at least:
name = "My Mod Name";
author = "YourName";
version = "1.0";
overview = "What this mod does in one sentence.";Full Professional Setup
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";Reálné příklady
Framework Mod (Client Mod)
name = "My Framework";
picture = "";
actionURL = "";
tooltipOwned = "My Framework - Central Admin Panel & Shared Library";
overview = "My Framework provides a centralized admin panel and shared library for all framework mods. Manage configurations, permissions, and mod integration from a single in-game interface.";
author = "Documentation Team";
version = "1.0.0";Framework Server Mod (Minimal)
name = "My Framework Server";
author = "Documentation Team";
version = "1.0.0";
extra = 0;
type = "mod";Community Framework
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
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 stále works, but the mod name výchozís to the folder name in the launcher.
DabsFramework (With Localization)
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.
AI Mod (Client Mod with Script Modules in mod.cpp)
name = "My AI Mod";
picture = "";
actionURL = "";
tooltipOwned = "My AI Mod - Intelligent Bot Framework for DayZ";
overview = "Advanced AI bot framework with human-like perception, combat tactics, and developer API";
author = "YourName";
version = "1.0.0";
type = "mod";
dependencies[] = {"Game", "World", "Mission"};
class Defs
{
class gameScriptModule
{
value = "";
files[] = {"MyMod_AI/Scripts/3_Game"};
};
class worldScriptModule
{
value = "";
files[] = {"MyMod_AI/Scripts/4_World"};
};
class missionScriptModule
{
value = "";
files[] = {"MyMod_AI/Scripts/5_Mission"};
};
};Note: This mod places script module definitions in mod.cpp spíše než config.cpp. Oba locations work -- engine reads oba files. Nicméně 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 některé mods.
Tips and Best Practices
1. Udržujte mod.cpp Simple
mod.cpp is metadata pouze. Do not try to put herní logika, class definitions, or jakýkolithing complex zde. If potřebujete 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
Udržujte the name, overview, and author fields consistent with your Steam Workshop page. Players viz oba.
4. Version Consistently
Pick a versioning scheme (e.g., 1.0.0 semantic versioning) and update it with každý release. Some mods use a Version.hpp file referenced in config.cpp for centralized version management.
5. Testujte Bez Images First
Během development, leave image paths prázdný. Přidejte logos last, after každýthing works. Missing images ne prevent the mod from loading.
6. Server Mods Need Less
Server-only mods need minimal mod.cpp since hráči nikdy viz them in a launcher:
name = "My Server Mod";
author = "YourName";
version = "1.0.0";
type = "servermod";Osvědčené postupy
- Vždy include at least
nameandauthor-- dokonce for server mods, it helps identify them in log output and admin přílišls. - Use
.eddsformat for all image fields (picture,logo,logoSmall,logoOver). PNG and JPG are not podporovaný. - Udržujte
mod.cppmetadata-only. PutCfgMods, script modules, anddefines[]inconfig.cppmísto toho. - Use semantic versioning (
1.2.3) in theversionfield and update it with každý Workshop release. - Testujte your mod without images first; add logos as a final polish step after functionality is confirmed.
Pozorováno v reálných modech
| Vzor | Mod | Detail |
|---|---|---|
Localized name field | DabsFramework | Uses $STR_DF_NAME stringtable reference for multi-language mod listing |
| Script modules in mod.cpp | Some AI mods | Place class Defs with script module paths přímo in mod.cpp místo config.cpp |
Missing name field | VPP Admin Tools | Omits name celýly; launcher falls back to folder name as display text |
| All image fields identical | Community Framework | Sets logo, logoSmall, and logoOver to the stejný .edds file |
| Empty image paths | Many early-stage mods | Leave picture="" during development; add branding before Workshop publish |
Teorie vs praxe
| Concept | Theory | Reality |
|---|---|---|
mod.cpp je povinný | Every mod folder needs one | A mod loads fine without it, but the launcher shows no name or metadata |
type field controls loading | "mod" vs "servermod" | The launch parameter (-mod= vs -servermod=) is what actually controls loading; the type field is metadata pouze |
| Image paths support common formats | All texture formats work | Only .edds, .paa, and .tga work; .png and .jpg are tiše ignored |
authorID links to Steam | Steam64 ID creates a clickable link | Only works on the Workshop page; the ve hře mod list ne render it as a link |
version is platnýated | Engine checks version format | Engine treats it as a raw string; "banana" is technically platný |
Kompatibilita a dopad
- Více modů:
mod.cpphas no effect on pořadí načítání or dependencies. Two mods with identical field values will not conflict -- pouzeCfgPatchesclass names inconfig.cppcan collide. - Výkon:
mod.cppis read once při startu. Image files referenced zde are loaded into memory for the launcher UI but have no ve hře performance impact.
Předchozí: Chapter 2.2: config.cpp Deep DiveDalší: Chapter 2.4: Your First Mod -- Minimum Viable
