Basic Mod Questions

Everything about mods can be found here.

Moderator: Morax

Basic Mod Questions

Postby Crazy Cossack » 10 Oct 2018, 05:31

Hello, I need some basic info to get started in modding.

1. How do I get a unique UID for my mod?

2. Where is the mod directory or where are all the mod directories (if there are more than one).

Explanation for question 2:

I found one mod directory on my pc in C:users/%username%/Documents/My games/Gas Powered Games/Supreme Commander Forged Alliance/Mods.
In that mod directory are a few mods I downloaded from the the Vault, namely Common, EM and UI-Party.
However, the other old standard GPG mods (very simple examples like 2x Res) are not there.
Where are the other mods and where are the FAF mod itself and other major mods of FAF like Nomads etc. Can I view their code?

3. Also in C:/program files(86)/steam/steamapps/common/Supreme Commander Forged Alliance/gamedata there is a files called mods.scd.
This seems to contain info about other mods. What does this file mean and what does it do exactly? Does it implement some more mods?
Crazy Cossack
Avatar-of-War
 
Posts: 53
Joined: 13 Mar 2013, 12:44
Has liked: 0 time
Been liked: 9 times
FAF User Name: Crazy_Cossack

Re: Basic Mod Questions

Postby nine2 » 10 Oct 2018, 06:28

unique id - just invent a random number. there are websites that do this. i made one for you: 64867d1f-b4f8-421b-8dc0-30a058305846. You might have to remove hyphens i cant remember

normal mods from the mod vault that you have downloaded are in documents like you said.

not sure where the built-in ones (like 2x res) are but perhaps mods.scd is the answer. SCD files are zips - copy the file, rename to zip, extract to see the mod. Move the extracted files somewhere else to avoid being confused about if it is using the extracted version instead of the SCD version.

in c:\programdata\faforever\gamedata there are the FAF mod itself and probably things like Nomads. They are "nx2" files but once again they are just zips so copy, rename, extract, move somewhere else.

You can also see the FAF mod content on github.
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Re: Basic Mod Questions

Postby Crazy Cossack » 10 Oct 2018, 07:40

Annhilnine, Thank you for your patience. I think I finally found it. Only after getting Windows 10 to search for compressed folders. OMG Windows 10 file search is hard to use. I miss Windows XP.
Crazy Cossack
Avatar-of-War
 
Posts: 53
Joined: 13 Mar 2013, 12:44
Has liked: 0 time
Been liked: 9 times
FAF User Name: Crazy_Cossack

Re: Basic Mod Questions

Postby nine2 » 10 Oct 2018, 08:21

you just need to display hidden folders and go to
c:\programdata\faforever\gamedata
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Re: Basic Mod Questions

Postby Crazy Cossack » 10 Oct 2018, 23:37

I need some links to good explanations of hooking code (non-destructive and destructive) in Sup Com / FA / FAF.

When I modded Cossacks 3, the method was to replace one or more whole script file(s) with the modded whole file(s). The scripts are written in object pascal. Even if I was just changing a few parameters in a large file, I had to destructively replace (or hook) that whole file over the vanilla game file. Their mod manager automatically did the file replacements or overwrites during load. This meant I was using the tools Notepad++ for file editing and WinMerge to merge new patch code after a patch or new version release, if the release affected the file in question. So I am familiar with those tools. Each patch or release would break the mod if the patch changed files that the mod had changed. Then I had to use WinMerge to compare files and place the new patch code into my modded file(s). At the same time, I had to be careful to not overwrite or lose any of my modding changes already in that file. So, I guess you could say the modding method provided by Cossacks 3 was destructive hooking at whole of script file level. A new release or patch often broke the mod which led to lots of maintenance.

If I was just changing some parameters of units (in the blueprint files) in FAF (as a learning exercise) how would I go about hooking these changes in? Take the simplest example. Imagine I was changing the health of the UEF ACU (in UEL0001_BP) what would be the simplest, most elegant way to hook that?

Footnote: I got sick of patches always breaking my Cossacks 3 mod and in the end I stopped supporting it. Cossacks 3 was released in a poor state and needed constant patches to fix the multiple problems it had. Every patch broke my mod and it took hours of comparing and merging to fix it each time. That left too little time and energy for new changes.
Crazy Cossack
Avatar-of-War
 
Posts: 53
Joined: 13 Mar 2013, 12:44
Has liked: 0 time
Been liked: 9 times
FAF User Name: Crazy_Cossack

Re: Basic Mod Questions

Postby Uveso » 11 Oct 2018, 00:27

In SupCom you can hook a single function from a scriptfile.

Here an example for a non destructive hook from another topic:
(hooking the SetVeteranLevel function inside the unit class)
Code: Select all
-- Save the original Unit class
local oldUnit = Unit

-- Crate a new unitclass with all functions from the old Unitclass
Unit = Class(oldUnit) {

    -- Noe we are overwriting the original SetVeteranLevel  function.
    SetVeteranLevel = function(self, level)

        -- first lets call the old original SetVeteranLevel function.
        oldUnit.SetVeteranLevel(self, level)

        -- now we can add our own stuff
        -- Maybe add a Name to the unit with Vetaran Level:
        self:SetCustomName('Veteran Level '..level)
    end,

}
User avatar
Uveso
Supreme Commander
 
Posts: 1788
Joined: 11 Dec 2015, 20:56
Location: Germany
Has liked: 70 times
Been liked: 291 times
FAF User Name: Uveso

Re: Basic Mod Questions

Postby nine2 » 11 Oct 2018, 00:46

viewtopic.php?f=45&t=8524&p=80830&hilit=gold#p80822

^ this post explains hooking well. once you understand how the concat works everything makes sense. Let me know if u don't get it
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Re: Basic Mod Questions

Postby Crazy Cossack » 11 Oct 2018, 23:40

I can do basic hooking now, at least to the blueprint files. I guess hooking to other files is the same principle.

My main need now is to understand the best way to test changes. I've been going in and hosting FAF Sandbox games for myself to test, LOL. I am sure this is not the way I really should be testing initial changes. I assume I should be starting FAF on my PC outside the Game Lobby and testing in that manner. Do I just start the faf.exe or is there a .bat or initializing file to run? I guess I need to know cheats too so I can drop enemy units on the map and attack them in tests. All help is appreciated. :)
Crazy Cossack
Avatar-of-War
 
Posts: 53
Joined: 13 Mar 2013, 12:44
Has liked: 0 time
Been liked: 9 times
FAF User Name: Crazy_Cossack

Re: Basic Mod Questions

Postby nine2 » 12 Oct 2018, 00:53

you can just run the exe to launch the game, supcom.exe or whatever it is from programdata. however its better to make a batch file so you can include the command line arguments to watch files. when u enable this it will pay attention to many code changes without having to restart.

turn cheats on and your mod and make game speed adjustable so +\- speed things up.

alt-f2 spawns a unit and allows u to change armies (play as the enemy)
alt t teleports I think
I set up other keys like instability

ctrl f10 restarts an AI match without having to do the lobby.

f9 shows debug log where u will find errors.

when u screw up the error log will be huge and the game will be mostly unrecoverable... restart (control f10) works often but sometimes u have to kill the process
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Re: Basic Mod Questions

Postby nine2 » 12 Oct 2018, 00:53

(I answer u on my phone so I can't give precise info)
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Next

Return to Mods & Tools

Who is online

Users browsing this forum: No registered users and 1 guest