Maps - XCOM:EU 2012

From Nexus Mods Wiki
Jump to: navigation, search


Overview

Derived from the Nexus XCOM Mod Talk Forum thread R&D XCOM Map Alterations. The URB_Bar.upk was used as the subject for early investigations.

Maps are contained in UPK files, though in Unreal terminology they are "levels". Each file includes all the map's related assets, including art and actionscripts. Each map doesn't appear to contain ALL of the various map art assets used by ALL maps, however. The URB_Bar.upk for example did not contain any trees -- there aren't any trees in this map.

Programs and Tools

All tools mentioned are described and linked in the wiki article:

Details

It is possible to open the decompressed map file in UE Explorer, but there didn't appear to be any decompilable code for UE Explorer to work with. Even decompressed, the XCOM maps/levels are 'cooked'. Cooking an unreal package optimizes it for a particular hardware architecture (e.g. PC vs PS3 vs XBOX 360 vs Mac). Consoles can only run cooked unreal files, while PCs can run a mixture of both cooked and uncooked. Cooking for the PC does however improve performance, so all of the XCOM released files for PC are cooked. Now, by explicit design the Unreal level editor cannot edit cooked level files. Apparently it would make cheating on an Unreal-based multiplayer 3D shooter pretty easy, so that's just something that has to be lived with. In theory a cooked level can be opened in the Unreal SDK, but cannot be saved. This is primarily because the Unreal SDK compiler needs access to the developer's art asset library, which is proprietary and not publicly available.

Finally, it is possible to use the Unreal Engine Extractor to break apart the decompressed map file, and examine them in the umodel Unreal model viewer program. However, at present there is no way to repackage the UPK from the extracted components or to add new components. Only existing assets already in the map can be used.

Map files are not easy to analyze, as they have very unfriendly object names. Developers probably set the whole system up by dragging the mouse, selecting an area, and assigning an event to this area. So most of the events and variables have auto-assigned numeric names, which tell nothing and require a deeper investigation.

Extracted Components

One early interesting find is the GameData_Toughness folder. This was created by the UE Extractor. For URB_Bar.upk it lists the following materials. Looking though the files with a hex editor like HxD they appear to have the toughness as defined:

  • Wood (Destructible Actor 0x16) : toughness 0x28 = 40
  • Trucks (Destructible Actor 0x15) : toughness 0x1F4 = 500
  • Metal (Destructible Actor 0x0E) : toughness 0x5A = 90
  • Small Car (Destructible Actor 0x12) : toughness 0x1F4 = 500
  • Plastic (Destructible Actor 0x0F) : toughness 0x32 = 50
  • Masonry (Destructible Actor 0x0C) : toughness 0x50 = 80
  • Glass (Destructible Actor 0x09) : toughness 0x0A = 10
  • Foliage (Destructible Actor 0x08) : toughness 0x14 = 20
  • Deco (Destructible Actor 0x06) : toughness 0x0A = 10
  • Cloth (Destructible Actor 0x04) : toughness 0x14 = 20

Presumable there are more destructible actor types (like trees and UFO walls), but these are the only actors in the URB_Bar.upk. Presumably these could be modded. If nothing else they provide a guide in how to set/mod the environmental damage stats of various weapons (in particular cars and trucks have toughness 500 which explains why a rocket with 500 environmental damage destroys them, but that it takes 2 grenades each with 250 environmental damage to make them explode).

The primary "class" (or maybe it's more correct to call it an "object") that provides the high level information is labeled "TheWorld".

After extraction it contained a "PersistentLevel.Level" file that is 320 KB. It also had a folder "PersistentLevel" that contains a wealth of different parts.

  • 18 spawnpoint files of the format: XComSpawnPoint_##.XComSpawnPoint. The spawn points appear to be defined in the UnrealScript unit (96 per tile).
  • A couple hundred XComLevelActor files
  • 7 XComInteractiveLevelActor files (presumably the doors in URB_Bar.upk)
  • Several hundred XComDestructibleActor files
  • 18 XComFloorVolume files
  • 43 XComFracLevelActor files
  • 5 AmbientSoundSimple files

Other file types include:

  • VisGroupActor
  • StaticMeshActor
  • SpotLight
  • PreFabInstance
  • PointLight
  • PointInSpace
  • GeneratedMeshAreaLight
  • Emitter
  • DecalActor

Needless to say these maps look to be pretty complex constructions, which might explain why map randomization was rejected and why the new expansion 'Enemy Within' (aka EW) has a fairly limited number of maps.

When looking through the URB_Bar.upk, the cargo van's weren't defined as a single unit but as the cab, base, side and roof. Apparently this is what allows the player to move units up in to the area exposed if the sides/back are destroyed. However, there are two cargo vans in the Bar map, but only one prototype mesh appears to be defined in the UPK. So, somewhere the two copies of the van parts must be getting created, and with separate locations. (See the #Map Streaming sub-topic for a possible explanation.)

If that can be figured out then at least each map could be re-arranged, although there would be definite limitations based on which art assets were included with each of the already-published maps. Wouldn't be surprised if some of the maps had a few assets still stored that didn't make it into the displayed map.

DefaultMaps.INI

All of the available maps are configured in the DefaultMaps.ini file. This is not stored in the XComGame.EXE Resource Cache, but appears to be read from the file. However, users with any DLC will have a merged version of the file (named XComMaps.ini) in the \My Games folder. This appears to still hold true for the EW expansion as well. As this merged file is automatically created from those for the Default game and DLC content, we will speak in terms of the DefaultMaps file only.

Of particular interest is that the Council special mission maps that include dynamic aliens (those aliens that drop in), have that dynamic alien defined in the DefaultMap.ini config file. For example:

Trainyard Bomb Disposal mission:

The defined dynamic alien is a Thin Man. This is true for all of the vanilla maps.

The only exception noted (so far) is in the Confounding Light DLC map, which has:

The defined dynamic alien is a Muton, which is consistent with how the map plays.

This dynamic alien appears to actually be used in the function XComMapManager.AddMapDynamicContent, which is one of the few functions which isn't a native function:

static simulated function AddMapDynamicContent(string MapDisplayName, out TPawnContent Content)
{
   local XComMapMetaData MapData;
   local int I;
   ;
   GetMapInfoFromDisplayName(MapDisplayName, MapData);
   // End:0x18C
   if(MapData.DynamicAliens[0] != 0)
   {
       I = 0;
       J0x50:
       // End:0x18C [Loop If]
       if(I < 2)
       {
           // End:0x17E
           if(MapData.DynamicAliens[I] != 0)
           {
               Content.arrAlienPawns.AddItem(class'XGGameData'.static.MapCharacterToPawn(MapData.DynamicAliens[I]));
               Content.arrAlienPawns.AddItem(class'XGGameData'.static.MapCharacterToPawn(class'XGBattleDesc'.static.GetSecondaryAlienForContentLoading(MapData.DynamicAliens[I])));
           }
           ++ I;
           // [Loop Continue]
           goto J0x50;
       }
   }
   //return;    
}

Unfortunately this function only appears to be used to load the pawn's mesh/animation content (failing to do this will cause the game to crash).

The alternative appears to be to structure the Council mission maps more. Instead of randomizing the Council missions, they could be set up on an "easiest" to "hardest" range. Easier maps would appear nearer the beginning of the game and harder maps nearer the end of the game. This would allow for configuring harder aliens directly in the DefaultMaps.ini file.

For example, there are five bomb mission maps (Big Cemetary, Highway Bridge, Slaughterhouse, Train Station, and Trainyard). These could be broken into an early/mid map, 2 mid/late maps, and 2 late maps. The early/mid map could use Thin Men (but would only be available from April to maybe May), the mid/late maps could use Mutons (and be available May through August), while the late maps would drop in Muton Elites.

You can duplicate a map just by copying the map entry in: \My Games\XCOM - Enemy Unknown\XComGame\Config\XComMaps.ini.

Give it a different name: "Name=URB_Trainyard2"

Then make a copy of the map's UPK file and rename it to the new name. You should then be able to just change the dynamic alien in XComMaps.ini for the map you just duplicated. This would allow for duplications of the council mission maps but with different dynamic aliens. (Just remember that XCom-prefix INI files get reconstructed every time the game is re-launched.)

The only further patch-up required would be in the Council mission map selection function XGFundingCouncil.BuildMission. This function defines the map name (e.g. kMission.strMapName = "URB_StreetOverpass_Assault (Mission Variant Assault on Overpass)";) based on EFCMission. A little extra logic to append something to the map name based on desired dynamic alien should work perfectly.

In fact it might be possible to make multiple Maps= entries that reference the same map UPK file but have different display names, which would definitely be more disc-space friendly.

Completely removing a line from the DefaultMap.ini file will prevent the map from loading. In testing, removed all abduction map config lines except for the URB_Bar map, and two consecutive abduction mission draws both pulled up the URB_Bar map. Following the same idea, commenting out a line (preceding it with ';') will also prevent the map from being used.

Spawn Points

See the wiki articles Spawn Points - XCOM:EU_2012 for a detailed discussion of Spawn Points and Units deployment - XCOM:EU 2012 for how the Wave System populates them.

Map Probability

Map probability depends on how many times you have encountered each map in all your previous game sessions. The map counters are maintained in your profile. There is a relatively easy way to reset them to zero: Enable the Developers Console and type: ResetMapCounts.

The DumpMapCounts function, if used after showlog (to enable the text log), makes it so you can review these counts outside of the game. This will display something similar to the following:

[0257.41] XComMapSelection: Dumping Map Counts
[0257.42] XComMapSelection: MissionType: eMission_Abduction (28 Old Missions, ( 1 available, 140.69 totalChance ), 10 New Missions ( 0 available,   0.00 totalChance ) )
[0257.42] XComMapSelection:     (19) 0x66c988e0 EWI_MeldTutorial
[0257.42] XComMapSelection:     (22) 0x0d63be36 URB_Bar
[0257.42] XComMapSelection:     (22) 0x3aca1fdc URB_Boulevard
[0257.42] XComMapSelection:     (22) 0xd1653354 URB_CemeteryGrand
[0257.42] XComMapSelection:     (18) 0x1055c77e URB_CommercialAlley
[0257.42] XComMapSelection:     (20) 0xbb7127c2 URB_CommercialAlley_EWI
...

(The list is abbreviated, as it is only an example.) The numbers in (parentheses) preceding each map name are the number of times that map has been seen by the player. Be sure to do so prior to resetting your map counters if you are interested in your map history.

There are also two settings for each map in DefaultMaps.ini that *seem* like they would affect map frequency:

  • InitialChance=20
  • InitialGain=1.04

Default values will make EW maps more probable again after resetting map counts. Seems it only affects first map appearance though. But, we can't tell for sure as map selection happens inside native functions (which are buried in the EXE).

Rotation and Map Family

There is 1 map, HighwayFallen, that appears listed both as a Terror Site and as a Council Mission (Extract General Van Doorn) but I've never ever played it on the regular game as a Terror Site over 1000 hours of gameplay. But it is playable as a Terror Site on the Developer's Skirmish mode.

Looking through my DefaultMaps.ini, I also see a few more configured terror site maps that I've never seen in rotation:

  • DisplayName="URB_Bar_Terror (Art Placement Complete Urban Bar Terror)",
  • DisplayName="URB_CommercialStreet_Terror (Art Placement Commercial Street Terror)",
  • DisplayName="URB_ConvenienceStore_Terror (Art Placement Convenience Store Terror)",
  • DisplayName="URB_StreetHurricane_Terror (Art Placement Complete Street Terror)",

Most of the abduction/terror map display names have notes indicating: Beta/Functionality Complete.

The HighwayFallen terror map has display name: DisplayName="URB_HighwayFallen (Beta Complete Highway Fallen)". So, I'm guessing that the Highway Fallen terror map was in beta testing at release, and so was not activated (and wasn't ever completed in EU, apparently). The other four possible terror maps only had the art assets placed and hadn't even been beta tested. The odd thing is that the bInRotation flag isn't being used in the config file to disable these maps -- not sure how they are prevented from being selected.

Guess if they'd had time to finish testing the Highway Fallen map, and to beta test/finish test the other four maps then there might be five more terror maps in rotation. Although it's also possible that some of the maps were scrapped due to balance reason (a terror mission on Street Hurricane sounds particularly nasty).

The UPKs for all of these maps were released (are in the CookedPCConsole folder). Offhand the only way I can think of enabling the maps would be to completely rewrite the native function GetRandomMapDisplayName in the UPK. The tricky part about this is that the map config data is in XComMapManager, which mostly consists of native functions, and the few non-native functions all appear to be needed.

Some other possibilities :

  • Perhaps the native code searches for keywords in the displayname (e.g. Beta/Functionality Complete) -- at least for abduction/terror
  • Most Terror maps have a special terror version appended with _terror, but HighwayFallen doesn't.
  • Perhaps the URB_HighwayFallen MapFamily is hard-coded to be disallowed for abduction/terror missions.

The Bar Terror, ConvenienceStore Terror, CommercialAlley Terror, and StreetHurricane Terror can appear in the game. They are rare to appear - took me hundreds of hours until I finally played the StreetHurricane Terror, for instance - but they can be played. The thing is that the game seems to memorize maps that already appeared and prioritize maps who haven't been used in a playthrough,. Since those maps have also Abduction versions and the usual 4 Terror maps don't have Abduction versions (Police Station, Highway1, MilitaryAmmo, and CommercialRestaurant), it is more likely that you'll run into the 4 last ones during Terror missions since the first are pretty common during Abductions.

Eventually managed to play those 4 maps after hundreds of hours and confirm that they are used for Terror missions but HighwayFallen has never appeared, even if it is present and playable on the Skirmish mode. There must be some other place on the game files where map selection is defined. Also, the DefaultMaps entries also have regional settings that don't seem to be used like:

  • ERegion=eMissionRegion_NorthAmerica
  • ERegion=eMissionRegion_Asia
  • ERegion=eMissionRegion_Europe

I've tried seeing if those maps where only used in missions on countries on those regions but they don't seem to work.

My first suspicion about why the combined abduction/terror maps don't show up that often is the MapFamily setting in the map config file. For the five maps that have both terror and abduction variants (URB_Bar, URB_CommercialAlley, URB_CommercialStreet, URB_ConvenienceStore, and URB_StreetHurricane), both the abduction and terror variants belong to the same MapFamily.

The four 'usual' terror maps have only the terror map in the MapFamily. This is real shame because it cuts down the likely terror mission maps from 9 to only 4. With the addition of the Fallen Highway map there could be 10 terror maps, effectively 2.5x the number people typically see.

Tested the bInRotation flag by setting bInRotation=false for every abduction mission except URB_Bar in a vanilla version of the game, but it appeared to have no effect. Rolled up 2 abduction missions, and neither of them was the URB_Bar map.

Still find it interesting that the council mission maps all have bInRotation=false. Maybe from a pre-release build?

Map Streaming

Unreal Developer Network info:

Some maps in XCOM have a very small size and very little info inside. That's because they're not actual maps, but packages which are streamed in when the actual map is loaded.

In DefaultMaps.ini there is an array property StreamingMaps. For most of the maps it contains a cinematic package link (CIN_DropshipIntros or CIN_FastropeIntros), but for some maps it contains another link. For example, for the Pier Covert Extraction map, the map name is "URB_PierA_Terror" (which is the actual map package) and StreamingMaps array contains two entries: CIN_DropshipIntros and URB_PierA_Terror_CovExt. First entry is a link to the deployment cinematic package and second is a link to the package with EXALT-related info only. It contains EXALT relays data, XComAlienPod data and WaveSystem data mostly. There is no PlayersStart info, so it must be taken from the original package "URB_PierA_Terror".

PierA is actually a widely used map. It has three "full" variants for abductions and terror:

  • URB_PierA,
  • URB_PierA_Asian,
  • URB_PierA_Terror;

And another three variants, which are used in special missions that stream in additional info:

  • URB_PierA with streamed URB_PierA_StreamB is used for "Assault on Pier",
  • URB_PierA' with streamed URB_PierA_Stream is used for "Pier Rescue",
  • URB_PierA_Terror with streamed URB_PierA_Terror_CovExt is used for "Covert Extraction".

(Now, I can't claim I understand Unreal Streaming, but it seems they use it for maps to load additional info and create special mission variants without a need to include duplicate full maps with just a few alterations.)

Dynamically Adding Enemy Reinforcements

LiQuiD911 of the Nexus XCOM Forums R&D XCOM Map Alterations thread has created an ini-configurable wave system (Default Wave System) that can spawn new enemy reinforcements on existing maps.

Basic installation instructions.

  • Get an advanced text editor like Notepad++.
  • You need understanding of how DefaultMaps.ini works.
  • Place the DefaultWaveSystem.ini file in your Config folder.
  • Place patch_override_wave_system.upk in your CookedPCConsole folder.
  • Choose the map to which you want to add alien reinforcements in DefaultMaps.
  • Append the map patch patch_override_wave_system.upk as a streaming map in the defaultmap entry, i.e.:

StreamingMaps[11]=( MapName="patch_override_wave_system", Loc=( X=0, Y=0, Z=0 ), Rot=( Pitch=0, Yaw=0, Roll=0 ) )

would do.
  • Open an example "source" file provided in the archive and change the MapDisplayName to the display name of the map you chose.
You can tweak the spawn point vectors of the aliens. Leaving Scalable=true will let the AI select the enemies to spawn.
  • Once you're finished you need to condense the entire file to a single line because the engine won't accept it otherwise. With NotePad++ you can do "Edit->Blank Operations->Remove unnecesary blank and EOL".
  • Copy the condensed single line and place it as an entry of DefaultWaveSystem.ini. I advise using this kind of "source" files because working with a singe line gets messy very quickly.

DefaultWaveSystem archive already contains the 2 examples.

It seems that the DisableEvent and OnGroupActivated functions are not working.


References

Referred to by this article:



That refer to this article: