johnnylump Posted December 17, 2012 Share Posted December 17, 2012 (edited) Has anyone had any luck digging out the code for the numbers and selection of enemies in each battle? One starting point may be XComGame.upk XGDeployAI Edited December 17, 2012 by johnnylump Link to comment Share on other sites More sharing options...
Drakous79 Posted December 17, 2012 Share Posted December 17, 2012 (edited) Hey Johny :) Check out XGStrategyAI within XComStrategyGame.upk. For number of pods and number of aliens in it:DetermineAbductionSquad()DetermineAlienBaseSquad()DetermineSpecialMissionSquad()DetermineTerrorSquad()DetermineUFOSquad()For alien types:GetPossibleAliens()GetSupportingAlien() Edited December 17, 2012 by Drakous79 Link to comment Share on other sites More sharing options...
johnnylump Posted December 17, 2012 Author Share Posted December 17, 2012 (edited) A-ha! My thanks. Some finds: GetPossibleAlienSquad function controls aliens' progression (that is, which aliens show up in which month) and frequency of lesser aliens in later months. GetSupportingAlien controls individual alien "pod" (group of 1 to 3) composition; I guess that's where a few aliens (cyberdisks, sectopods, etherials) get their weaker escorts, rather than more of the same. CostAlienSquad makes reference to the dgc.ini "SPECIES_POINT_LIMIT" but I'm still not clear what it does. This may ensure that too-strong alien squads are nerfed a bit. Setting Species_Point_Limit to -1 seems to disable this feature. Edited December 17, 2012 by johnnylump Link to comment Share on other sites More sharing options...
BlackAlpha Posted December 18, 2012 Share Posted December 18, 2012 (edited) Hey Johny :) Check out XGStrategyAI within XComStrategyGame.upk. For number of pods and number of aliens in it:DetermineAbductionSquad()DetermineAlienBaseSquad()DetermineSpecialMissionSquad()DetermineTerrorSquad()DetermineUFOSquad()For alien types:GetPossibleAliens()GetSupportingAlien() I looked through there before to try to modify the group sizes (make the groups larger), but I had no luck with it. I hope somebody else can figure out how to do it. Changing the group size/composition will probably fix the low difficulty in the mid/end game. Edited December 18, 2012 by BlackAlpha Link to comment Share on other sites More sharing options...
johnnylump Posted December 18, 2012 Author Share Posted December 18, 2012 (edited) Hey Johny :) Check out XGStrategyAI within XComStrategyGame.upk. For number of pods and number of aliens in it:DetermineAbductionSquad()DetermineAlienBaseSquad()DetermineSpecialMissionSquad()DetermineTerrorSquad()DetermineUFOSquad()For alien types:GetPossibleAliens()GetSupportingAlien() I looked through there before to try to modify the group sizes (make the groups larger), but I had no luck with it. I hope somebody else can figure out how to do it. Changing the group size/composition will probably fix the low difficulty in the mid/end game. By "group" do you mean what the code calls a "pod" (each group of one to three aliens that activate together) or "squad" (the entire enemy alien force)? I don't think pods can get bigger than three aliens. It looks like that's assumed in the code in lots of places. Here's what I'm trying:- Increase number of aliens in abductions (In DetermineAbductionSquad). You have to increase the number of pods, too, I think, so that the number of aliens <= (number of pods * 3) - 2. Impossible adds those two from the -2 back. - In GetPossibleAliens, I'm delaying the June aliens (cyberdiscs, heavy plasma mutons) by one month, because with all the ways I've nerfed the good guys (longer research times, longer injury recovery times), I keep getting my butt kicked during that month. To make the late game harder, you might make certain really tough aliens more likely by playing with the weighted possibilities for each alien to show up. - I've capped the abduction reward when you get a soldier at sergeant, and made corporals possible when your top soldiers aren't very high ranked. That's in DetermineAbductionReward and DetermineRandomAbductionReward (for that second-wave setting that randomizes the rewards). - Set SPECIES_POINT_LIMIT in dgc.ini to -1. I think this turns off nerfing alien forces (in CostAlienSquad) before a battle when the x-com squad is really weak. I'm not sure you can change alien ship squad sizes; the code looks a little more complicated there. I haven't tested these yet, beyond getting the game to load up with the edited upk, but I can post the code changes if any of those are interesting. Edited December 18, 2012 by johnnylump Link to comment Share on other sites More sharing options...
Stucifer Posted December 18, 2012 Share Posted December 18, 2012 - In GetPossibleAliens, I'm delaying the June aliens (cyberdiscs, heavy plasma mutons) by one month, because with all the ways I've nerfed the good guys (longer research times, longer injury recovery times), I keep getting my butt kicked during that month. To make the late game harder, you might make certain really tough aliens more likely by playing with the weighted possibilities for each alien to show up. -- - Set SPECIES_POINT_LIMIT in dgc.ini to -1. I think this turns off nerfing alien forces (in CostAlienSquad) before a battle when the x-com squad is really weak. I'd love to test these two edits for you if you can get me the code changes, I'll edit my .upk and start a new game. I also tend to have difficulty in June due to the slower tech research & marathon mode! Link to comment Share on other sites More sharing options...
johnnylump Posted December 19, 2012 Author Share Posted December 19, 2012 (edited) - In GetPossibleAliens, I'm delaying the June aliens (cyberdiscs, heavy plasma mutons) by one month, because with all the ways I've nerfed the good guys (longer research times, longer injury recovery times), I keep getting my butt kicked during that month. To make the late game harder, you might make certain really tough aliens more likely by playing with the weighted possibilities for each alien to show up. -- - Set SPECIES_POINT_LIMIT in dgc.ini to -1. I think this turns off nerfing alien forces (in CostAlienSquad) before a battle when the x-com squad is really weak. I'd love to test these two edits for you if you can get me the code changes, I'll edit my .upk and start a new game. I also tend to have difficulty in June due to the slower tech research & marathon mode! SPECIES_POINT_LIMIT is in DefaultGameCore.ini, so it can be modded the old-fashioned way, with modpatcher. I just noticed the procedure returns without doing anything if the variable is less than 0. I think if you raise it above the default 500, it will mean harder missions. (I may be wrong, and you may have to lower it instead). But -1 disables the entire function. For the aliens' advances, look for the following sequences: Each month has a series of weights for different aliens to show up. You can go in and edit the weights and possibly even swap aliens, but for now, I'm only delaying the aliens' advance. Anyway, Month 0 (March) and Month 1 (April) use a different formulation and can't be changed. The function also ends with an "else" statement, so everything after the noted months uses a final set of potential aliens. 3c 44 00 00 2c 02: May Aliens (Mutons)3c 44 00 00 2c 03: June Aliens (Cyberdisc, tougher Mutons)3c 44 00 00 2c 04: July Aliens (Muton Berserkers)3c 44 00 00 2c 05: August Aliens (Muton Elites?)3c 44 00 00 2c 06: September aliens (Sectopods?) The key number is the final two bytes -- that's the month count (after March). To delay the June aliens, you'll want to do this:Change 3c 44 00 00 2c 06 to 3c 44 00 00 2c 073c 44 00 00 2c 05 -- > 3c 44 00 00 2c 063c 44 00 00 2c 04 -- > 3c 44 00 00 2c 053c 44 00 00 2c 03 -- > 3c 44 00 00 2c 04 The May aliens should repeat for June. If you're doing search and replace, make sure you do it in the above order! Edited December 19, 2012 by johnnylump Link to comment Share on other sites More sharing options...
BlackAlpha Posted December 19, 2012 Share Posted December 19, 2012 Could you please also post where exactly inside the files you are edited those things? Having just the HEX values is not enough information to go by. Link to comment Share on other sites More sharing options...
johnnylump Posted December 19, 2012 Author Share Posted December 19, 2012 Could you please also post where exactly inside the files you are edited those things? Having just the HEX values is not enough information to go by. Hrm, I thought it was enough -- those are hex strings unique within the file, so a search within the hex of XComStrategyGame should turn them up. Do you need anything more than function names (which are noted in previous posts)? Because I'm not sure what else to provide. To change alien progression: XComStrategyGame.upk/XGStrategyAI.GetPossibleAliensThere are a series of IF MONTH >= X THEN statements; what follows is a series of weighted chance for different kinds of aliens to show up. The weights and kinds of aliens can be edited, but the following code only designates the months: 3c 44 00 00 2c 02: May Aliens (adds Mutons)3c 44 00 00 2c 03: June Aliens (Cyberdisc, tougher Mutons)3c 44 00 00 2c 04: July Aliens (Muton Berserkers)3c 44 00 00 2c 05: August Aliens (Muton Elite?)3c 44 00 00 2c 06: September aliens (Sectopod?) Changing the last byte (02 through 06) will change the month for that set of weights. If you skip a month, that's OK, because the formulation is >=, so it just means that the prior months alien layout will take precedence. They should stay in the same order, though, because of the way the function is built. So far this seems to work. To edit the range of soldier ranks you'll get as an abduction reward: XComStrategyGame/XGStrategyAI.DetermineAbductionRewardXComStrategyGame/XGStrategyAI.DetermineRandomAbductionReward (for the Second Wave option that randomizes abduction rewards) The code includes a call to another function that builds the award soldier. But you can edit the range of possible ranks by editing the following hex string:26 16 2c 03 2c 05 It will show up twice, once in each of the two functions. The 03 is the minimum rank of the soldier (default: sergeant) and the 05 is the maximum rank (default: captain). I changed it to 26 16 2c 02 2c 03 so the range is corporal to sergeant, because I don't like getting a top soldier for so cheap when I've done so much work to build up the rest of the team. (It looks like there's also a governor on the function that prevents you from rolling up someone higher than one rank below the highest-rank a soldier has achieved so far, but I left that alone.) So far this seems to work. To change the number of aliens during abductions: XComStrategyGame.upk/XGStrategyAI.DetermineAbductionSquad. There is a case (switch) statement that determines the size of the alien squad based on the difficulty of the abduction. (The determined in another function; it's based on the panic in the country, with a randomizer). The code for difficulty 1 (lowest) is 2c 02 0f 00 e7 43 00 00 2c 04 The code for difficulty 2 is2c 03 0f 00 e7 43 00 00 2c 06 The code for difficulty 3 is2c 04 0f 00 e7 43 00 00 2c 08 The code for difficulty 4 is 2c 04 0f 00 e7 43 00 00 2c 0a In each of those, the numbers to change are the ones after the two "2c" bytes.The first number is the number of alien pods (groups of 1 to 3 aliens).The second number is the number of aliens. So difficulty 4 is 04 pods and 0a aliens, or 4 and 10. I'm pretty sure the number of aliens must be >= number of pods AND <= (number of pods * 3) - 2. Playing on impossible will add two more aliens to the squad (which is why the -2 is there). The number of aliens probably doesn't have to be an even number, but I set it that way anyway, because all the default entries were. For example, I changed the 4-difficulty alien squad to 2c 06 0f 00 e7 43 00 00 2c 10 That's six pods, 16 aliens, or 18 on impossible. Seems to work so far. Let me know if and how I can be more specific. Cheers! Link to comment Share on other sites More sharing options...
osito2dancer Posted January 4, 2013 Share Posted January 4, 2013 Could you please also post where exactly inside the files you are edited those things? Having just the HEX values is not enough information to go by. Hrm, I thought it was enough -- those are hex strings unique within the file, so a search within the hex of XComStrategyGame should turn them up. Do you need anything more than function names (which are noted in previous posts)? Because I'm not sure what else to provide. To change alien progression: XComStrategyGame.upk/XGStrategyAI.GetPossibleAliensThere are a series of IF MONTH >= X THEN statements; what follows is a series of weighted chance for different kinds of aliens to show up. The weights and kinds of aliens can be edited, but the following code only designates the months: 3c 44 00 00 2c 02: May Aliens (adds Mutons)3c 44 00 00 2c 03: June Aliens (Cyberdisc, tougher Mutons)3c 44 00 00 2c 04: July Aliens (Muton Berserkers)3c 44 00 00 2c 05: August Aliens (Muton Elite?)3c 44 00 00 2c 06: September aliens (Sectopod?) Changing the last byte (02 through 06) will change the month for that set of weights. If you skip a month, that's OK, because the formulation is >=, so it just means that the prior months alien layout will take precedence. They should stay in the same order, though, because of the way the function is built. So far this seems to work. To edit the range of soldier ranks you'll get as an abduction reward: XComStrategyGame/XGStrategyAI.DetermineAbductionRewardXComStrategyGame/XGStrategyAI.DetermineRandomAbductionReward (for the Second Wave option that randomizes abduction rewards) The code includes a call to another function that builds the award soldier. But you can edit the range of possible ranks by editing the following hex string:26 16 2c 03 2c 05 It will show up twice, once in each of the two functions. The 03 is the minimum rank of the soldier (default: sergeant) and the 05 is the maximum rank (default: captain). I changed it to 26 16 2c 02 2c 03 so the range is corporal to sergeant, because I don't like getting a top soldier for so cheap when I've done so much work to build up the rest of the team. (It looks like there's also a governor on the function that prevents you from rolling up someone higher than one rank below the highest-rank a soldier has achieved so far, but I left that alone.) So far this seems to work. To change the number of aliens during abductions: XComStrategyGame.upk/XGStrategyAI.DetermineAbductionSquad. There is a case (switch) statement that determines the size of the alien squad based on the difficulty of the abduction. (The determined in another function; it's based on the panic in the country, with a randomizer). The code for difficulty 1 (lowest) is 2c 02 0f 00 e7 43 00 00 2c 04 The code for difficulty 2 is2c 03 0f 00 e7 43 00 00 2c 06 The code for difficulty 3 is2c 04 0f 00 e7 43 00 00 2c 08 The code for difficulty 4 is 2c 04 0f 00 e7 43 00 00 2c 0a In each of those, the numbers to change are the ones after the two "2c" bytes.The first number is the number of alien pods (groups of 1 to 3 aliens).The second number is the number of aliens. So difficulty 4 is 04 pods and 0a aliens, or 4 and 10. I'm pretty sure the number of aliens must be >= number of pods AND <= (number of pods * 3) - 2. Playing on impossible will add two more aliens to the squad (which is why the -2 is there). The number of aliens probably doesn't have to be an even number, but I set it that way anyway, because all the default entries were. For example, I changed the 4-difficulty alien squad to 2c 06 0f 00 e7 43 00 00 2c 10 That's six pods, 16 aliens, or 18 on impossible. Seems to work so far. Let me know if and how I can be more specific. Cheers!Cool, didn't catch this at first, seems that i just glanced it tiredly. Thanks for pointing it back :). Couple of things though: The reward soldier can be 1 rank above your highest soldier if that soldier is below the minimum range (for example, i have gotten a Seargent soldier when my top guy was still a Corporal), but seems to reset itself when you go above that threshold (i dont recall getting a Major when my top one was Captain). Also, i do remember getting a Major soldier at some point (when my top guy was Colonel), so the top limit might be off. Link to comment Share on other sites More sharing options...
Recommended Posts