How DZML works

DZML is a way to write a DayZ menu as an HTML page. The game does not read HTML: it reads .layout files, a text format that lists widgets with their position, size and properties. DZML is the same information written as HTML, which is easier to read, to write by hand, to diff, and to ask an assistant for. The Workbench compiles the page to the .layout the game loads, and can turn any existing .layout back into DZML.

You do not have to use it. The Layout Editor opens and edits plain .layout files too. DZML is the recommended way to start a new UI.

The idea in one example

<body data-dzml="vanilla">
<div data-dz="frame" data-name="Root" class="dz-xy-0-0 dz-wh-full">
  <div data-dz="panel" data-name="Window" class="dz-wh-500px-260px dz-align-cc dz-c-1C1C1CF0">
    <span data-dz="text" data-name="Title" class="dz-xy-0-16px dz-wh-460px-36px dz-align-tc dz-font-28 dz-exact-text">Warning</span>
    <button data-dz="button" data-name="CloseButton" data-on-click="Close" data-style="Colorable"
            class="dz-xy-0-20px dz-wh-160px-40px dz-align-bc dz-c-B03030FF">Close</button>
  </div>
</div>
</body>

From the page to the game

  1. You write MyMod/gui/layouts/my_menu.html.
  2. The Workbench checks it (unknown widgets, duplicate names, missing sizes, fonts and images that do not exist) and shows the problems with their line.
  3. It compiles it to my_menu.layout next to the page. Both files go in the mod; the game loads the .layout.
  4. It renders the layout the way the game draws it, at several screen resolutions, with the game's own fonts, styles and images. Text that overflows, widgets off screen or on top of each other are reported.
  5. For a vanilla page, it can write the menu script: a class with one field per named widget, the event dispatch, and an empty method for each data-on-click="Method".

In the Layout Editor these are the canvas, the problems list, Save, Preview and the Script tab. The canvas and the HTML stay in step: move a widget on the canvas and only its opening tag changes in the page; your formatting and comments are kept.

Take the DZML tour (in the app) · Start a new DZML page (in the app)

Two kinds of pages

Vanilla pages (the default)

<body data-dzml="vanilla"> is a page for a normal mod, with no dependency.

DayZular pages

DayZular is a UI framework mod for DayZ: instead of filling widgets by hand, the page binds them to data. DZML was first made for it, which is why the binding attributes look like a web framework's. In a page without data-dzml="vanilla":

These compile to script classes that only exist in the DayZular mod, so a DayZular page needs that mod on the server and the clients. In a vanilla page they are reported as errors (dayzular-only). If you do not know which one you need, you need a vanilla page.

Converting an existing layout

Open any .layout (yours or the game's) and choose To DZML: the Workbench writes the equivalent .html next to it. Every vanilla layout survives the round trip unchanged, so this is also the quickest way to learn: open a menu of the game and read it as HTML.

Open the game's main menu (in the app)

Positions and sizes, the part that surprises

Styles and images

Pitfalls

For agents

See also

Layout Editor · Style Studio · Script Editor · Getting started