Changes between Version 1 and Version 2 of ModdingResources


Ignore:
Timestamp:
Oct 28, 2017, 12:11:28 PM (7 years ago)
Author:
Nescio
Comment:

Started rewriting, expanding, and updating

Legend:

Unmodified
Added
Removed
Modified
  • ModdingResources

    v1 v2  
    88
    99**Please Note:** The process of adding a resource, although a lot easier than before, is still not very modder friendly, particularly in the later sections, and you may get errors that might seem confusing. Please visit the 0ad-dev irc channel if you have questions (and please stick around long enough for an answer).
     10
     11
     12
     13== Resources == #resourceTypes
     140 A.D. currently has several different types of resources:
     15* four normal resources: food, wood, stone, and metal
     16* a special resource: population
     17* a local resource (affecting only individual units): experience
     18* a fundamental resource: time (time can not be edited, neither in 0 A.D. nor outside)
     19This page simply considers modifying normal resources and ignores all others.
     20
     21
     22
     23== How to edit an existing resource == #editResource
     24=== Change a resource icon === #resourceIcon
     25Suppose you want to replace the meat icon used by “food” with a different one (because you care about historical accuracy and realize most people living in Antiquity could not afford meat even a single day in the year; or because you are a vegetarian and are opposed to the use of meat as generic food; or because you simply like to know how to change an icon; or for any other reason), all you have to do is create or edit two images:
     26* `food.png` (the convention is 64×64 pixels)
     27* `food_small.png` (16×16 pixels)
     28and place those in `art/textures/ui/session/icons/resources/`
     29
     30Then launch the game and admire your icon being used everywhere for food.
     31
     32=== Change a resource name or other aspects === #resourceData
     33The resources themselves are defined each in a separate `{resource}.json` file in `simulation/data/resources/`
     34
     35
     36
     37== To remove a resource == #removeResource
     38Substraction is the inverse of addition. To remove a resource, in short, follow the instructions to add a resource (below), but in reverse making sure to remove all reference to the resource.
     39
    1040
    1141
     
    124154
    125155
    126 == To remove a resource == #removeResource
    127156
    128 In short, follow the instructions to add a resource, but in reverse making sure to remove all reference to the resource.
     157== Summary == #summary
     158In short, to add a resource you need at least to create:
     159* `art/textures/ui/session/icons/resources/{newresource}.png`
     160* `art/textures/ui/session/icons/resources/{newresource}_small.png`
     161* `simulation/data/resources/{newresource}.json`
     162and to edit:
     163* `gui/common/setup_resources.xml`
     164* `gui/session/selection_panels.js`
     165* `gui/session/selection_panels_left/barter_panel.xml`
     166* `gui/session/top_panel/resources.xml`
     167* `simulation/templates/special/player.xml`
     168* `simulation/templates/special/player_gaia.xml`
     169* `simulation/templates/template_structure.xml`
     170This sufficient for having, displaying, trading, bartering, and using a resource.
     171
     172If you also want to make your resource gatherable, you'll need more icons, create templates, and edit AI files and maps; see the relevant sections (above).
     173
    129174
    130175
     
    132177
    133178* The session gui is limited to displaying four resources (plus population count) in the top bar.
    134 * Unless the patch that relocate the Barter icons to the Trade Dialog is applied, the session gui is limited to displaying four resources for Barter purposes.
    135179* Modifying countless actor files to add animations and props is not very mod-friendly.
    136180* Modders may wish to restrict the ability to barter, trade, or tribute resources. This is not currently implemented, see #4370.