[Info] Empires modding enviroment

Discussion in 'Coding' started by BlackRedDead, Aug 23, 2016.

  1. BlackRedDead

    BlackRedDead Member

    Messages:
    268
    Likes Received:
    6
    Trophy Points:
    0
    Hey guys,
    Building a modding enviroment beside your Empires installation to test script changings, without interference with your ususal multiplayer installation or the risk of being overwriten by updates, is quite easily
    1. goto Empires directory "...\Steam\steamapps\common\Empires"
      (in there are already 2 "game" folders, called "empires" and "hl2" - they just work like what you want to do)
    2. create a new folder there and name it whatever you want, then copy the "gameinfo.txt" from "empires" subdirectory in that folder and change "game" to whatever you called your mod, search for the "gamebin" and replace "|gameinfo_path|bin" with "empires/bin"
      (the folder can be named differently, just the "game" must match, but also the searchpaths if you ever want to create a mod of the mod of the mod xD)
      - or use Smithy's Gameinfo.txt and change whatever you want
    3. there are now 2 ways to start this:
      create a new text file (.txt) in main directory (where the hl2.ese is located), copy
      Code:
      hl2.exe -game *YOUR MOD* -novid -insecure
      inside it and rename its file extension to ".bat" (a batch file)
      this file acts as the "startbutton" - it needs to be in the same directory like the hl2.exe, so if you want a desktop shortcut make it from that batch or you can also made one from the hl2.exe and just add the params listed above after the " ;-)
      (should look like "...\Steam\steamapps\common\Empires\hl2.exe" -game *YOUR MOD* -novid -insecure)

    thx to @Thexa4 to provide this and @Smithy for addidional info about the custom folder, usefull for mapping ;-)

    Empires Wiki:
    after the suggestion by Max Maton via HipChat, i created a "Modding" Wikipage
    meant for every bit information that help possible contributors to create & test theire changes :)
    at least i tryed to give it some "structure", but i clearly need help with structurating the page for future content and at formatting the already existing one (possibly rewriting)
     
    Last edited: Sep 25, 2016
  2. Thexa4

    Thexa4 Developer Staff Member Moderator

    Messages:
    304
    Likes Received:
    98
    Trophy Points:
    0
    If you want to create a full mod based on empiresmod you can create a folder next to the hl2.exe binary named something like empires_mod.
    In there you need to place a modified copy of the gameinfo.txt.

    The idea is to let everything point to the original empires files but let the engine look in your folder first to find a file. Then you can just add overrides to your new folder. This will also ensure that updates to empires won't overwrite your mod.

    Start the game using the command line or with a bat file using: hl2.exe -game empires_mod -insecure

    If you need code changes you'll have to try to use SourceMod.
     
    Last edited: Aug 23, 2016
  3. BlackRedDead

    BlackRedDead Member

    Messages:
    268
    Likes Received:
    6
    Trophy Points:
    0
    exactly what i want to do - cause at start i only want to test a few file changings - without brakeing the original empires and to ensure i can still play in MP without it
    batch is more handy - thx for the params :)

    im not sure about the code structure - first fps and also source game i wanna mod...
    actually confused by the .txt files in scrips directory...
    (they look more like data storages than being scripts!)
     
  4. Lightning

    Lightning Member

    Messages:
    147
    Likes Received:
    23
    Trophy Points:
    0
    the txt files in the scripts directory are scripts. i have no idea what you mean by data storage as i'm sure none of them really contain an array.
     
  5. Lightning

    Lightning Member

    Messages:
    147
    Likes Received:
    23
    Trophy Points:
    0
    what do you have to modify inside the gameinfo .txt?
     
  6. BlackRedDead

    BlackRedDead Member

    Messages:
    268
    Likes Received:
    6
    Trophy Points:
    0
    well, my knowledge about scripts is to decent - so lets just skip this!


    i guess search paths have to be changed - at least for the binarys if you don't want to copy them ;-)


    Code:
            // The code that loads this file automatically does a few things here:
            //
            // 1. For each "Game" search path, it adds a "GameBin" path, in <dir>\bin
            // 2. For each "Game" search path, it adds another "Game" path in front of it with _<langage> at the end.
            //    For example: c:\hl2\cstrike on a french machine would get a c:\hl2\cstrike_french path added to it.
            // 3. For the first "Game" search path, it adds a search path called "MOD".
            // 4. For the first "Game" search path, it adds a search path called "DEFAULT_WRITE_PATH".
            //
    
            //
            // Search paths are relative to the base directory, which is where hl2.exe is found.
            //
            // |gameinfo_path| points at the directory where gameinfo.txt is.
            // We always want to mount that directory relative to gameinfo.txt, so
            // people can mount stuff in c:\mymod, and the main game resources are in
            // someplace like c:\program files\valve\steam\steamapps\half-life 2.
     
  7. Thexa4

    Thexa4 Developer Staff Member Moderator

    Messages:
    304
    Likes Received:
    98
    Trophy Points:
    0
    They're not actually scripts in the normal sense of the words. They are more like json files.

    Yes, you have to change the searchpath and add paths for yourself.
     
    BlackRedDead likes this.
  8. Thexa4

    Thexa4 Developer Staff Member Moderator

    Messages:
    304
    Likes Received:
    98
    Trophy Points:
    0
    You can also try to run the game with hl2.exe -game yourmod -game empires -insecure

    That might try to load your files before the empires files
     
  9. BlackRedDead

    BlackRedDead Member

    Messages:
    268
    Likes Received:
    6
    Trophy Points:
    0
    very unsure what i have to add to the gameinfo.txt so that it loads like empires + looking in the new directory for changed files

    at least have changed "game" (name), "gamebin" to empires and added "mod+mod_write+default_write_path"&"game+game_write" to "gameinfo_path", do i have t specify a "mod" path to "empires" or change all paths to empires and add mine as "mod_path"?

    Code:
    "GameInfo" {
    
       game     "Empires_mod"
       gamelogo   1
       developer   "Empiresmod Foundation"
       developer_url   "http://www.empiresmod.com"
       icon     "resource/steam_icon"
       manual     "https://empiresmod.com/docs/quickstart/en/quick_start.html"
       type     multiplayer_only
    
       FileSystem {
    
         SteamAppId   17740 // GCF for TF2, required for ep2 sdk
         ToolsAppId   211 // Tools will load this (ie: source SDK caches) to get things like materials\debug, materials\editor, etc.
    
         //
         // The code that loads this file automatically does a few things here:
         //
         // 1. For each "Game" search path, it adds a "GameBin" path, in <dir>\bin
         // 2. For each "Game" search path, it adds another "Game" path in front of it with _<langage> at the end.
         //  For example: c:\hl2\cstrike on a french machine would get a c:\hl2\cstrike_french path added to it.
         // 3. For the first "Game" search path, it adds a search path called "MOD".
         // 4. For the first "Game" search path, it adds a search path called "DEFAULT_WRITE_PATH".
         //
    
         //
         // Search paths are relative to the base directory, which is where hl2.exe is found.
         //
         // |gameinfo_path| points at the directory where gameinfo.txt is.
         // We always want to mount that directory relative to gameinfo.txt, so
         // people can mount stuff in c:\mymod, and the main game resources are in
         // someplace like c:\program files\valve\steam\steamapps\half-life 2.
         //
         SearchPaths
         {
           // First, mount all user customizations.  This will search for VPKs and subfolders
           // and mount them in alphabetical order.  The easiest way to distribute a mod is to
           // pack up the custom content into a VPK.  To "install" a mod, just drop it in this
           // folder.
           //
           // Note that this folder is scanned only when the game is booted.
           game+mod         |gameinfo_path|custom/*
           game+mod+mod_write+default_write_path   |gameinfo_path|.
           gamebin           |empires|bin
    
           // We search VPK files before ordinary folders, because most files will be found in
           // VPK and we can avoid making thousands of file system calls to attempt to open files
           // in folders where they don't exist.  (Searching a VPK is much faster than making an operating
           // system call.)
           game_lv     hl2/hl2_lv.vpk
           game+mod   hl2mp/hl2mp_english.vpk
           game+mod   hl2mp/hl2mp_pak.vpk
           game+mod   |gameinfo_path|sourcetest/sourcetest_pak_dir.vpk
           game     |all_source_engine_paths|hl2/hl2_english.vpk
           game     |all_source_engine_paths|hl2/hl2_pak.vpk
           game     |all_source_engine_paths|hl2/hl2_textures.vpk
           game     |all_source_engine_paths|hl2/hl2_sound_vo_english.vpk
           game     |all_source_engine_paths|hl2/hl2_sound_misc.vpk
           game     |all_source_engine_paths|hl2/hl2_misc.vpk
           platform   |all_source_engine_paths|platform/platform_misc.vpk
    
           // Now search loose files.  We'll set the directory containing the gameinfo.txt file
           // as the first "mod" search path (after any user customizations).  This is also the one
           // that's used when writing to the "mod" path.
           mod+mod_write+default_write_path     |gameinfo_path|.
    
           // Add the HL2 directory as a game search path.  This is also where where writes
           // to the "game" path go.
           game+game_write     |gameinfo_path|.
    
           // Where the game's binaries are
           // gamebin         hl2/bin
    
           // Last, mount in shared HL2 loose files
           game     |all_source_engine_paths|hl2mp
           game     |all_source_engine_paths|hl2
           platform   |all_source_engine_paths|platform
           game     |all_source_engine_paths|sourcetest
         }
       }
    }
    
     
  10. Thexa4

    Thexa4 Developer Staff Member Moderator

    Messages:
    304
    Likes Received:
    98
    Trophy Points:
    0
    You'll probably have to replace |empires|bin with empires/bin

    If the double -game trick works you can leave the gameinfo as is, you won't have to change anything (just the name).
     
    BlackRedDead likes this.
  11. Smithy

    Smithy Developer Staff Member Administrator

    Messages:
    333
    Likes Received:
    68
    Trophy Points:
    0
    Empires also loads content from the "custom" directory inside the root game folder. So for example, if you're working on a map:

    Create a directory inside the custom folder naming your 'mod'. For example empiresroot/custom/emp_verycoolmap/
    Content is loaded from this 'mod' as if it were your root folder. Therefore you can create subfolders for any content you want to include in your mod.

    As an example my 'emp_verycoolmap' mod folder contents may look like the following:

    empiresroot/custom/emp_verycoolmap/cfg/maps/emp_verycoolmap.txt
    empiresroot/custom/emp_verycoolmap/maps/emp_verycoolmap.res
    empiresroot/custom/emp_verycoolmap/maps/emp_verycoolmap.bsp
    empiresroot/custom/emp_verycoolmap/materials/maps/emp_verycoolmap.vmt
    empiresroot/custom/emp_verycoolmap/materials/maps/emp_verycoolmap.vtf

    This is also a decent way to keep track of any assets that need to be packaged with your map, helping you release at a later date.
     
    BlackRedDead likes this.
  12. Lightning

    Lightning Member

    Messages:
    147
    Likes Received:
    23
    Trophy Points:
    0
    so i could make a "custom" folder in my empires ( C:\Steam\SteamApps\common\Empires\empires ) and then add a folder such a scripts?
     
  13. Smithy

    Smithy Developer Staff Member Administrator

    Messages:
    333
    Likes Received:
    68
    Trophy Points:
    0
    Not sure which order they're loaded in, if you're trying to override scripts using /custom I think you would need to make a gameinfo.txt edit to make custom content load after root game files.

    You can test this, but I think it loads custom first - then overrides it with root files.
     
  14. BlackRedDead

    BlackRedDead Member

    Messages:
    268
    Likes Received:
    6
    Trophy Points:
    0
    updated topic:
    added how-to, credit&link


    if anything wrong or could be improved, let me know
     
  15. blizzerd

    blizzerd Member

    Messages:
    10,552
    Likes Received:
    60
    Trophy Points:
    0
    i use git for that, version control and everything muh naggir
     
  16. BlackRedDead

    BlackRedDead Member

    Messages:
    268
    Likes Received:
    6
    Trophy Points:
    0
    on what is this related to?
     
  17. blizzerd

    blizzerd Member

    Messages:
    10,552
    Likes Received:
    60
    Trophy Points:
    0
    >Building an modding enviroment beside your Empires installation
    >without interference with your ususal multiplayer installation or the risk of being overwriten by updates

    i use git for that, so i can run empiresmod versions and scripts from as old as 2.24 while only having 1 folder needed and scripts of their versions just 'work'.
     
  18. Lazybum

    Lazybum :D Staff Member Moderator

    Messages:
    4,827
    Likes Received:
    190
    Trophy Points:
    0
    I used to use tester's svn, but nothing get pushed there anymore.:(

    I mean sure it was more space but it felt like less hassle.
     
  19. BlackRedDead

    BlackRedDead Member

    Messages:
    268
    Likes Received:
    6
    Trophy Points:
    0
    well, tryed git - not suited for my simple needings, just uploading code and be able to split in versions where needed (actually to much effort for very little payout)
    maybe later when there is something for "version control"!^^
    (at least git is easy to understand and there are some good GUI's available like tortoise or git extension)

    is there a repository where i can get the stoneaged 2.24? - would be interesting to look what changed in detail
     
  20. BlackRedDead

    BlackRedDead Member

    Messages:
    268
    Likes Received:
    6
    Trophy Points:
    0
    maybe link it somewhere in the coding forum?
    (google? - what was SVN again? google: Apache Subversion - thx google)
     

Share This Page