Amineri Posted May 15, 2013 Author Share Posted May 15, 2013 I had a thought that perhaps the XCOM Soldier character type could be added to the mix of possible alien units. After all, there is clearly some AI code to allow the alien player to move and shoot with Mind Controlled XCOM soldiers. This would allow a couple of possibilities:1) Enslaved humans from countries that have falled under alien domination2) MIA Soldiers that have been permanantly mind-controlled (via surgical implants to the brain) and are now permanantly on the alien side Unfortunately, my first crude attempt (just adding type 2 to the pod list) caused the entire map to fail to load, and caused the game to hang when the first turn was ended. I'll have to see if there is some other clever way to get the correct soldier meshes to load for an alien unit. Link to comment Share on other sites More sharing options...
Yzaxtol Posted May 15, 2013 Share Posted May 15, 2013 Hahahah. Having Gary "Badass" Williams return with his Rocket Launcher to wreak terrible vengeance on being left behind... awesome but highly unlikely to make it work :( Link to comment Share on other sites More sharing options...
Amineri Posted May 15, 2013 Author Share Posted May 15, 2013 Hahahah. Having Gary "Badass" Williams return with his Rocket Launcher to wreak terrible vengeance on being left behind... awesome but highly unlikely to make it work :( True, but I like to set myself 'stretch' goals, just to see what is possible. If I could get the unit built, equipped and the behavior set, I think the AI is already built to take limited advantage of possessed soldiers. I don't know if they can use any of their active abilities, though. Link to comment Share on other sites More sharing options...
Vereist Posted May 15, 2013 Share Posted May 15, 2013 You should be able to use SetDrawScale() to change the scaling of the mesh. But then you'll need to use SetTranslation() to move it up out of the ground since it scales from the center. However, it may run back into the ground when it moves. Link to comment Share on other sites More sharing options...
Amineri Posted May 16, 2013 Author Share Posted May 16, 2013 You should be able to use SetDrawScale() to change the scaling of the mesh. But then you'll need to use SetTranslation() to move it up out of the ground since it scales from the center. However, it may run back into the ground when it moves. I will have to check that out. You seem a lot more knowledgeable about the Unreal Engine than me. I actually knew nothing about Unreal Engine coding before beginning to work on the XCOM modding a few months back -- have purely been winging it. ---------------------------------------------------------------------------- In other matters: I've been playing around with designing a new points-based system for the AI to use in creating its squads. Currently it uses fairly fixed numbers of pods/units based on mission-type / difficulty setting, and randomizes the units picked. This works okay since the unit variation isn't too great, but with a wider variety of possible pod sizes and compositions, this could start to cause problems with too-easy/too-difficult missions. I'm basing this on the way that the MP points are selected, although since item options aren't available that simplifies things considerably. Note that this is not SIMPLE -- just simpler than if I had to consider items. The other good news is that I found some functions relating to squad composition that I can re-use for this point-based system : LimitSquadCost -- ~1114 bytesTallySquadCost -- ~464 bytes both are decently sized. Here is the overview of how the AI would select the squad: Steps to determine squad composition:1) Determine point limit for mission2) Determine maximum number of pods -- some maps may have more limited number of spawn points3) Determine min/max pod points, based on time, XCOM squadsize or other factors (including mission and max pods)4) Determine % of soldier pods, relative to secondary (terror) pods5) Determine commander pod (may depend on mission) a) Roll as necessary to determine supports b) Roll as necessary to level up commander c) Subtract points for commander pod from total point limit6) Add any specific pod type(s) for the particular mission a) Randomize as desired b) Subtract points for specified pod(s)7) Loop until all points spent or max pods reached a) Roll to determine whether next pod is primary or secondary b) Roll on arrpossibles to determine squad type c) Determine point cost per unit i) Base num_units_in_pod = (point remaining)/((pods remaining) * (points per unit)) ii) Randomize this number ii) clamp this based on min/max points per pod d) Roll for leader from arrPossibleCommanders i) Check to see if leader is valid for squad type, if not roll again e) Roll to see if leader is upgraded (only possible if max points per pod has not been reached) f) Add up points for pod (units + leader) i) decrement points from total available ii) decrement number of pods remaining f) Loop to next pod Points available would primarily be based on time: points = base_points + Days * points_per_day; (divide Days by SW_Marathon if IsOptionEnabled(7)) Additional modifiers based on mission type could be defined. For example: Abduction Missions: Easy : x 0.75 Normal : x 1.0 Difficult : x 1.25 Very Difficult x 1.5 UFOs: Small Scout : x 0.75 Large Scout : x 1.0 Abductor : x1.25 Supply : x1.5 Battleship : x.1.75 Terror Missions : x 1.5 Alien Base : x 2.0 FC Missions : x1.0 The maps have a maximum number of spawn points, so it's best not to push past that. A maximum number of pods based on vanilla Impossible is defined via: Maximum number of pods Don't exceed what is already possible in Impossible difficulty This does not include the commander pod Abduction : 5 pods (Long War has modded up to 18 aliens in an abduction mission) Terror : 5 pods Special : 4 pods, 6 dynamic aliens UFOS Small scout : 4 pods Large scout : 5 pods Abductor : 5 pods Supply : 5 pods Battleship : 8 pods Overseer : 5 pods Alien Base : 11 pods To ensure that no single pod is overly difficult, a min and max point value for each pod can be defined via: Determine min/max points_per_pod Use points and max_podsmin_points_per_pod = total_points/max_pods * 0.75max_points_per_pod = total_points/max_pods * 1.25 To make Terror Missions and Abduction Missions keep having different alien pools (like they do now), as well as the mix of Terror/Regular aliens for other missions, a % chance of getting Regular pod types is defined per mission type: Determine % of soldier pods (relative to secondary/terror pods) Abduction : 100% soldier Terror : 0% soldier Special : 100% soldier UFOs Small scout : 100% soldier Large scout : 100% soldier Abductor : 70% soldier Supply : 57% soldier Battleship : 63% soldier Overseer : 75% soldier Alien Base : 50% soldier I have more details worked out on how the Commander and Pods are selected, but I think I'll stop here, as this post is already getting pretty darn long. Basically a points system would allow for a reasonable variety of pod sizes and compositions. Both smaller pods with powerful units and larger pods filled with weaker units are possible. Each pod would fall into a "reasonable" range, and the overall squad size (all pods) would be controlled in an manner to prevent overly easy/difficult missions (except as configured -- e.g. small scout). ----------------------- This would primarily be configurable via setting when aliens become available (based on month), the starting points amount and rate at which available AI squad points increase, the points multipliers per mission, a points multiplier based on difficulty, as well as configuring which alien units can lead which types of pods. More points can lead to larger alien squads, or it can lead to the same number but tougher aliens. I realize that this is rather long and complicated, but any feedback would be most welcome. Link to comment Share on other sites More sharing options...
Yzaxtol Posted May 16, 2013 Share Posted May 16, 2013 it's a nice system to make sure that the randomness doesn't provide a too crazy combination. But then THAT'S XCOM BABY Link to comment Share on other sites More sharing options...
Vereist Posted May 16, 2013 Share Posted May 16, 2013 I've dabbled a lot with Unreal over the years. Never done anything particularly noteworthy with it, and I couldn't do much of anything off the top of my head. But I usually know what to look for to find out what I need to know. The point system is a good idea. It reminds of Battletech's Battle Value. To translate, you'd break it down into points for everything. A base sectoid would be 100 points. An ability like Mind Fray would be worth another 50. Hitpoints would be like 10 apiece. So the standard sectoid might be 130 points, But you could have a 180 point one by either adding 5HP or giving it Mind Fray. The granularity of your point system would be dependent upon how much other perk/equipment/stat/whatever options you put in for them. The point thing also reminds to ask if you've looked into gutting the multiplayer classes. I haven't looked at the size counts or anything, but if you needed to rewrite an entire class, you might be able to use the space from one of the multiplayer classes. Just rename it and extend it like the existing one does. Obviously, we aren't using that, which is the same reason you can get rid of replication data and role authority checks in existing functions. Link to comment Share on other sites More sharing options...
kara42 Posted May 17, 2013 Share Posted May 17, 2013 (edited) For those who wish to play around with the larger pods, I'm posting up the hex code that allows it on the tactical side. (...) Otherwise this change should be compatible with existing strategy pod definitions -- pods should by default be created in the same manner as without this hex change. In order to actually get a larger pod, the functions in XGStrategyAI have to be modified. This should allow a modder to change only the pod generation instances that she wants to, without breaking the game.Which other functions (in the xcomstrategy.upk I guess?) need to be modified to make use of the increased pod size? Edited May 17, 2013 by kara42 Link to comment Share on other sites More sharing options...
Amineri Posted May 17, 2013 Author Share Posted May 17, 2013 Which other functions (in the xcomstrategy.upk I guess?) need to be modified to make use of the increased pod size? I think that all of the necessary functions are in XGStrategyAI. The functions : DetermineAbductionSquadDetermineSpecialMissionSquadDetermineTerrorSquadDetermineAlienBaseSquadDetermineSmallScoutSquadDetermineLargeScoutSquadDetermineAbductorSquadDetermineSupplySquadDetermineBattleshipSquad form the basis of what is in each type of squad, defining pod types and number of aliens. DistributeAliens loops through the pods defeind by "Determine", picks alien types and calls the BuildPod function. ProcessPodTypes is a distribution function that adjusts the number of pods based on total alien count. BuildPod is what actually fills out the Pod structure, given an alien type and number of aliens in that pod. GetSupportAlien is what the game currently uses to determine what the 2nd/3rd alien in a pods are (Drones with Cyberdisc/Sectopod, Muton Elite with Ethereal, etc) GetPossibleAliens fills out a weighted array of possible allowed based on month. ChooseAlien picks a random alien from the possible aliens. GetCommanderPod decides which commander type is present. ---------- There's a few additional helper functions too: GetNumOutsiders, CostAlienSquad, LimitSquadCost, GetFreeAlien, GetAltWeapon, CheckAlienLimited, TallySquadCost, UpdatePossibleAliens, NormalizeValues, CheckAlienLimited Good luck, Commander. Link to comment Share on other sites More sharing options...
johnnylump Posted May 20, 2013 Share Posted May 20, 2013 (edited) There is some kind of point system in place ... I couldn't quite figure out what it does; I think it keeps the missions from being too easy, but it might do just the opposite. Look for references to the variable SPECIES_POINT_LIMIT (from DFG.ini) in XComStrategyGame, For Long War I set it to -1, which turns off whatever governor is in place; the mod creates so many missions I WANT them to vary significantly in difficulty. Also, if you're using LW as a reference, I've changed pod counts for abductors from vanilla. Edited May 20, 2013 by johnnylump Link to comment Share on other sites More sharing options...
Recommended Posts