Difference between revisions of "XComStrategyGame.UPK (EU2012)"

From UFOpaedia
Jump to navigation Jump to search
(Created page with "XComStrategyGame.UPK is a Unreal Engine 3 file used to determine several functions of XCOM: Enemy Unknown related to the strategic layer of the ...")
 
Line 27: Line 27:
 
** If objective is 5 (Abduct), eMission = 2 (Abduction)
 
** If objective is 5 (Abduct), eMission = 2 (Abduction)
 
** If objective is 6 (Terrorize), eMission = 7 (TerrorSite)
 
** If objective is 6 (Terrorize), eMission = 7 (TerrorSite)
 +
* If there's no last mission (for the month it calls function AddAIEvent(eMission, 0, byte(m_arrObjectives[iObjective].m_iCountryTarget), arrEvents)
 +
* Otherwise, it calls AddAIEvent (eMission, (m_arrObjectives[iObjective].m_iNextMissionTimer - m_iCounter) / 2, byte(m_arrObjectives[iObjective].m_iCountryTarget), arrEvents)
 +
* Function loops until all objectives have a mission added to the array of events
 +
 +
===InitNewGame===
 +
Used when a new game is started.
 +
 +
* Defines the start date based on the value located on XGDateTime as 00:00:00, January 1st, 2015
 +
* Sets the array arrUFOsShotDown with 10 entries
 +
* Sets the array TObjectives with 8 entries
 +
* Calls BuildObjectives function
 +
* m_kResistance.arrCountries.Add(36);
 +
* m_kResistance.arrNoResistance.Add(36);
 +
* m_kResistance.arrHunted.Add(36);
 +
* LogResistance(HQ().m_arrSatellites[0].iCountry);
 +
* CreateAlienBase - sets location of Alien Base
 +
* Defines TerrorCounter as 2
 +
* If ISCONTROLLED() is negative (no Tutorial active) calls function AIAddNewObjectives
 +
 +
===MakeMonthlyPlan===
 +
Calls functions EndOfMonth and AIAddNewObjectives
 +
 +
===Update===
 +
Calls funcions AIUpdateMission and UpdateObjectives
 +
 +
===UpdateObjectives===
 +
Function defines iNumUnits = 1 and bPaydayUpdate = false
 +
*If each objective (kObjective) on the array arrObjectives hasn't been completed, it calls function Update
 +
*If the array FirstBlitzTargets > 0 (is full)
 +
** FirstBlitzCounter is reduced by 1
 +
** If FirstBlitzCounter <= 0 then LaunchBlitz and remove entry from array FirstBlitzTargets
 +
*Calls World, FundingCouncil.UpdateSlingshotMission
 +
* If the counter HQAssaultCounter > 0, it is reduced by 1
 +
* if((m_iHQAssaultCounter < 2) && iNumUnits > 1) then m_iHQAssaultCounter = 2
 +
* If the HQAssaultCounter is 0, and the Geoscape conditions isBusy and GetFinalMission are none, then AIAddNewMission(7, none)
 +
** Otherwise defines HQAssaultCounter = 1
 +
* If PaydayUpdate is false, then calls function EXALT().UpdateObjectives(iNumUnits) and adds 1 to the Counter
 +
 +
===CurrentlyHasObjective===
 +
For each kObjective on arrObjectives it sees if (GetType) is equal to the eObjective and if so, returns it as true. Otherwise returns false.
 +
  
 
[[Category: Game Files (EU2012)]]
 
[[Category: Game Files (EU2012)]]
 
[[Category: Enemy Unknown (2012)]]
 
[[Category: Enemy Unknown (2012)]]

Revision as of 22:49, 11 April 2014

XComStrategyGame.UPK is a Unreal Engine 3 file used to determine several functions of XCOM: Enemy Unknown related to the strategic layer of the game. XComStrategyGame.UPK is divided into several classes, each related to different aspects of the Geoscape/HQ view and described below.

A complete catalog of the file can be found here: Nexusmods wiki page on XComStrategyGame.UPK.

This page will focus on the practical aspects of the file and how they affect playing the game. For details on how to mod the game, you're advised to check the XCOM section at the Nexusmods wiki.

XGStrategyAI

XGStrategyAI contains most of the functions used to generate UFOs and missions, determine type and composition of alien squads, panic changes and so on. The class is further subdivided into Structures, Variables, Functions and and Default Values. The most important functions will be mentioned below.

AddAIEvent

AddAIEvent is used to add a game event (kEvent) to the array of events generated each month (THQEvent).

Each kEvent added to the array consists a mission, its target (country) and the number of hours it will be available:

  • eMission
  • eTarget
  • iHours

GetEvents

GetEvents generates the array of events for each month (<THQEvent> arrEvents) and uses AddAIEvent to fill it.

It checks for several conditions:

  • If iCouncilCounter > 0, it adds a Council mission to the array (11, m_iCouncilCounter / 2, 0)
  • If the all the entries on the array of objectives (arrObjectives) are marked as completed it does nothing, otherwise for each uncompleted objective it adds a mission (eMission):
    • If objective is 0 (Recon) it doesn't add a mission.
    • If objective is 1 (Scout) then eMission = 3 (Crash)
    • If objective is 3 (Flyby) and HQ doesn't have Facility 18 (Hyperwave Relay) then eMission = 0 (None), otherwise eMission = 12 (DLC)
    • If objective is 4 (Hunt), eMission = 5 (HQAssault)
    • If objective is 2 (Harvest), eMission = 4 (LandedUFO)
    • If objective is 5 (Abduct), eMission = 2 (Abduction)
    • If objective is 6 (Terrorize), eMission = 7 (TerrorSite)
  • If there's no last mission (for the month it calls function AddAIEvent(eMission, 0, byte(m_arrObjectives[iObjective].m_iCountryTarget), arrEvents)
  • Otherwise, it calls AddAIEvent (eMission, (m_arrObjectives[iObjective].m_iNextMissionTimer - m_iCounter) / 2, byte(m_arrObjectives[iObjective].m_iCountryTarget), arrEvents)
  • Function loops until all objectives have a mission added to the array of events

InitNewGame

Used when a new game is started.

  • Defines the start date based on the value located on XGDateTime as 00:00:00, January 1st, 2015
  • Sets the array arrUFOsShotDown with 10 entries
  • Sets the array TObjectives with 8 entries
  • Calls BuildObjectives function
  • m_kResistance.arrCountries.Add(36);
  • m_kResistance.arrNoResistance.Add(36);
  • m_kResistance.arrHunted.Add(36);
  • LogResistance(HQ().m_arrSatellites[0].iCountry);
  • CreateAlienBase - sets location of Alien Base
  • Defines TerrorCounter as 2
  • If ISCONTROLLED() is negative (no Tutorial active) calls function AIAddNewObjectives

MakeMonthlyPlan

Calls functions EndOfMonth and AIAddNewObjectives

Update

Calls funcions AIUpdateMission and UpdateObjectives

UpdateObjectives

Function defines iNumUnits = 1 and bPaydayUpdate = false

  • If each objective (kObjective) on the array arrObjectives hasn't been completed, it calls function Update
  • If the array FirstBlitzTargets > 0 (is full)
    • FirstBlitzCounter is reduced by 1
    • If FirstBlitzCounter <= 0 then LaunchBlitz and remove entry from array FirstBlitzTargets
  • Calls World, FundingCouncil.UpdateSlingshotMission
  • If the counter HQAssaultCounter > 0, it is reduced by 1
  • if((m_iHQAssaultCounter < 2) && iNumUnits > 1) then m_iHQAssaultCounter = 2
  • If the HQAssaultCounter is 0, and the Geoscape conditions isBusy and GetFinalMission are none, then AIAddNewMission(7, none)
    • Otherwise defines HQAssaultCounter = 1
  • If PaydayUpdate is false, then calls function EXALT().UpdateObjectives(iNumUnits) and adds 1 to the Counter

CurrentlyHasObjective

For each kObjective on arrObjectives it sees if (GetType) is equal to the eObjective and if so, returns it as true. Otherwise returns false.