GEOSCAPE.EXE

From UFOpaedia
Jump to: navigation, search

The "Geoscape" program that handles base management and aircraft, a.k.a. XCOM outside of tactical combat. TACTICAL.EXE handles combat.

NOTE: In the WinCE version, GEOSCAPE and TACTICAL are one executable, "UFO Defense.exe". Due to this confusion (what wiki pages place things on, when they're practically identical), currently GEOSCAPE, TACTICAL, and UFO Defense information appear here. (Unless and until someone wants to break everything up... then again, having highly related stuff in one place is a good thing.)

Also see Versions.


XCOM: UFO Defense (U.S. DOS) version 1.4

  • Is 382,957 bytes long for the virgin 1.4 executable
  • Has alien statistics starting at (non-offset) byte 379,729. There are 33 records of 39 bytes each. No alien names, though.
  • If you have installed XcomUtil, it may alter the length of GEOSCAPE. Does anybody have a modified version, so we can put the length here? --MikeTheRed
    • My XCOM Util GEOSCAPE size is 415,271 --Pi Masta
    • My XCOM Util GEOSCAPE size is still 382,957, Pi Masta I think is using 1.2, because that is the size of that file normally --hatfarm
    • XcomUtil Does not alter the length of the EXE's only data sections of the code are overwrite (Only splitting the exe adds code but uses padding in the EXE. --BladeFireLight 01:16, 5 January 2010 (EST)


XCOM Windows Collector's Edition

  • Variously called the Win CE or Gold version on the wiki
  • Is 495,616 bytes long
  • Starting at byte 648, reads:
XCOM: UFO Defense Gold Edition
This awesome game was compiled on Sep  8 1999 at 08:57:11
Copyright - 1999 Hasbro Interactive/MicroProse Software
Party on dude.
  • If you install XcomUtil, it separates your UFO Defense.exe into GEOSCAPE and TACTICAL executables. They are almost identical copies of UFO Defense.exe, however they start at the right place when run. This allows the game to closely mimick the Dos version by having its main loop run in a batch file.
  • Has alien statistics starting at (non-offset) byte 480,145 (75391x). There are 33 records of 39 bytes each. No alien names, though.
  • Has tank & inbuilt alien weapon stats at byte 447,868 (6D57Cx, see below).
  • Has the copy protection codes written in the manual starting at byte 475,176 (74028x) (despite the fact that the game stopped asking for these prior to the Windows port!).

File Templates

There appears to be 'templates' of some of the game files stored within this executable. Makes sense as initially no saved game files are present when installed. Here is a list of known positions and the corresponding file. Offsets are from DOS Version of the game patched with XComUtil

Offset (Hex) Offset (Dec) Length (Bytes) File
5AB28 371496 2112 RESEARCH.DAT
5B5E0 374240 272 FACIL.DAT
5B6F0 374512 1820 PURCHASE.DAT
5D894 383124 576 DIPLOM.DAT
5E48C 386188 1392 UP.DAT
5EB90 387984 84 ACTS.DAT
5FAC0 391872 2336 BASE.DAT
5FBB8 392120 5200 CRAFT.DAT

Possibly these are in-game data structures used to hold the current in-memory state, between game saves?

Craft type data

At offset 353,014 in X-COM 1.4 (DOS), the aircraft statistics begin. In WinCE this starts at hex offset 0x6F9A8 and Alien craft start at 0x6fa34.

.data:0046F9A8                                         
   00     02  04    06  08    0A    0C  0E              18  1A  
 <23Ah, -200,  0,  760,  2, 1500,  150,  4, 0, 0, 0, 0, 0E, 03, 0>   ; 0 Skyranger
 <23Bh, -300,  1, 3100,  8,   30,  800,  4, 0, 0, 0, 0, 0C, 00, 0>   ; 1 Lightning
 <23Ch, -400,  2, 5400, Ah,   60, 1200,  4, 0, 0, 0, 0, 1A, 04, 0>   ; 2 Avenger
 <23Dh, -250,  2, 2100,  3, 1000,  100,  4, 0, 0, 0, 0,  0, 00, 0>   ; 3 Interceptor
 <23Eh, -250,  2, 4200,  9,   20,  500,  4, 0, 0, 0, 0,  0, 00, 0>   ; 4 Firestorm

.data:0046FA34   
   00     02  04    06  08  0A    0C  0E  10     12   14   16
 <2B2h,  100,  2, 2200, Ch,  0,   50,  5, 38h,  C8h,    0,  0, 0, 0, 0> ;  5 Small Scout (VS)
 <2B3h,  150,  2, 2400,  9,  0,  200,  4, 38h,  FAh,  78h, 14, 0, 0, 0> ;  6 Medium Scout (S)
 <2B4h,  250,  2, 2700,  9,  0,  250,  4, 30h, 12Ch, 110h, 14, 0, 0, 0> ;  7 Large Scout (S)
 <2B5h,  500,  2, 4000,  8,  0,  500,  3, 30h, 1F4h,  B0h, 28, 0, 0, 0> ;  8 Abductor (M)
 <2B6h,  500,  2, 4300,  8,  0,  500,  3, 20h, 1F4h,  A0h, 28, 0, 0, 0> ;  9 Harvester (M)
 <2B7h, 1000,  2, 4800,  6,  0, 1200,  2, 18h, 7D0h, 150h, 78, 0, 0, 0> ; 10 Terror Ship (L)
 <2B8h, 1400,  2, 5000,  6,  0, 3000,  1, 18h, FA0h, 208h, 8C, 0, 0, 0> ; 11 Battleship (VL)
 <2B9h,  800,  2, 3200,  6,  0, 2200,  2, 18h, BB8h, 120h, 3C, 0, 0, 0> ; 12 Supply Ship (L)

      known fields (14 x 2-byte dwords per record)
00   nameIdx           reference to the ENGLISH.DAT entry
02   score Destroyed   ; base 10
04   weapon Pods       Xcraft only
06   max Speed         in knots   ; base 10
08   acceleration 
0A   fuel Capacity     ; base 10
0C   damage Capacity   ; base 10
0E   ufo Size          5 - Very Small / 4 - Small (inc. XCom) / 3 - Medium / 2 - Large / 1 - Very Large -spike
10   ufo Reload time   Firing interval (rand(x-(diff*2))+(x-(diff*2)). 
                            Values: 56=S/MSct 48=LSct/Abd 32=Harv 24=Suppl/Terr/BS.
12   ufo Escape Time   100~200% = time before UFO attempts escape (on Beginner). 
                          Values: SS=200 MS=250 LS=300 A=500 H=500 TS=2000 BS=4000 SS=3000
14   weapon range      distance in km*8
16   weapon damage     (0%-100%)
18   Troop Space       Troop capacity (Xcraft only)
1A   HWP Space         HWP capacity (Xcraft only)
1C   structCraftData ends

Here is the hex signature of all craft:

3A 02 38 FF 00 00 F8 02 02 00 DC 05 96 00 04 00 00 00 00 00 00 00 00 00 0E 00 03 00 
3B 02 D4 FE 01 00 1C 0C 08 00 1E 00 20 03 04 00 00 00 00 00 00 00 00 00 0C 00 00 00 
3C 02 70 FE 02 00 18 15 0A 00 3C 00 B0 04 04 00 00 00 00 00 00 00 00 00 1A 00 04 00 
3D 02 06 FF 02 00 34 08 03 00 E8 03 64 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 
3E 02 06 FF 02 00 68 10 09 00 14 00 F4 01 04 00 00 00 00 00 00 00 00 00 00 00 00 00 
B2 02 64 00 02 00 98 08 0C 00 00 00 32 00 05 00 38 00 C8 00 00 00 00 00 00 00 00 00 
B3 02 96 00 02 00 60 09 09 00 00 00 C8 00 04 00 38 00 FA 00 78 00 14 00 00 00 00 00 
B4 02 FA 00 02 00 8C 0A 09 00 00 00 FA 00 04 00 30 00 2C 01 10 01 14 00 00 00 00 00 
B5 02 F4 01 02 00 A0 0F 08 00 00 00 F4 01 03 00 30 00 F4 01 B0 00 28 00 00 00 00 00 
B6 02 F4 01 02 00 CC 10 08 00 00 00 F4 01 03 00 20 00 F4 01 A0 00 28 00 00 00 00 00 
B7 02 E8 03 02 00 C0 12 06 00 00 00 B0 04 02 00 18 00 D0 07 50 01 78 00 00 00 00 00 
B8 02 78 05 02 00 88 13 06 00 00 00 B8 0B 01 00 18 00 A0 0F 08 02 8C 00 00 00 00 00 
B9 02 20 03 02 00 80 0C 06 00 00 00 98 08 02 00 18 00 B8 0B 20 01 3C 00 00 00 00 00

X-COM craft weapon data

                00    02   04   06  08   0A   0C   0E  10                                Fire Intevals
.data:0046FB18 <240h, 1Eh, 46h, 46h,  1, 0Fh,   6,   1, 6 >; stingray      .data:00473FB8  64, 48, 32  stingray
.data:0046FB2A <241h, 3Ch, 50h, 64h,  3, 14h,   3,   1, 7 >; avalanche                     96, 72, 48  avalanche
.data:0046FB3C <242h, 0Ah, 19h, 0Ah,  8,   2, C8h, 64h, 8 >; cannon                         4,  4,  4  cannon
.data:0046FB4E <243h, 41h, 64h, E6h,  5, 19h,   2,   1, 9 >; fusion ball                   64, 48, 32  fusion ball
.data:0046FB60 <244h, 15h, 23h, 46h, 0A,   4,  *0,*32h, 0 >; laser cannon                  24, 24, 24  laser cannon
.data:0046FB72 <245h, 34h, 32h, 140, 0C,   6,  *0,*32h, 0 >; plasma beam                   24, 24, 24  plasma beam

00 Weapon_NameIdx 
02 Range         
04 CraftWepAccuracy  chances=random(100)< Accuracy * (1+3/(5-ufosize))/2 => Accuracy * (0.8|0.875|1|1.25|2)
06 CraftWepDamage    damage=(WeaponDamage+random(WeaponDamage))/2 [50-100%]
08 Weapon ID         not used: bit0 = 1->weapon is missile. bit3 = 1-> weapon is direct fire.
0A Reload time       Value given for in-game ufopaedia fire rate. See table for correct fire rate
0C ammunition max 
0E Base rearm rate   Amount added to the weapons ammo value in CRAFT.DAT every hour.
10 Ammo_Ref          reference to the proper entry in BASE.DAT to check for ammo. (0 = ray)

* The code which rearms aircraft ignores these settings and always gives 100 units of ammo to beam weapons.
-- Fire intervals for different attack modes of craft weapon --
  
Attack modes in order: Cautious / Standard / Aggressive

Hex signature of all weapons:
40 02 1E 00 46 00 46 00 01 00 0F 00 06 00 01 00 06 00 
41 02 3C 00 50 00 64 00 03 00 14 00 03 00 01 00 07 00 
42 02 0A 00 19 00 0A 00 08 00 02 00 C8 00 64 00 08 00 
43 02 41 00 64 00 E6 00 05 00 19 00 02 00 01 00 09 00 
44 02 15 00 23 00 46 00 0A 00 04 00 00 00 32 00 00 00 
45 02 34 00 32 00 8C 00 0C 00 06 00 00 00 32 00 00 00 


TFTD Alien Sub Stats

Here is a hex signature to help find the first alien sub record (Survey Ship):

b2 02 64 00 02 00 d0 07 0c 00 00 00 3c 00

In the Steam release of TFTD (a DOS version, modified by XcomUtil) this starts at offset 419072 decimal, 0x66500, in GEOSCAPE.EXE

TFTD appears to have the same 14 x 2-byte record structure, and the same or similar meaning, based on comparing a few records to the table in Alien Submarines.

HWP Stats

At offset 380,668 the Tank Statistics begin.

Armor Stats

At offset 369,898 in the DOS version; the personal armor statistics begin.

The Statistics are in two byte format and go in the following order:

Front Armor
Left Armor
Right Armor
Rear Armor
Under Armor

To help you find it in UGE, here are the various armor stats in UGE format:

Unarmored X-COM Personnel: 12 - 0 - 8 - 0 - 8 - 0 - 5 - 0 - 2 - 0
Personal Armor: 50 - 0 - 40 - 0 - 40 - 0 - 30- 0 - 30 - 0

So on, etc.

Alien Stats

This section is for the structure of the alien stats, as found in GEOSCAPE. For actual data and additional information, see the alien statistics page. Also see Zombie's excellent alien stats page at StrategyCore.

Alien stats are found as 33 records of 39 bytes each, in all versions of X-COM. They are identical in all versions. This data actually represents the "core" alien stats; modifiers are used to determine the final stats relative to game difficulty level. (In most, but not all, cases, the core stats are the same as the Beginner level stats.)

Alien stats start in each version of X-COM at the following location. This is a byte count, not an offset; with counts, the first byte in the file is byte 1:

Version        Location
DOS 1.4         379,729  (GEOSCAPE.EXE)  
WinCE Gold      480,145  (UFO Defense.exe)
Playstation     501,212
TFTD            486,930

Alien names are not actually found in Geoscape; it just has 33 strings of data... the alien each string applies to has been inferred by matching against aliens in the game.

The 39 bytes correspond to the following values. For the below, statements also apply to TFTD, since it's relevant to understanding the bytes:

0: Race - Corresponds to Unitref[000]

1: Rank - Corresponds to Unitref[042]

2: Unknown - Always 0 - Corresponds to Unitref[011]

3: Can Fly - No Corresponding Unitref offset

4: TUs - Corresponds to Unitref[025]

5: Health - Corresponds to Unitref[026]

6: Energy - Corresponds to Unitref[027]

7: Reactions - Corresponds to Unitref[028]

8: Strength - Corresponds to Unitref[017]

9: Firing Accuracy - Corresponds to Unitref[023]

10: Throwing Accuracy - Corresponds to Unitref[024]

11: Melee Accuracy - Corresponds to Unitref[056]

12: Front Armor - Corresponds to Unitref[029]

13: Left Armor - Corresponds to Unitref[030]

14: Right Armor - Corresponds to Unitref[031]

15: Rear Armor - Corresponds to Unitref[032]

16: Under Armor - Corresponds to Unitref[033]

17: Unknown - Always 0 - Corresponds to Unitref[034]

18: Energy Recharge - Corresponds to Unitref[035]

19: Unknown - Always 0 - Corresponds to Unitref[036]

20: Unknown - Always 1 No Corresponding Unitref offset

21: Unknown - Always 0 - Corresponds to Unitref[046]

22: Unknown - Corresponds to Unitref[048] (see below)

23: Unknown - Corresponds to Unitref[052] (see below)

NOTE: For additional important info on the last two bytes, see Talk:UNITREF.DAT. My notes below do not take that info into account. For the moment though I'm leaving it as is. I sure wish we could figure the bytes out, and get rid of all the conjecture! - MikeTheRed 08:05, 6 November 2006 (PST)

These Unitref bytes ([48] and [52]) and now Geoscape Core values have long stumped us hardcore X-Commies. The two bytes always equal the same value for a given alien, including all aliens of the same race (the N's below). And, they're the same between Geoscape and Unitref. Clearly it must be important (or a goof!), but exactly what it is, who knows. Although this page is for X-COM, I've included TFTD in the hopes it helps folks - but it's been so long since I've played TFTD, I can't remember those units at all.

How's this for a thought?...

Dimension   Byte(s)

       X     22

       Y     23

       Z     24  (top when standing)
             25  (top when kneeling)
             26  (bottom)

Maybe they represent the "size in profile" ("width"), affecting likelihood to hit. A game could be tried with a target 20 squares away, set 22 and 23 alternately to 5 or 2 (or 1 or 0?), and see if it affects the successful shots percentage. 0 or even 1 might break the game, though.

Also, how do these values (2 to 5) correlate with the "pixel drawings" of units? I can't seem to find that info at the moment... aren't units and tiles defined as something like 16x16x28? If so, then perhaps the values (2 to 5) are multiplied by 3 or something to get their final "width" for bullet interception?? --MikeTheRed 05:20, 17 September 2006 (PDT)

I finally got the OSG (w00t!), and noticed the following: The section on weapon accuracy says (p. 221) that target size affects the chance to hit, and "the 'size' of each alien is listed along with all other alien statistics in Chapter 9". But the alien stats tables (p. 250 ff.) only lists Height as a possible 'size' stat, and the text write-ups don't otherwise address "target size" with any precision. This discrepancy - that Chapter 8 talks about size, but Chapter 9 only has height - might (might!) mean there are more variables that determine target area size, but somehow they didn't make it to the alien stats tables.
The description for Height (p. 249) does say, "Taller creatures are easier to hit than short ones are. An alien with a height of 40, for example, is twice as easy to hit as an alien with a height of 20." (Note: The tallest Height is actually 23. And also notice, Float is never mentioned.) This might mean only height affects this, or it could be read in a general way; other dimensions (X and Y in addition to Z) might also affect it.
Somebody should do some firing accuracy tests while hacking these potential X & Y bytes! But I still don't know how the values for [22] & [23] compare to what X-COM considers tile width... we know the Height byte accurately reflects the full range of possible values (0 to 23), but I doubt 5 is the full (pixel?) width of a tile. This might mean it's not width, then (or maybe [22] & [23] are added, or they are individually multiplied by 3 or something??) If anyone who knows about tile width could say something, I'd appreciate it. --MikeTheRed 11:24, 1 October 2006 (PDT)

In any event, here's a summary of bytes [22] and [23], in the hopes we can figure it out. They're always identical for a given race, and [22] always equals [23].

                 X-COM                            TFTD

         Value   Alien           N        Value   Alien           N

           2     Sectoid         6          2     Aquatoid        6   
                                                  Bio-Drone       1 
           3     Celatid         1                Tentaculat      1   
                 Chryssalid      1
                 Civilian        2          3     Calcinite       1   
                 Ethereal        3                Civilian        2   
                 Floater         6                Deep_One        1   
                 Muton           3                Gill_Man        4   
                 Snakeman        5                Tasoth          2   

           4     Cyberdisc       1          4     Coelacant       1   
                 Hovertank       1                Displacer       1   
                 Reaper          1                Hallucinoid     1   
                 Sectopod        1                Lobster_Man     5   
                 Tank            1                Triscene        1   
                                                  Xarquid         1 
           5     Silacoid        1  

24: Standing Height - Corresponds to Unitref[049]

25: Kneeling Height - Corresponds to Unitref[050]

26: Floating Height - Corresponds to Unitref[051]

27: Damage Modifier Category - Corresponds to Unitref[055]

This field is simply a look-up table, or more directly, a way to categorize the units into similar groups. The actual modifiers are listed elsewhere in the executable. A value of 1 indicates the second DM category, a value of 4 indicates the 5th, etc. The values of 2 and 3 are not seen in the alien stats as they refer to X-COM soldier armor info. I'm not sure about 13 as the Zombie's stats haven't been found yet, but there is a category in the DM's for it.

Category    Unit Type(s)
    0      Not for units, but is used for Terrain and Items
    1      Civilian, Sectoid, Celatid, Floater
    2      Personal Armor
    3      Power Suit, Flying Suit
    4      Tanks, Hovertanks
    5      Snakemen
    6      Ethereal
    7      Muton
    8      Silacoid
    9      Chryssalid
   10      Reaper
   11      Sectopod
   12      Cyberdisc
   13      Zombie

28: Psi Skill - Corresponds to Unitref[037]

29: Psi Strength - Corresponds to Unitref[057]

30: Bravery (encoded) - Corresponds to Unitref[059]

31: Motion scanner size - Corresponds to Unitref[061]

32: 1 for Cyberdisc, 0 for all others including TFTD... isn't "Explodes"; the TFTD Bio-Drone also explodes... - Corresponds to Unitref[071]

I edited the Cyberdisc's field to 0 and checked to see if it exploded. It still did. Obviously this field is for something else. I'll work on this some more. --Zombie 20:15, 15 September 2006 (PDT)

I have a theory. I vaguely remember something about Cyberdiscs cannot be stunned. Even if you poke it with a Stun Rod and bypass it's self-destruct, it still counts as a kill. Maybe this has something to do with it (as I also remember that none of the other aliens exhibit this behavior)?--amitakartok 12:55, 23 June 2009 (EDT)
Good thinking. But the Stun page shows that Cyberdiscs can be stunned. Checking Unitref.Dat byte 71 (hex 0x47) shows that, after Zombie posted his statement, there's been a lot of on its Talk page about this byte. -MikeTheRed 20:07, 2 July 2009 (EDT)

33: Unknown - Always 0 No Corresponding Unitref offset

34: Corpse type - Corresponds to Unitref[038]

35: Big unit (2x2) No Corresponding Unitref offset

36: Victory point score - Corresponds to Unitref[039]

37: Aggression - Corresponds to Unitref[044]

38: Intelligence - Corresponds to Unitref[073]

This data was just put together working heavily with Zombie and his great SC alien stats page.

Country Labels

Starting at offset 396480 (hex: 0x60CC0) are the records that contain the location of the labels for the country names on the world. In order they are X, Y, and English.dat index all signed short integers (6 bytes for each record). X should never be negative but between 0 and 2880, Y should be between -720 and 720 (See WORLD.DAT). The English.dat file, despite all other array indexes appears to start at 1 and not 0, thus a value of 611 in here represents index 610 in a zero based English.dat array. (It stands to reason that these work for the other language files as well)

Detection Ranges

Detection ranges are hard coded into the executable at the following locations (Win CE / Gold edition):

Platform Address Data bytes Hex Range nm
Aircraft 591EA C8 00 x00C8 200 600
Hyperwave 59237 20 03 x0328 800 2400
Lg Radar 5926D EE 02 x02EE 750 2250
Sm Radar 59278 F4 01 x01F4 500 1500


Patching "88 13" to these locations = x1388 = 5000 range units = 15,000 nm pretty much gives that platform visibility over the whole world. Of course Small Radar still only has a 10% detection chance per half hour.

Battlescape Terrain List

In the UFO CE executable, offset 476156 (743FCx) marks the beginning of the WORLD.DAT terrain to battlescape terrain conversion list. 13 double byte values.

02 00 01 00 01 00 01 00 01 00 07 00 02 00 06 00 06 00 08 00 00 00 02 00 08 00

For example, a mission initiated in a GeoScape polygon of type 5 will be performed in battlescape terrain type 7 (mountains).

Note that jungle (type 00) missions in the north will end up as forest missions, and forest (type 02) missions in the south will end up as jungle missions. See offset 10 in GEODATA.DAT for the full battlescape terrain list.


Manufacturing stats

The original data for the product manufacturing information in PRODUCT.DAT is contained in the geoscape executable, at offset 355600 (for plain 1.4 version).

And at 459720 in Steam's UFO Defense.exe. Off the Rails 17:49, 2 February 2011 (EST)

XCOM: UFO Defense DOS Versions, difficulty setting bug

In the DOS versions of the game there was a problem when saving the IGLOB.DAT file, that would cut off the last four bytes. When the saved game was loaded or at the end of a mission, the game would then be set to beginner, never to return again. There is a single byte that can be adjusted to fix this problem, you change the value from 60 (0x3C) to 64 (0x40). Below are the offsets so you can fix them in your game.

Offset
dec (hex)
Game
Version
97228 (0x17BCC)DOS Version 1.0
101068 (0x18ACC)DOS Version 1.2
101068 (0x18ACC)DOS Version 1.3
95676 (0x175BC)DOS Version 1.4


You can read more about the bug at the known bugs area.

See Also