Giter Site home page Giter Site logo

dayz-central-economy-schema's Introduction

DayZ Central Economy Schema

Problem

Tweaking the DayZ Central Economy configuration can sometimes be daunting, due to the complex structure of the config files, the size of the files, and the usually strange behaviour of the CE engine in case of misconfiguration. Limited official documentation on CE also adds to the problem.

The error rate can be greatly reduced by using appropriate tools such as editors with XML support. Many editors support validation of XML files against XSD (XML Schema Definition), but unfortunately there is no official schema.

Solution

This repository aims to provide an unofficial XSD schema along with some documentation that can be used to:

  • Validate CE files;
  • Improve the editing experience - many editors support auto-completion and hints for XML when provided with a schema;
  • Improve understanding of CE configuration files;
  • Generate data structures in your programming language of choice if you are developing custom tools for CE.

Limitations

Please note that while validating against a schema can eliminate syntax errors and catch many errors that are limited to one file, it can't help with errors that span multiple files, such as using a category in types.xml that is not defined in cfglimitsdefinition.xml.

Validating such rules requires more effort than using a common text editor and an XSD file. It can be done with an extension. I'm currently considering writing a VS Code extension for comprehensive editing of DayZ CE files. I'm not sure as there are already many different tools for this. Please let me know if you are interested.

Alternative solution

If you prefer a more high-level approach and spreadsheet-like editing rather than digging into XML files, have a look at my DayzServerTools. In fact, this repository is part of an effort to provide comprehensive validation in the DayzServerTools.

How to

VS Code

  1. Install the XML extension.
  2. Open an XML file that you want to validate, press F1`` or Ctrl+Shift+P`` and select XML:Bind to grammar/schema file command. You have the option of using a local or remote schema. I recommend that you use the latter as your schema will be updated automatically.
    • If you choose to use local schema you need to download (or clone) this repository and provide local path to corresponding .xsd file
    • For convenience, all schemas are available online (thanks to Github Pages) at https://rvost.github.io/DayZ-Central-Economy-Schema/. So for remote option you provide path starting from this address, e.g. https://rvost.github.io/DayZ-Central-Economy-Schema/db/types.xsd for types schema or https://rvost.github.io/DayZ-Central-Economy-Schema/cfgeventspawns.xsd for events.
  3. I recommend using the File Association option because it works without editing the original xml file.
  4. Repeat this process for each file you want to validate OR the take .vscode/settings.json file from this repo and copy it to your workspace with all associations already set up.

Notepad++

  1. Install the XML Tools plugin (you can follow this tutorial on SO).
  2. Open XML file and press Ctrl+Shift+Alt+M (or use Menu if this is your preference Plugins > XML Tools > Validate Now) and enter corresponding schema URL (as described above).
  3. Repeat this process for each file you want to validate.

You can also reference schema in XML file like this

<spawnabletypes xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' 
  xsi:noNamespaceSchemaLocation="<URL here>">
    ...
</spawnabletypes>

to avoid having to specify XSD location for every validation.

Contributing

I hope this schema is good enough to be useful but it is by no means complete or exhaustive. So if you find a problem (errors it can't detect or false positives, etc.) please let me know via Issues or if you can fix it yourself, don't be shy to submit a PR!

dayz-central-economy-schema's People

Contributors

rvost avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.