Adding Patches To Your Mod when using the Offical Mod Maneger

Discussion in 'Modding' started by Ftoomsh, Nov 28, 2016.

  1. Ftoomsh

    Ftoomsh Well-Known Member

    There are many things about modding C3 which are yet to become clear. For example, everyone here is probably aware a new release of two new nations and 5 new units, if I recall correctly, is coming out in about 11 days. This brings to the foreground the issue that the current official modding method does not hook new code into the program but replaces whole files at load. For example, my little Expensive Diplo Units mod will not automatically get the new nations and units in it. I would have to do one of two things to upgrade it. Either I would have to;

    (a) Find the new code in the new unit.script file and copy it into the appropriate place in my modded unit.script file; OR
    (b) Take a copy of the new unit.script file, place it in my Expensive Diplo Units folder location and do all my mod changes again.

    While a mod is simple, neither process is hard. But once a mod gets complex and extensive either process could be a nightmare without a file compare utility to help one through it.

    So, as well as learning modding, I am pondering what protocols I will need to set up so that I don't lose previously modded changes and so that new patches to the game get put into my mod as well, provided I want those changes in my mod of course. But I would certainly want new nations and new units (but rebalanced maybe) imported into any mod.

    Any thoughts on this issue anyone? To give an idea of the complexities and ramifications involved in an extensive mod, here first are just some parameters for just one unit.

    UNIT Version Life Food Wood Stone Coal Iron Gold BuildTme Damage Pause AttkMin AttkMax Material CanKill SwordDef PikeDef BulletDef ArrowDef CannonDef GrapeshtDef Shield Vision Walk
    17thpikeEu C3 Vanilla 95 22 0 0 0 20 0 150 8 ? ? ? Body Body,Fence 2 2 5 1 7 255 0 2 24
    OC Mod1 350 66 0 0 0 30 0 300 14 31 30 150 Body Body,Fence 5 1 5 75 10 50 5 2 24

    Okay, that did not format correctly but you get the picture. Then, there are hundreds of these units each with dozens of their own parameters beyond what I show above (though these are some of the main unit parameters to change in a balancing mod). Then there are nation definitions and parameters, building definitions and parameters, upgrade definitions and parameters, formations definitions and parameters and others I have probably forgotten for the moment. This is before adding in more menu options and morale, fatigue, friendly fire and like issues which require new programming. You can see that the permutations and combinations in a full mod multiply out to the several thousands. This is all doable. It is like any intricate model making. It requires time and a meticulous approach.

    Where it would become an unmanageable problem however is if all this has to be restated after each patch. Thus, I think would have to take approach (a) above. That is, "Find the new code in the new unit.script file, and probably, several other files, and copy it into the appropriate places in my modded files. This will require more file compare utilities and skills than I currently have. Again, however, I hope for this to be doable in the long run.

    Any thoughts or ideas on this issue are welcome.
  2. Ebel

    Ebel Moderator Staff Member

    Personally, as long as they are bringing out weekly patches, I think it's too early to make an extensive mod. Not just because of the changes it brings to the files like you mentioned, but also because what you change today may be obsolete by gcs's next patch. Don't let me discourage you from modding or gaining experience until the game becomes more stable though.

    As for (a) and (b). I think it would depend on the patch they bring out. If the patch changes more than what you changed ( ie, entire new nations being added) then use (b), if the changes are minor , then use (a). But there is also (c) : look into how the unofficial mod manager works. It only has your changes, and that is the advantage of the unofficial mod manager. I'm sure someone else might have thoughts on a method (d) aswell.

    Regardless of which method, you will have to check or at least reapply changes on every patch that is being brought out. Which brings me to methods of comparing files. I use sublime text (which is free), all you have to do is see which files are changed by date, then in sublime text 'open a folder', select both files and click on 'diff files', it will show you every change done to a file. Sadly this only works for utf-8 encoding, and their files arent utf-8, so you first have to save them as with utf8 encoding.
    I'm sure other people have other methods of doing this with their own preferred programs and can shed some light on this for you aswell. Having the code on Github surely would be nice for this but I don't think anyone wants to maintain a github account and update it every patch. (not to mention, i'm not sure how legal it would be or if gsc would be ok with it, certainly shouldnt put the entire game folder on there).
  3. yquinox

    yquinox Member

    I think, that I have writen it about 5 times somewhere on the forum: USE UNOFICIAL MOD MANAGER!

    My mod has 600+ lines, you can easy download it, open in Notepad++ and see, how it looks like. I think, that would be imposible to make it through oficial mod manager - copying whole files and copying text pasages in those files after every new patch. No.

    With unoficial mod manager I only replace a part of text, which I want to. E.g. I want to have HP of pikeman on 200, so I replace only that part of text, not whole unit.script file. If a new patch comes, there is no problem, if they change AI setting, colors or something else, but my change affects only pikeman (until they change original pikeman text).

    Now, when a new patch comes, it is posible, that my mod will work without problems. If it doesnt, I only need to find some minor changes in original text (which Iam replacing) and put this new text into my mod. Example:

    original text: objbase.maxhp := 30;
    text I want: objbase.maxhp := 50;

    I want to replace this archers 30Hp with new value of 50. So in mod, using unoficial mod manager, it will look like this:
    "objbase.maxhp := 30;":"objbase.maxhp := 50;",

    But in new patch they can change the original archers HP from 30 to 35. If I want to install my mod, mod manager tells me, that "objbase.maxhp := 30;" was not found. So I look after this value in new patch files where I find "objbase.maxhp := 35;". Then I just repair my mod to this:
    "objbase.maxhp := 35;":"objbase.maxhp := 50;",

    As you can see, now archer will have 50HP. I didnt affect anything else in new patch file (there can be changes in AI, variables, ...).
  4. Setakat

    Setakat Member

    I realised this issue myself early on when daily patches were a thing. My chosen solution was to figure out how to add new scripts, make my changes in those, and then load them into the game. Turns out it was easier said than done, but I managed to figure it out.

    Its not really the most ideal solution, and rather basic, but works OK if your changes are limited to the scripts I've got hooked. Anything more complex/extensive and you're probably better off making changes using both the official mod manager to manage your mod so you don't damage the games default files, and the unofficial mod manager to make the changes in bulk.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice