Login  Register
 



Post new topicReply to topic
 
Author Message
 PostPosted: 24 Feb, 2011 
 

Joined: 01 Jan, 2011
Posts: 1025
Offline
How to Mod the SupCom 2 Tech Tree

Acknowledgements/Credits: LiveOrDie aka OverRated, Mithy, and RCIX

Note: This is a work-in-progress and is expected to grow as my own mod and modding efforts mature.

Table of Contents

  1. The Files You Will Need
  2. Creating Items for the Tech Tree
  3. Placing Icons in the Tech Tree


1. The Files You Will Need

You will need the following files:

<directory where Steam is installed>/Steam/steamapps/common/supreme commander 2/gamedata/

- Base Game:
  • lua.scd/lua/sim/buff/ResearchBuffDefinitions.lua
  • lua.scd/lua/sim/DefaultBuildRestrictions.lua
  • lua.scd/lua/sim/Research.lua
  • lua.scd/lua/ui/game/research/research_grid.lua
  • lua.scd/lua/ui/game/research/research_layout.lua

- DLC1:
  • z_lua_dlc1.scd/mods/DLC1/shadow/lua.scd/lua/sim/buff/ResearchBuffDefinitions.lua
  • z_lua_dlc1.scd/mods/DLC1/shadow/lua/sim/DefaultBuildRestrictions.lua
  • z_lua_dlc1.scd/mods/DLC1/shadow/lua/sim/Research.lua
  • z_lua_dlc1.scd/mods/DLC1/shadow/lua/ui/game/research/research_grid.lua
  • z_lua_dlc1.scd/mods/DLC1/shadow/lua/ui/game/research/research_layout.lua

If you are modding the game from scratch, i.e., you are not modding a mod, then you will first need to obtain the uncompiled versions of the above files because by default lua.scd and z_lua_dlc1.scd are compiled. The uncompiled versions are shipped with the game, so you can find them in the same /gamedata directory:

- Base Game:
  • uncompiled_lua.scd/lua/sim/buff/ResearchBuffDefinitions.lua
  • uncompiled_lua.scd/lua/sim/DefaultBuildRestrictions.lua
  • uncompiled_lua.scd/lua/sim/Research.lua
  • uncompiled_lua.scd/lua/ui/game/research/research_grid.lua
  • uncompiled_lua.scd/lua/ui/game/research/research_layout.lua

- DLC1:
  • z_uncompiled_lua_dlc1.scd/mods/DLC1/shadow/lua/sim/buff/ResearchBuffDefinitions.lua
  • z_uncompiled_lua_dlc1.scd/mods/DLC1/shadow/lua/sim/DefaultBuildRestrictions.lua
  • z_uncompiled_lua_dlc1.scd/mods/DLC1/shadow/lua/sim/Research.lua
  • z_uncompiled_lua_dlc1.scd/mods/DLC1/shadow/lua/ui/game/research/research_grid.lua
  • z_uncompiled_lua_dlc1.scd/mods/DLC1/shadow/lua/ui/game/research/research_layout.lua

The .scd files are UNCOMPRESSED archives, essentially uncompressed zip files with .zip changed to .scd.

Before making any changes and begin working on your mod, BACK UP ALL OF THE ABOVE FILES!

Once you make changes to the above files, you will need to merge them into the COMPILED .scd archives (lua.scd and z_lua_dlc1.scd). It is very important that when you merge them, you do NOT compress them. I recommend using WinRAR for this (when adding your file to the archive, make sure that the compression method is set to "STORE"). Also, by merging your uncompiled versions into the compiled .scd archives, you create a compiled-uncompiled hybrid archive. This is ok and the game will work just fine.


2. Creating Items for the Tech Tree

(Research.lua)

We begin with a completely empty tech tree:
Code:
ResearchDefinitions = {
}


Now, we define a research item that unlocks the Monkey Lord:

Code:
ResearchDefinitions = {
    CLU_MONKEYLORD = {
        NAME = '<LOC RESEARCH_NAME_0303>Monkeylord',
        TIME = 0,
        COST = 0,
        ENERGY = 0,
        MASS = 0,
        INFO = '<LOC SC2_RESEARCH_INFO_0551>Unlock the \'Monkeylord\' Experimental Spiderbot.',
        CATS = 'LANDGANTRYBUILDER',
        BuildRestrictionRemoval = {
            'MONKEYLORD',
        },
        PREREQUISITES = 'CLP_TRIARMORHALFSPEED',
        tip_affects = '<LOC SC2_RESEARCH_AFFECTS_0076>Built By: Land Experimental Gantry',
        tip_type = '<LOC SC2_TIP_TYPE_0078>Unit Unlock',
    },
}


  • CLU_MONKEYLORD: This name can be anything you want, but its best to stick to the following conventions for the first three letters:

    • CAB =
    • CAU = Cybran Air Unit
    • CBA =
    • CBB =
    • CBU =
    • CCA =
    • CCB =
    • CCP =
    • CLA =
    • CLB =
    • CLP =
    • CLU = Cybran Land Unit
    • CSA =
    • CSB =
    • CSP =
    • CSU = Cybran Naval (Sea) Unit

    The units for Illuminate and UEF follow the exact same conventions except that the initial 'C' is replaced by 'I' and 'U', respectively.

  • NAME: The name that is displayed in the info box when you mouse over an icon. The <LOC...> stuff is not necessary. It's for localizing strings into other languages.

  • TIME:

  • COST: How many research points it costs in order to unlock the upgrade.

  • ENERGY: How much energy it costs in order to unlock the upgrade

  • MASS: How much mass it costs in order to unlock the upgrade.

  • INFO: A brief description of the upgrade that is displayed in the info box when you mouse over an icon. It spans two line. To write on the second line, you can use \n.

  • CATS: The unit/structure that will be affected by unlocking the Monkey Lord. In this case, there will be some sort of effect on the LANDGANTRYBUILDER (i.e., experimental building facility/factory) when this item is researched.

  • BuilRestrictionRemoval: The actual unit/structure that can now be accessed.

  • PREREQUISITES: These are other items in the tech tree that are required to be researched before the present item can become unlockable.

    You can have no prerequisites (PREREQUISITES = '',), one prerequisite (as shown above), and multiple prerequisites (PREREQUISITES = '<...>,<...>,<...>',).

    For the multiple prerequisites, it's important that the different prerequisites be separated by a comma WITHIN the single quotes: '<...>,<...>,<...>', vs. '<...>','<...>','<...>',. As soon as the engine sees a second apostrophe followed by a comma, it will move on to the next command. If the next command is just the name of the prerequisite you want to include in the list, then the game will crash. Multiple prerequisites as shown are 'OR' prerequisites in that only one needs to be satisfied in order for the current item being considered to become unlockable. (I don't know how to make multiple prerequisites all mandatory.)

    The prerequisites are other items defined in the tech tree as has been done with the Monkey Lord and are local to Research.lua.

  • tip_affects: This is a single line of text that appears just below the Research Point cost in the upper left-hand corner. Self-explanatory.

  • tip_type: This info appears in the upper right-hand corner. Self-explanatory.

<note to self: give a couple more examples using buildings and buffs>


(DefaultBuildRestrictions.lua)

In order to make a particular unit or building buildable pending a research unlock, it needs to be indicated as such in DefaultBuildRestrictions.lua. For example, in order to disable the building of the Land, Air, and Naval factories for Cybran at the outset of the game you would write:

Code:
DefaultBuildRestrictions = {
    categories.ucb0001, -- Land Factory
    categories.ucb0002, -- Air Factory
    categories.ucb0003, -- Naval Factory
}


The word "categories" is always required. What follows the "." is the unit/building's ID. An easy way to visually know what unit you are dealing with is to consult /gamedata/textures.scd/textures/ui/common/icons/hud/units/ as the file names corresponding to the images are the unit ID's.

Now, in order to link the unlockability of the factories to an icon/upgrade in the tech tree, we rely on "CATS" and "BuildRestrictionRemoval", above. When that particular item/icon is unlocked, it removes categories.ucb0001, categories.ucb0002, and categories.ucb0003 from the building restrictions, thereby allowing them to be built. The unit/building identified in "CATS" can also be the "Categories" as found in unit/structure blueprints.


3. Placing Icons in the Tech Tree

The game has 5 tech trees for each of the 3 factions: Land, Air, Navy, Structures, and ACU ("LANSA").

Lets start with completely blank tech trees for all factions (research_layout.lua):

Code:
research_layout = {
    CYBRAN_AIR = { },
    CYBRAN_STRUCTURES = { },
    CYBRAN_COMMANDER = { },
    CYBRAN_LAND = { },
    CYBRAN_NAVAL = { },
    ILLUMINATE_AIR = { },
    ILLUMINATE_STRUCTURES = { },
    ILLUMINATE_COMMANDER = { },
    ILLUMINATE_LAND = { },
    ILLUMINATE_NAVAL = { },
    UEF_AIR = { },
    UEF_STRUCTURES = { },
    UEF_COMMANDER = { },
    UEF_LAND = { },
    UEF_NAVAL = { },
}


Adding icons to the trees is extremely straightforward. As an example, lets add the Monkey Lord:

Code:
research_layout = {
    CYBRAN_AIR = { },
    CYBRAN_STRUCTURES = { },
    CYBRAN_COMMANDER = { },
    CYBRAN_LAND = {
       CLU_MONKEYLORD = {
            icon = '/textures/ui/common/icons/hud/units/ucx0117d1.dds',
            col = 1,
            row = 1,
        },
    },
    CYBRAN_NAVAL = { },
    ILLUMINATE_AIR = { },
    ILLUMINATE_STRUCTURES = { },
    ILLUMINATE_COMMANDER = { },
    ILLUMINATE_LAND = { },
    ILLUMINATE_NAVAL = { },
    UEF_AIR = { },
    UEF_STRUCTURES = { },
    UEF_COMMANDER = { },
    UEF_LAND = { },
    UEF_NAVAL = { },
}


There are only four lines you need to consider:

  • CLU_MONKEYLORD: this is the exact same name that you used to define the unit in Research.lua.

  • icon = '/textures/ui/common/icons/hud/units/ucx0117d1.dds': the image for the icon. The 'textures' directory being referred to is /gamedata/textures.scd. If you're using custom units...

  • col = 1: horizontal coordinate.

  • row = 1. vertical coordinate.

    The coordinate of (1,1) will place the Monkey Lord icon in the upper-left hand corner of the Land tech tree.

You may have noticed from Research.lua that the 3x5=15 tech trees are actually treated by the game's engine as 1 massive tech tree; the subdivision into 15 smaller tech trees is only a matter of appearance in terms of placing the icons on the screen. All of the trees in research_layout.lua have direct access to all the definitions in Research.lua. Therefore, it is possible to have prerequisite dependencies that span across the so-called different tech trees.

_________________
Image


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic



Quick Tools

Search for:
Jump to:  

© 2002-2010 Gas Powered Games Corp. All Rights Reserved. Gas Powered Games is the exclusive trademark of Gas Powered Games Corp.
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
 
Home| Games | Company | News & Press | Support
  Terms of Use   |    Copyright Information   |    Privacy Policy