Jump to content

Combined mod


Tycus

Recommended Posts

Amneri said, "There is a bit of a gap on the wiki between making simple value hex edits and more significant code changes, but I haven't figured out how to structure a tutorial. I've been working with Zybertryx to try to explain some of the fundamentals, so I'm hoping that he'll take the materials I sent him and put together a wiki tutorial while the learning process is still fresh in his mind (*hint hint* :wink: )."

 

And I will as soon as I'm able to make new changes beyond single byte replacements myself that don't break vital functions or crash the game (everytime) :(

 

There's a lot to soak in, your basic work flow system of breaking down an entire function into its discrete hex blocks which correspond exactly to the different lines in the decompiled code is a very important bridge between simple hex-side integer replacements and the "WTF" of the rest of it though. The more one does this, the more one sees patterns and the more easily one is able to isolate the beginning and end of different calls (lines/sub-functions) with in a function. I have this down now, it's just that splicing X into Y where X previously didn't exist usually results in my breaking Y . . .

 

@ Tycus,

 

Differing difficulty levels is a small price to pay for such an amazing control over alien stats. You also said that "damage reduction" is meaningless without "perks" to "go along with it". I don't understand this at all. What is a perk but a function which modifies a general mechanic specific to the unit which has it? The Aliens Upgrade modlet does exactly that on a per-species basis. Damage Reduction via the DGC is a "perk" for all practical purposes, as is Regeneration via the same method etc.

Link to comment
Share on other sites

  On 7/10/2013 at 9:05 PM, Zybertryx said:
@ Tycus,

 

Differing difficulty levels is a small price to pay for such an amazing control over alien stats. You also said that "damage reduction" is meaningless without "perks" to "go along with it". I don't understand this at all. What is a perk but a function which modifies a general mechanic specific to the unit which has it? The Aliens Upgrade modlet does exactly that on a per-species basis. Damage Reduction via the DGC is a "perk" for all practical purposes, as is Regeneration via the same method etc.

No, no, you got it all wrong. What I mean I have compiled list of perks (passive perks taken from XCOM soldiers) for aliens, and Damage Reduction should have been just one more in line of them. And no, I was not referring to difficulty levels as a feature (more likely replicated bug) of my mod (was really small feature anyway: basically, what it does, its when new chryssalid spawns from zombie, it stats would be taken from different difficulty level, so I made newborn chryssalids a bit weaker but faster, than "regular" chryssalids; also it will look differently for some reason; same was happening with thinmen, that are dropping from sky in council missions, but only if you loaded mid-mission from save; vanilla bug).

 

  On 7/10/2013 at 8:49 PM, Amineri said:

 

  Quote

 

 

Define "standart". And why not just use that code? I mean, I recall reading about that, and it seemed perfectly suited to do what I need.

 

By "standard" I mean that every alien on the map will have the same stats.

 

The original dynamic alien progression modlet hooks into the difficulty code to change the root characters from which all units draw their stats.

 

The dynamic progression certainly works well. Sorry if I'm throwing too many different options at you :smile:

Why do you keep mixing up my response, people? I was refering for perk-as-items code, not about dynamic alien progression.

 

  On 7/10/2013 at 8:49 PM, Amineri said:

 

I've been thinking about releasing an update that allows for adjustments for all difficulties as well as variable number of upgrades per alien (and more than 2). However, this requires stable installers that can force the game to load the DefaultGameCore.ini from the file instead of from the Resource Cache.

 

I'm pretty sure that dubiousintent and Yzaxtol got that working, but until it becomes "common practice" there's not much use in building a mod that depends on it.

 

Yes, I was not happy at losing diffuclty options as well, but the main problem in forcing game to load the DefaultGameCore.ini lies in increased mission load times (which would suck), so I redesigned my mod in a way that such radical changes wasn't needed at all.

 

I think I'm stuck with XGUnit.DebugAnims option to add perks for aliens (btw, is there any limit on how much perks can be granted to single alien type by this method?). Some step-by-step instruction also would be nice (so I would not accidentally mess up).

 

Here is the list (would love some feedback on that perk composition as well):

 

Sectoid: Low Profile,

Thinmen: Lightning Reflexes, Opportunist, **

Floater: Damn Good Ground, Aggression, Low Profile

Heavy Floater: Damn Good Ground, Aggression, Low Profile, Hardened(s), Vengeance(iq) *

Muton: Covering Fire, Tactical Sense, ***

Muton Elite: Covering Fire, Tactical Sense, Will to survive, Hardened(s), Mayhem(iq), *, ***

Muton Berserker: Tactical Sense(q*), Resilience (s)

Cyberdisc: Squadsight(iq), Damn Good Ground, Dangerzone, Mayhem(iq), *, ***

Drone: Holo-target (iq), Damn Good Ground, Low Profile (do they even use cover, like ever?)

Sectopod: ???, *

Chryssalid: Lightning Reflexes

Outsider: Lightning Reflexes, Close Combat Specialist(q*), Bring Em On(q*), *

Sectoid Commander: Low Profile

Ethereal: ???

 

*Rapid Reaction (and/or Opportunist)//Sentinel for those aliens may be redundant

**Thimen are special case, since they are dropped in overwatch state on council missions

***Grenadier perk may be redundant, if number of grenades on aliens can be adjusted manually (can it?; i do remember reading something about that)

(s) marks are for consequential/simultaneous upgrades (by upgrade I mean option, not actuall in-game upgrade)

(iq) = in question, perks are being tested/not working (my primary concern for unappliable perks; that marks them for priority in testing; can anyone drop any hints about those?)

??? - no ideas (what to give them, that is)

(q*) - questionable ideas, may be unfluffy (those most likely be revisioned, if they contradict lore too much)

 

On subject of learning of rescripting:

  On 7/10/2013 at 8:49 PM, Amineri said:

 

There is a bit of a gap on the wiki between making simple value hex edits and more significant code changes, but I haven't figured out how to structure a tutorial. I've been working with Zybertryx to try to explain some of the fundamentals, so I'm hoping that he'll take the materials I sent him and put together a wiki tutorial while the learning process is still fresh in his mind (*hint hint* :wink: ).

I am sadly aware of it, and judging by his response it looks like tough luck for me.

Edited by Tycus
Link to comment
Share on other sites

Wow, lots of replies in this topic recently.//Surprise, surprise...

Anyway...
UPDATE:
While my progress on a mod has been put on backburner for a while (mostly due to RL reasons), I am happy to inform you all, that my mod steadily closes in for open beta test status, as I am adding much needed features to it, most recent being me finally being able to add perks for aliens (thanks to Amineri, who was awesome as always and shared workable code with me with for that).
Here it is for anyone interested:

  Reveal hidden contents


Also I realised (a while ago, actually), that my concern for increased mission load times has been moot (because there is fix for that, here is the link http://forums.nexusmods.com/index.php?/topic/1001468-forcing-game-to-load-from-defaultgamecoreini/?p=8404760) (how I could missed it? :confused: ).
Anyway, with that possibility in mind I decided to split my mod into two versions: Lite (basic version, that was planned from start) and Extended (where I go crazy with as much of awesome stuff as I could find and put into it; of course, balance would be adjusted accordingly).

Now, I'm am just waiting for code to make certain perks-to-items, and possible solution to improve cover. After that mod would be ready for test launch.

However, this mod needs appropriate name for that to happen ("Combined mod" being a work title), so I'm open for suggestions.

Also here is short tactical guide for it (which is as incomplete as mod itself):

  Reveal hidden contents


And here is changelist (which I made to form, that one can easily apply and modify any features/changes as needed):

  Reveal hidden contents

 

Edited by Tycus
Link to comment
Share on other sites

  Quote

 

 

Drone: Holo-target (iq), Damn Good Ground, Low Profile (do they even use cover, like ever?)

 

I think all of the robots are constrained from using cover at all, along with the melee units.

 

 

Looking forward to seeing more mods come out.

 

We'll get the right flavor of the item mod so you can get the perks on items set up how you want. To start you might try adding the hex code for the "new items" off the wiki. It's listed as WIP primarily because it's not "installable" for an end-user, but with a bit of configuration help Yzaxtol and johnnylump both got it installed and working.

Link to comment
Share on other sites

I hate to be bringer of bad news, but mod is being frozen until further notice.

 

While I managed to successfully (more or less) implement reworked cover, implementing certain perks-as-items happen to get across severe issue. Basically, code that lies on wiki is customized (for Long War) version, that is also not mod-friendly (I asked Amineri directly about the issue, and she said that changes I need require complete rewrite of function in question, but she has no time nor inclination to do that, and obviously, I cannot do that myself yet).

 

Also another issue remaining is terribly repetitive (ergo boring) and disbalancing UFO grind mid-to-late game (one of earlier changes, that I have made to my mod, was increasing number of abduction mission to 5 per month (to apply pressure via panic early) and making UFOs on missions visible to player, so it would be possible to mitigate effect by taking out said UFOs. While early in-game this works as intended, starting from third month and later game becomes horrible grind of large scout UFOs (that are preceding abductions and are trivial to take down at this point in-game). That could be resolved be dynamic UFO selection on missions (here link to R&D thread: http://forums.nexusmods.com/index.php?/topic/1043023-r-d-dynamic-ufo-selection), along (not instead) with other changes (like changing UFO's and interceptor's characteristics or allowing overdamaged UFOs explode mid-flight).

 

I have already incorporated lots of features into my mod (that can be found on this forum), and scheduled some more, but without those two issues resolved I cannot release my mod (which still has no official name).

Here is short list of both:

  Reveal hidden contents

 

 

Anyway, I am asking any experienced coder for help with first issue. Here is link to wiki: http://wiki.tesnexus.com/index.php/Additional_Items_Mod_XCOM:EU_-_2012 (original mod), function in question:

  Reveal hidden contents

original decompiled code:, what it should look like:

  Reveal hidden contents

 

 

Edit: I decided to continue work on mod anyway (by adding features from wait list), but mod will not be released, until both stated above issues are not resolved.

Edited by Tycus
Link to comment
Share on other sites

  • 3 weeks later...

UPDATE:

Well, I have some good news, some bad, and then some...mixed (to put it mildly).

The good: last week at Sunday I have finished adding features to my mod (almost all of wait list and some more).

The bad: still no progress on UFO selection. However, I *might* have resolved item charges issue (*not tested if works as intended*), which for anyone familiar with jump-offsets is fairly easy task and can be done under half-hour, I believe. And I wasted almost a week resolving that; there is silver lining to this, as I now understand this whole jump-offset business, and by looking back I wonder how I could have missed such obvious solution (must have been brain-block or something :rolleyes:).

The ugly: BUGS!!! Bugs everywhere! Now I am on general bug hunt within my mod: as it turns out, I failed to make regular back-ups and checks for each feature I've added/changed, so basically I have to rebuild (and test) my mod from scratch, which could be quite tedious and bothersome task, as estimated total sum of upk changes made so far could easily go up to a hundred (I splitted my mod into 18 semi-separate modules, each with multiple functional upk changes).

 

So as soon as I am through initial test run (in which I fix all obvious/game-breaking bugs) - my mod is out. I believe, between UFO selection and Alien Bases there is no major features left for me to add, so after those (if ever) would be added, I call it complete. After that only minor features/tweaks and fixes be added, and, of course, balance polishing.

However, I am a bit wary to give exact ETA of my mod release, as I have ever-decreasing time to work on my mod (due to RL reasons).

 

I wonder, if there any guide or something on bug hunting? Or can somebody give me some tips on a subject? (or better, join me on the ride :wink:)

So, lets say, game crashes during tactical mission start (after pressing launch button/before skyranger cutscene) - any particular part of code I should look after?

Edited by Tycus
Link to comment
Share on other sites

Without a debugging IDE to set breakpoints or step through code, we kind of have to go back to old-school debugging mechanisms.

 

I generally use a mix of two things:

1) Adding / removing function hex changes to resolve which specific hex change is causing the problem (very rarely I see a side effect or combination of two changes causing a problem)

2) Within a larger hex change I'll add return statements to force a function to exit early. This allows testing which portion of the function is causing the crash. Narrowing the cause of the crash to a couple of lines makes deconstructing the cause a lot easier.

 

Once I've isolated which hex replacement is causing the crash (step 1), you have to dig in and figure out which section of the function is causing it (step 2).

 

Generally how I add return statements is by replacing the 07 ## ## portion of a jump conditional. These three bytes also only take three memory bytes. If the function returns a boolean, int, or has no return value the 07 ## ## can be change to 04 27 0B (or 28 for false), 04 2C 00, or 04 0B 0B

 

This cuts off any later code in the function from executing. If the game still crashes then the bug is before that point.

 

Alternatively you can cause the "true" portion of a conditional to always be skipped by changing the 07 ## ## to 06 ## ##, changing the conditional jump into an unconditional jump.

 

I keep a scratch pad file of such temporary changes to the upks. Sometimes I've had to make up to 6 or 8 such hex changes before isolating the lines causing the crash. 95% of my crashes are due to incorrect jump offsets. The others are a mix of various odd things.

Link to comment
Share on other sites

Most of the below you probably already know but for future reference and the small chance that any of it will be helpfull to you...

 

I use UE Explorer 1.2.4.1 to export all functions I make changes to and edit them separately in hxd before importing them back. (it is a little extra work but pays of in the end, and as bonus you can cut and paste freely in the code and easily identify and correct any resulting size mismatch, in addtion to view buffer and HxD being alligned from byte 0, not to mention that it makes using the Jump Assistant tool much easier to use... )

 

That way I can restore and apply mods on functional level in this kind of situation.... I guess you could do it in reverse by exporting your existing functions, and then open a backup of the upk-file and export the originals to have both versions. Then you can replace all functions (worst case) with originals and apply them one by one until you find the one causing the crash.

 

One important thing to observe is that UE Explorer don't actually save changes to the upk.file until you exit the program (but you can import and export freely regardless and everything is updated in the tool).

 

The most common reason for me to end up with crash is miscalculated jump offsets or forgetting to modify the header offset (decimal byte 41-44) which should always point to address of 53 token +1

 

If you look at a function in View Tokens mode in UE Explorer and token 53 is missing, the reason is that you have not calculated header correctly. It is easy fixed by adding ~255 bytes to current value and look in view tokens again to find correct value and add 1 to it.

Link to comment
Share on other sites

  On 8/10/2013 at 8:01 PM, Bertilsson said:
That way I can restore and apply mods on functional level in this kind of situation.... I guess you could do it in reverse by exporting your existing functions, and then open a backup of the upk-file and export the originals to have both versions. Then you can replace all functions (worst case) with originals and apply them one by one until you find the one causing the crash.
  On 8/10/2013 at 7:53 PM, Amineri said:

Without a debugging IDE to set breakpoints or step through code, we kind of have to go back to old-school debugging mechanisms.

 

I generally use a mix of two things:

1) Adding / removing function hex changes to resolve which specific hex change is causing the problem (very rarely I see a side effect or combination of two changes causing a problem)

<..>

Once I've isolated which hex replacement is causing the crash (step 1), you have to dig in and figure out which section of the function is causing it (step 2).

That was the plan. I was only asking if there is any way to narrow list of suspects, so to speak, so I don't have to go through every single change (there is a lot of them). Because in process of updating one of my latest experimental additions I realized that game does not crash (hang up) until incorrect part of code is called, so by knowing which functions is called in a moment I described earlier and by knowing what parts have been modified I can track it down to what exactly causing the crash.

 

  On 8/10/2013 at 8:01 PM, Bertilsson said:
<..> or forgetting to modify the header offset (decimal byte 41-44) which should always point to address of 53 token +1

This is most likely, as sometimes I replace the function (complete with correct header and all), then do a minor adjustment to modded function, but forget to update the header. Of course, I do not completely exclude other reason (broken jump offsets), as while I modify and keep track of jump offsets in modded part of function I may *accidentally* break jump offsets (which I have missed) in unmodded part (done some changes like that before your tool was available).

 

Btw, could be anything helpful in a log file?

Edited by Tycus
Link to comment
Share on other sites

So, specifically, if the game is crashing after pressing "Launch Mission" there are unfortunately a few areas that could be the problem.

 

That button is what switches the execution from running in XComStrategyGame.upk to XComGame.upk. Basically, the strategy game code gets put on hold and the tactical game starts to init. All of the battles initiation code executes, which includes setting up the map and both the XCOM and alien squads.

 

Key classes that init are XGBattle (fairly high level initiation), XGBattleDesc (loading mesh / animation assets for all actors), XGSquad (for both the alien and human player), XGUnit (for both human and alien players). The code that is creating the aliens with perks is getting executed, as is the XGUnit.UpdateItemCharges code for both the human and alien units.

 

So unfortunately there are quite a few possibilities ... :(

 

Typically when I am building a larger modlet (having never actually created an integrated mod) ... say .. like the alien base stuff, which had 15 or so separate hex changes. Anyhow, what I do is map out a plan in which I can rewrite each function one at a time, and run the game after each function hex change. The functionality won't be complete, but I can verify that the code will execute. I'd say that at best about 50% of my hex changes actually run on the first try, and sometimes it takes several iterations before I get a running piece of code.

 

I also have to have a test game that will actually execute the piece of code. An incorrect memory size in the header will cause the game to crash at launch, but an incorrect jump offset will only cause the game to crash when that particular jump is executed. So, as an example with an if/else statement if the jump on the second unconditional jump is incorrect the game will only crash if the if evaluates true.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...