Rulesets (OpenXcom)

From UFOpaedia
Revision as of 09:44, 11 July 2012 by Darkestaxe (talk | contribs) (Added a (crappy) article to introduce rulesets to noobs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Rulesets are a way that OpenXcom exposes it's inner workings to users and modders in an easy to edit YAML text files. These text files have .rul or .dat extensions and contain 'rules' that describe a wide variety of the games behavior. Although rulesets can be edited with any text editor (like notepad) it is easier to use a YAML editor like Notepad++ because the information in a ruleset file isn't formatted, making it difficult to find a specific rule you might want to edit.


Rules

Each rule describes a single item in a list and various attributes pertaining to that item. A list of these items is a ruleset. For example there is a ruleset containing a list of all the facilities in the game. Each facility has a type(what building it is), cost to build, time to build in days, and several other bits of information. The entry with the type STR_GENERAL_STORES has an amount of storage space as an attribute, and hypothetically if you were to copy that attribute and value combination and paste it into the list of attributes for the facility type STR_LIVING_QUARTERS then when you play OpenXcom Living Quarters should give you 50 storage space. As long as you didn't remove the part of the living quarters rule that says living quarters give 50 people a place to sleep, the living quarters facility would fulfill the functions of both facilities.

Viewing and Editing Rulesets (YAML)

YAML is a data storage language designed to be very easy to read and edit both for a human with a text editor and for a computer. If you don't feel comfortable editing INI files you have almost no chance of editing a ruleset in something like notepad. Most code-literate people will prefere a YAML editor over notepad as well however.

Assuming you're a nerd but haven't heard of YAML, just open any rulesets (or save files) in notepad++ and select Language>YAML. Or find another YAML editor (eclispe has a plugin).

OK, now that those nerdy weirdos are gone, go google Notepad++ and download and install it. You have to be on windows to use it but if you a Linux user and you don't know how to use Google to find your own YAML editor then something is very very wrong.

Now, once it's installed go into the folder where you have OpenXcom installed and find the ruleset file 'Xcom1Ruleset.rul' in the Rulesets folder that's in the Data folder. Right click the file and select 'Edit with Notepad++'. Once it's opened hold your breath and click the 'Language' dropdown menu. It's OK, calm down, you don't need to worry about all those scary programing languages, just select the one at the bottom YAML.

You can use the vertical bar on the left of the editor to collapse regions of the rulesets file that you aren't interested in. Just click the little grey triangle things by the names of stuff to expand or collapse a region.

(this part may change) At the very top off the file you will see where the facilities list starts followed by a list of facilities and various attributes about them. Locate the living quarters facility and change the number nest to "Personnel:" from 50 to however many people you think should actually be able to live in a living quarters (maybe 200). Congratulations, you have just modded OpenXcoms living quarters to hold more people, don't forget to save.