Skip to content

Commit 693a5fe

Browse files
michaeldtimpeclaude
andcommitted
Cape Cod patch v1.0 — TftD Lobster Man balance patcher
Reversible, backup-first, verify-before-write patcher fixing the hidden undocumented Lobster Man damage resistances (Phase 1) plus optional armor/health and weakest-weapon-power tweaks. Patcher + docs only; ships no game files. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 parents  commit 693a5fe

5 files changed

Lines changed: 553 additions & 0 deletions

File tree

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Never commit copyrighted game files or backups/output of the patcher.
2+
*.EXE
3+
*.exe
4+
*.DAT
5+
*.dat
6+
*.bak
7+
*.capecod.bak
8+
*.zip
9+
tftd/
10+
GAME_*/
11+
__pycache__/
12+
*.pyc
13+
.DS_Store

CAPE_COD_PATCH.md

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
# The "Cape Cod" Patch — X-COM: Terror from the Deep
2+
3+
> *Cape Cod is where lobsters go to die.*
4+
5+
An unofficial, reversible balance micro-patch for the GOG/DOSBox release of
6+
**X-COM: Terror from the Deep** (1995). It edits the game's two DOS4GW
7+
executables and one data file **in place** (file sizes never change), so the
8+
game runs rebalanced through whatever launcher you already use. Every change is
9+
backed up and can be undone with a single command.
10+
11+
---
12+
13+
## The problems it fixes
14+
15+
1. **Damage variance was narrowed.** TftD rolls all damage at 50–150% of weapon
16+
power (the original *UFO Defense* rolled firearms 0–200%). This inflates the
17+
value of armor and means even the weakest alien weapon (power 80) deals a
18+
*guaranteed* 40 on its minimum roll — instantly killing a fresh 40-HP rookie.
19+
2. **Lobster Men are near-unkillable** — heavy armor plus 100+ health let them
20+
shrug off almost anything and reaction-fire with impunity.
21+
3. **Lobster Men have a hidden, undocumented damage discount** applied *before*
22+
armor. It is shown nowhere in the game, not even on an M.C. scan. A "Heavy
23+
Gauss" reading 75 power was secretly doing ~22 before armor against a Lobster.
24+
25+
---
26+
27+
## What the patch changes
28+
29+
The patch is **phased** so you apply only as much as you need. **Fixing the
30+
hidden resistances (Phase 1) alone is a 2×–5× increase in damage dealt to
31+
Lobsters and resolves most of the problem** — so it is the default, and the
32+
health/armor and weapon-power tweaks are opt-in.
33+
34+
### Phase 1 (default) — Hidden resistance normalization · `TACTICAL.EXE`
35+
36+
The Lobster Man's secret pre-armor damage multipliers, restored to a flat 100%:
37+
38+
| Damage type | Vanilla | Cape Cod |
39+
|--------------------|:-------:|:--------:|
40+
| Armor-Piercing (guns) | 20% | **100%** |
41+
| Incendiary | 30% | **100%** |
42+
| High Explosive | 30% | **100%** |
43+
| Gauss | 30% | **100%** |
44+
| Sonic | 50% | **100%** |
45+
| Stun | 110% | unchanged |
46+
| Melee | 200% | unchanged |
47+
| Electric | 0% | unchanged |
48+
49+
Natural weaknesses (Stun, Melee) and the Electric immunity are deliberately left
50+
alone — they don't make Lobsters tankier.
51+
52+
**Effect, before armor:**
53+
54+
| Weapon (power) | vs. Lobster, vanilla | vs. Lobster, patched |
55+
|-----------------------|:--------------------:|:--------------------:|
56+
| Gauss Rifle Clip (60) | ×0.30 → ~18 | ×1.00 → ~60 |
57+
| Heavy Gauss Clip (75) | ×0.30 → ~22 | ×1.00 → ~75 |
58+
| Sonic Clip (80) | ×0.50 → ~40 | ×1.00 → ~80 |
59+
| S. Cannon Clip (130) | ×0.50 → ~65 | ×1.00 → ~130 |
60+
61+
Your weapons now do what their stats say they do.
62+
63+
### Phase 2 (opt-in: `--with-armor-hp`) — Modest toughness trim · `GEOSCAPE.EXE`
64+
65+
Applied across all six Lobster Man ranks:
66+
67+
- **Front & side armor** trimmed (20 → 14; the toughest rank 22 → 16). Rear and
68+
under armor left as-is.
69+
- **Health** reduced by 20 per rank (e.g. 110 → 90, …, 135 → 115).
70+
71+
This is a secondary tuning knob. With Phase 1 already multiplying your damage,
72+
you may not need it at all — try Phase 1 first.
73+
74+
### Phase 3 (opt-in: `--with-weapon-power`) — Weakest-weapon power · `OBDATA.DAT`
75+
76+
- **Sonic Clip** (the ammo for the Sonic Pistol, the weakest alien sonic weapon)
77+
power **80 → 66**. Its minimum 50% roll drops from 40 to 33, so a glancing hit
78+
no longer auto-kills a 40-HP rookie.
79+
80+
> **Trade-off:** weapon stats in `OBDATA.DAT` apply to *everyone*, so a Sonic
81+
> Pistol the player later captures also reads power 66. This is an accepted cost
82+
> of fixing early-game lethality without touching the hardcoded damage formula.
83+
> (Per design choice, the 50–150% variance formula itself is **not** patched.)
84+
85+
---
86+
87+
## Usage
88+
89+
Run from the `cape-cod` folder (the one containing this file):
90+
91+
```bash
92+
python3 cape_cod_patch.py # Phase 1 only (recommended v1.0)
93+
python3 cape_cod_patch.py --with-armor-hp # Phase 1 + 2
94+
python3 cape_cod_patch.py --with-weapon-power # Phase 1 + 3
95+
python3 cape_cod_patch.py --full # all phases
96+
97+
python3 cape_cod_patch.py --dry-run # preview the diff, write nothing
98+
python3 cape_cod_patch.py --verify # report what's currently applied
99+
python3 cape_cod_patch.py --revert # restore originals from backup
100+
```
101+
102+
No dependencies — just Python 3.
103+
104+
### Safety
105+
106+
- **Backups:** on first write, each file is copied to `*.capecod.bak` (e.g.
107+
`TACTICAL.EXE.capecod.bak`). Backups are created once and never overwritten.
108+
- **Verify-before-write:** every edit is checked against a wide window of
109+
surrounding bytes. If they don't match (a different game build, a fan patch,
110+
offset drift), the patcher prints exactly what it expected vs. found and exits
111+
**without writing anything**.
112+
- **Idempotent:** re-running is safe — already-applied edits are detected and
113+
skipped.
114+
- **Reversible:** `--revert` restores the originals byte-for-byte (verified:
115+
post-revert checksums match the untouched files exactly).
116+
117+
---
118+
119+
## Verifying it works
120+
121+
The patcher self-verifies structurally after every run (re-reads each offset,
122+
confirms the new values, and confirms file sizes are unchanged).
123+
124+
For an in-game check, launch the game the way you normally do — the patched
125+
executables are already in place — start a tactical mission with Lobster Men,
126+
and confirm:
127+
128+
- **Phase 1:** Gauss / conventional fire now visibly wounds Lobsters instead of
129+
registering a string of near-zeros; a Lobster falls in a sensible number of
130+
solid hits.
131+
- **Phase 3 (if applied):** a fresh rookie can survive a glancing hit from the
132+
weakest alien Sonic weapon instead of dying to the minimum roll.
133+
134+
If after a mission or two Lobsters still feel oppressive, add `--with-armor-hp`.
135+
If early rookie deaths are still rough, add `--with-weapon-power`.
136+
137+
---
138+
139+
## Files
140+
141+
| File | Role | Touched by |
142+
|------|------|-----------|
143+
| `cape_cod_patch.py` | the patcher ||
144+
| `tftd/UFO2EXE/TACTICAL.EXE` | battlescape (damage math) | Phase 1 |
145+
| `tftd/UFOEXE/GEOSCAPE.EXE` | strategy layer (unit stats) | Phase 2 |
146+
| `tftd/GEODATA/OBDATA.DAT` | item/weapon stats | Phase 3 |
147+
| `*.capecod.bak` | automatic backups | created on first write |
148+
149+
## Technical notes (for the curious)
150+
151+
- Lobster resistances live in a damage-modifier table in `TACTICAL.EXE` at file
152+
offset `0x61478` (just past a `26` marker). It is row-major: each row is one
153+
damage type, 14 columns are unit types, and **Lobster Man is column 10**.
154+
- Lobster per-rank stats live in `GEOSCAPE.EXE` from `0x770dc` as six 39-byte
155+
records: armor (front/side/rear/under) at the start, **health at offset +31**.
156+
- `OBDATA.DAT` is 80 records × 54 bytes; **weapon power is at record-relative
157+
offset 22**. The Sonic Clip is record 39.

LICENSE

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
MIT License
2+
3+
Copyright (c) 2026 michaeldtimpe
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+
23+
---
24+
25+
NOTE: This license covers ONLY the patch script and documentation in this
26+
repository. It does NOT cover, and this repository does NOT distribute, any
27+
part of X-COM: Terror from the Deep. That game and its data/executable files
28+
are the property of their respective copyright holders (Take-Two / 2K). You
29+
must own a legal copy of the game to use this patch.

README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# The Cape Cod Patch — X-COM: Terror from the Deep
2+
3+
> *Cape Cod is where lobsters go to die.* 🦞
4+
5+
A small, reversible, **backup-first** balance patch for **X-COM: Terror from the
6+
Deep** (1995). It edits the game's own executables and data file *in place* (file
7+
sizes never change) to fix three long-standing imbalances — most importantly the
8+
**hidden, undocumented damage resistances** that make Lobster Men feel
9+
unkillable.
10+
11+
This repository contains **only the patcher and documentation**. It does **not**
12+
include or distribute any game files — the patcher edits a copy of the game that
13+
**you already own**. You need a legal copy of *Terror from the Deep* (e.g. the
14+
GOG/DOS release).
15+
16+
## What it fixes
17+
18+
1. **Hidden Lobster Man resistances** — secret pre-armor damage discounts (only
19+
20% from guns, 30% from Gauss/explosives, 50% from Sonic) that are shown
20+
*nowhere* in-game. Normalized to 100%.
21+
2. **Lobster toughness** — modest armor + health trim (opt-in).
22+
3. **Weak-hit lethality** — the weakest alien weapon's minimum roll could
23+
one-shot a 40-HP rookie; its power is nudged down (opt-in).
24+
25+
Full details, the resistance table, and the damage math are in
26+
[`CAPE_COD_PATCH.md`](CAPE_COD_PATCH.md).
27+
28+
## Install
29+
30+
1. Make sure you have **Python 3** (no other dependencies).
31+
2. Copy `cape_cod_patch.py` into your game install so that the script sits
32+
**next to the `tftd/` folder** that contains `UFO2EXE/`, `UFOEXE/`, and
33+
`GEODATA/`. (On the GOG release this is the main install directory.)
34+
- If your install lays the files out differently, edit the `TFTD_DIR` /
35+
`FILES` paths at the top of the script.
36+
37+
## Usage
38+
39+
```bash
40+
python3 cape_cod_patch.py # Phase 1 only (recommended)
41+
python3 cape_cod_patch.py --with-armor-hp # Phase 1 + armor/health trim
42+
python3 cape_cod_patch.py --with-weapon-power # Phase 1 + weakest weapon nerf
43+
python3 cape_cod_patch.py --full # everything
44+
45+
python3 cape_cod_patch.py --dry-run # preview the diff, write nothing
46+
python3 cape_cod_patch.py --verify # report what's applied
47+
python3 cape_cod_patch.py --revert # restore originals from backup
48+
```
49+
50+
**Start with Phase 1.** Normalizing the hidden resistances alone is a 2×–5×
51+
increase in damage dealt to Lobsters and fixes most of the problem; the other
52+
phases are optional tuning.
53+
54+
## Safety
55+
56+
- **Backups:** every touched file is copied to `*.capecod.bak` on first write
57+
(created once, never overwritten).
58+
- **Verify-before-write:** each edit is checked against a wide window of
59+
surrounding bytes. If they don't match (different build, fan patch, offset
60+
drift) the patcher prints what it expected vs. found and **writes nothing**.
61+
- **Reversible:** `--revert` restores the originals byte-for-byte.
62+
- **Idempotent:** re-running is safe.
63+
64+
## Disclaimer
65+
66+
Unofficial, fan-made, and not affiliated with or endorsed by Take-Two / 2K or
67+
the original developers. Use at your own risk. *X-COM: Terror from the Deep* and
68+
all related assets are the property of their respective copyright holders.

0 commit comments

Comments
 (0)