Difference between revisions of "Rulesets (OpenXcom)"

From UFOpaedia
Jump to navigation Jump to search
(Added a (crappy) article to introduce rulesets to noobs)
 
(re-wrote the article)
Line 1: Line 1:
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.
+
OpenXcom exposes it's inner workings to users and modders in the form of a YAML text file called a ruleset (*.rul). These text files contain 'rules' that describe a wide variety of the games behavior. Although rulesets can be edited with any text editor (like notepad) but it is much easier to use a YAML editor.
 
 
----
 
  
 
__TOC__
 
__TOC__
  
==Rules==
+
==What is a ruleset?==
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.  
+
Naturally a ruleset is composed of rules, or groups of rules. Each rule describes a single thing about the game. A rule might describe what research projects become available after researching laser weapons, how much damage a pistol clip does, or the max flight speed of a Terror Ship. Rulesets are in YAML text files.
  
 
==Viewing and Editing Rulesets (YAML)==
 
==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.
+
Editing YAML is about as hard as editing an *.ini config file, though slightly more involved.
 
 
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.
+
===Instructions for Nerds===
 +
You can open any rulesets (or savegame files) in notepad++ and select Language>YAML. Alternatively you could conjure up a google search. There are YAML plugins for visual studio and eclipse.
  
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.
+
===Instructions for Noobs===
 +
* Install Notepad++ or if your on a mac then get TextWrangler. If you're on linux and you can't find a YAML editor...
 +
* Go to OpenXcom\Data\Ruleset and open a/the *.rul file. That means a file that ends with .rul, you may have to unhide filename extensions.
 +
* In Notepad++ click Language>YAML. Otherwise if your editor doesn't let you collapse sections of the ruleset, try renaming the file to something that ends with .yml, as your editor may not recognize it as YAML.
 +
* It should be pretty obvious how to change stuff at this point. You may want to make a backup before editing anything though.
  
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.  
+
====Note====
 +
You should be able to use the vertical bar on the left of the editor to collapse regions of the rulesets file that you aren't interested in. If not, then something is wrong. That's OK though if you don't mind scrolling pas literally thousands of lines to get to the rules near the bottom.
  
(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.
+
====Your First Edit (Cheat)====
 +
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 next to "Personnel:" from 50 to however many people you think should actually be able to live in a living quarters (maybe 2000). Congratulations, you have just modded OpenXcoms living quarters to hold more people, don't forget to save.

Revision as of 03:51, 3 November 2012

OpenXcom exposes it's inner workings to users and modders in the form of a YAML text file called a ruleset (*.rul). These text files contain 'rules' that describe a wide variety of the games behavior. Although rulesets can be edited with any text editor (like notepad) but it is much easier to use a YAML editor.

What is a ruleset?

Naturally a ruleset is composed of rules, or groups of rules. Each rule describes a single thing about the game. A rule might describe what research projects become available after researching laser weapons, how much damage a pistol clip does, or the max flight speed of a Terror Ship. Rulesets are in YAML text files.

Viewing and Editing Rulesets (YAML)

Editing YAML is about as hard as editing an *.ini config file, though slightly more involved.

Instructions for Nerds

You can open any rulesets (or savegame files) in notepad++ and select Language>YAML. Alternatively you could conjure up a google search. There are YAML plugins for visual studio and eclipse.

Instructions for Noobs

  • Install Notepad++ or if your on a mac then get TextWrangler. If you're on linux and you can't find a YAML editor...
  • Go to OpenXcom\Data\Ruleset and open a/the *.rul file. That means a file that ends with .rul, you may have to unhide filename extensions.
  • In Notepad++ click Language>YAML. Otherwise if your editor doesn't let you collapse sections of the ruleset, try renaming the file to something that ends with .yml, as your editor may not recognize it as YAML.
  • It should be pretty obvious how to change stuff at this point. You may want to make a backup before editing anything though.

Note

You should be able to use the vertical bar on the left of the editor to collapse regions of the rulesets file that you aren't interested in. If not, then something is wrong. That's OK though if you don't mind scrolling pas literally thousands of lines to get to the rules near the bottom.

Your First Edit (Cheat)

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 next to "Personnel:" from 50 to however many people you think should actually be able to live in a living quarters (maybe 2000). Congratulations, you have just modded OpenXcoms living quarters to hold more people, don't forget to save.