User Tools

Site Tools


apthreat:build_log

APThreat build log: TCE to The Dark Mod

Copied from the build log kept by the development agent in the TC3 project (revision 13, 2026-11-21). The original doc is the reference; this page is a snapshot.

Overview

APThreat (Advanced Persistent Threat, short name apthreat) is an experiment, not a released game: a single-player stealth-tactical prototype built on The Dark Mod 2.15 engine (TDM, an idTech4 / Doom 3 derivative), using content converted from TrueCombat:Elite 0.49b (TCE, an ET mod). Multiplayer was dropped on 2026-11-21.

As of this log: 14 maps converted, the TCE soldier is the player model, 42 TCE soldier NPCs, 5 firearms, a TCE-style HUD, and the first engine changes (HUD values, sprint stamina, prone, iron sights).

What Where (project files)
Engine patch + Linux build apthreat/engine/
Asset pk4s (characters, weapons, HUD, test maps) apthreat/assets/
14 converted maps (pk4 + .map, logs) tdm-port/maps/
Converter scripts tdm-port/converter/
Screenshots tdm-port/screenshots/
ET:Legacy + TCE reference run etlegacy-tce-baseline/

Nothing has been published anywhere public. Each step below says what was done, why, the commands or scripts used, and what broke.

Step 1: TCE reference run on ET:Legacy

TCE 0.49b was run on ET:Legacy 2.86.2 first, to have a working original to compare against.

  • TCE downloads came from tce.merlin1991.at (preferred; Wolffiles was very slow).
  • A headless client test script and two screenshots are in etlegacy-tce-baseline/ (headless-client-test.sh, tce-obj_village.png, etlegacy-oasis.png).
  • The obj_village shot is a spectator view, so it shows little of the HUD.

Step 2: engine choice and TDM build

The target engine went Quake3e, then plain dhewm3, then The Dark Mod 2.15. TDM was chosen because it is a maintained idTech4 engine with a full single-player stealth/AI game layer already working.

  • Source: GitHub mirror stgatilov/darkmod_src at commit c82dbf9 (SVN r11372). Local tree: /home/user/stgatilov/darkmod_src, built with CMake in build/.
  • ThirdParty libraries came from svn.thedarkmod.com/publicsvn.
  • Game data came from the official tdm_installer, locally patched to use https only, with the CA bundle from the environment.
  • Install folder: /opt/tdm. Each content set is a TDM “FM” (mission folder): fms/tce for the maps and menus, fms/tcedev for characters, weapons, HUD and test maps.

Step 3: map conversion (14 maps)

All 14 maps convert and compile with no leaks. Only obj_downs and obj_nuclear_delta ship .map sources; the other 12 were decompiled from .bsp with q3map2.

Map Source
obj_downs original .map (7,726 brushes, 771 patches, 471 lights)
obj_nuclear_delta original .map
obj_snow, obj_railhouse, obj_northport, _overkilling, obj_alcatraz_b3, obj_bahamut_final, obj_chlite, obj_dedust_final, obj_frostbite_101, obj_nbn23_se_b1, obj_oldtowne_b4, obj_town_and_metro_final decompiled .bsp

How the converter (q3_to_tdm.py) builds a TDM map:

  1. Visual geometry: the compiled BSP surfaces are exported to one OBJ, placed as a single func_static.
  2. Collision: the brushes are kept but turned into caulk (invisible, solid).
  3. Curved patches stay as visible patches.
  4. A sky hull box seals the map.
  5. Q3 shaders become TDM .mtr materials, with HD Platinum textures and _n normal maps where they exist.
  6. Decompiled maps get --force-sun --ambient 0.3, because their original lights are lost.

HD textures: the uploaded f_*.pk3 files plus f_tcetest_zzz_hd_textures.pk3 (1,148 MB) from the TrueCombat-Platinum GitHub release v0.39.7-sandbox44.

Commands: rebuild_all.sh rebuilds all 14. Per map, finish_map.sh <map> takes a spawn screenshot, packs tdm-port/maps/tce_<map>.pk4 with pack_map.py, and copies the .map and the dmap/run logs to tdm-port/logs/. Gameplay entities (spawns, objectives) are saved to gameplay/*.json but not placed yet.

Step 4: menus and fonts

The TCE menu backgrounds and logo show in the TDM main menu (FM folder fms/tce). The TCE fonts ariblk and courbd were converted to TDM font format with convert_fonts.py (as tce_ariblk, tce_courbd); the HUD uses them too.

Step 5: sky and plant fixes

Black sky patches and opaque plants are fixed, and all 14 maps were rebuilt with the fixes.

  • Sky: decompiling turns sky brushes into caulk, so the sky vanished. The converter now keeps the sky faces from the OBJ and draws them with the map's sky material. Making that material opaque removed striped z-fighting.
  • Plants: TCE's ET shaders use implicitMap / implicitMask / implicitBlend, which the converter did not handle. They are now converted to proper alpha-tested or blended stages.
  • HD jpgs have no alpha, so when an HD texture replaces one that had transparency, the HD colour is merged with the original alpha into a new .tga.
  • Maps in the same FM were overriding each other's materials, so each map's materials now get a prefix textures/tce/<map>/.
  • Metal shaders with an environment map stage now use their last normal stage as the diffuse texture.

Step 6: player model

The player is the TCE soldier, converted from ET's skeletal formats to TDM md5, with a separate head entity.

  1. mdm2md5.py reads the ET mesh (.mdm v3) and animation (.mdx v2) files and writes md5mesh / md5anim. Bones are rebuilt from ET's compressed angles and parent offsets; an origin joint is added and the model raised 24 units because ET feet sit at -24.
  2. Joints are renamed to TDM's humanoid names (Hips, Spine, Neck, Head, LeftArm, RightHand, LeftUpLeg…), so TDM's AI and player code can find them.
  3. The bind pose is frame 1633 (alert_idle_2h). Walk and run anims get root motion on the origin joint.
  4. build_character.py reads each TCE .char file and resolves skins and attachments the way ET does: head on tag_head, hat on the head's tag_mouth, belts and backpack on tag_bright, tag_bleft, tag_ubelt and tag_back. These md3 parts are baked into the mesh.
  5. Each character is written three ways: full mesh (NPCs), body without head, and a one-joint head mesh. TDM's light gem needs a separate head entity or the game crashes.
  6. Player def tce:player_soldier inherits TDM's player; a map selects it with the worldspawn key player_classname. Ragdoll: af/tce_soldier.af, adapted from TDM's guard because ET's shoulders hang off the neck.

Step 7: NPCs and camo series

There are 42 TCE soldier NPCs: 14 base characters plus snow, desert and commando series. All share the ET human animations and hold a gun.

Series Entity names Count Look
Base (skin s) tce:ai_allied_<class>, tce:ai_axis_<class> 14 CT woodland, T stripes + woodland trousers
Snow (skin s2) …_<class>_snow 14 CT white snow camo + snow helmet; T city top + Russian winter trousers
Desert (skin s1) tce:ai_allied_<class>_desert 7 CT tan camo, boonie cap
Commando (skin s3) tce:ai_allied_<class>_commando 7 CT black gear, masked helmet

Classes: soldier, medic, engineer, fieldops, cvops, elite, vip. TCE has no desert or commando set for the terrorists.

  • Base classes: tce:ai_ct_base (team 0, M4) and tce:ai_terrorist_base (team 1, AK-47), both inherit tce:ai_soldier_base (TDM humanoid AI).
  • Shooting: the ranged_attack anim uses ET's machinegun firing loop; bullets leave the right hand with create_missile / launch_missile frame commands.
  • The gun is a world model attached to the right hand at ET's tag_weapon position.
  • Variants: build_character.py --variants snow desert commando. Test maps: tce_lineup, tce_lineup_snow, tce_lineup_camo.
  • Each set also has 8 _pXY sub-skins that swap top and trouser textures; not used yet.

Step 8: firearms

Five TCE guns are selectable and fire, each with TCE's own firing sounds, a magazine and reload.

Gun Weapon slot Magazine Start reserve Fire
MP5 3 30 240 auto
M4 4 30 240 auto
AK-47 5 30 240 auto
M3 Super 90 6 7 56 semi, several pellets
Beretta 7 15 90 semi
  • build_weapons.py builds each first-person model from the TCE hands md3 plus the gun parts placed on the hands' tags, and writes simple animations (raise, idle, lower, recoil, reload).
  • World guns (held by NPCs) are converted from md3 to OBJ, because TDM's md3 renderer path crashes.
  • Sounds come from zz_platinum_gunfire.pk3: tce_<gun>_fire for first person, tce_<gun>_fire_3p for NPCs.
  • Bullets are fast projectiles (9000 units/s, no gravity) with damage per gun.
  • Logic is in the weapon script script/tce_weapon_firearm.script. Guns need ammo items (tce:ammo_<gun>), because TDM keeps weapons without ammo locked until bought in its shop.

Step 9: HUD and first engine patch

The TCE-style HUD replaces TDM's health bar and weapon display; the light gem stays at the bottom centre.

  • Bottom left: stance icon (stand / crouch / prone), stamina bar, health with the TCE cross icon.
  • Bottom right: gun name, magazine / reserve (for example 24 / 210) and a magazine bar.
  • File: guis/tdm_hud.gui in the FM, using TCE images from gfx/2d and gfx/hud; packed as apthreat_hud.pk4.
  • Engine change (game/Player.cpp): each frame the player now sends the HUD WeaponClip, WeaponClipSize, WeaponReserve, PlayerStance and player_stamina.
  • Guns use the engine's own magazine (clipSize key, ammoInClip / addToClip in the script). R is bound to reload in the FM's autoexec.cfg.
  • Export: apthreat/engine/apthreat.patch (diff against upstream c82dbf9) and apthreat/engine/apthreat.x64.

Step 10: movement

Walk, run, lean and crouch already exist in TDM. Sprint stamina, prone and iron sights are in the engine and were tested in game on tce_test (screenshots apthreat_ironsights.png, apthreat_prone_aim.png).

  • Sprint: the run key drains stamina (15 per second); at 0 the player walks until it is back to 30. It refills at 12 per second after 1 second of rest.
  • Prone: a new toggle (impulse 28). The player box drops to 22 units and the eyes to 14; speed is 35% of crouch speed. Getting up needs room above; the crouch key from prone goes to crouch.
  • Iron sights: hold the aim key with a gun that has an ironsight_offset key. The gun moves to the centre of the view over 0.18 s, the field of view narrows (default 55), weapon sway drops by 85%, and sprinting is blocked.
  • All values are tunable cvars named apt_*.
  • Export: apthreat/engine/ now holds apthreat.patch (180 lines added in 5 files), apthreat-src.tar.gz (55 MB, full source) and apthreat.x64.
  • Bindings (FM autoexec.cfg): Z = prone, mouse 2 = aim, mouse 3 = use (TDM had use on mouse 2), R = reload. All guns share one iron sight offset (-2 4.5 2.2) for now.

Problems hit and fixes

Problem Cause Fix
Reload played but magazine stayed empty animDone() never reports true for the reload anim Reload waits on a timer (reload_time, default 1.8 s)
R did nothing TDM binds R to another action; reload is impulse 13 FM autoexec.cfg binds R to reload
Game crashed when the TCE player spawned Light gem code needs a head entity Separate body mesh + head entity
“NULL model” fatal error with NPC guns TDM's md3 model path is broken World guns converted to OBJ
Guns not selectable TDM locks weapons without ammo until its shop Ammo items + start ammo per gun
White, giant first-person gun Env-map stage used as texture; wrong model offset Use last normal stage; offset ( -3 0 -1.5 )
Missing helmet/mask textures Backslashes in md3 shader paths Paths normalized
Ragdoll errors ET shoulders are children of the neck Custom tce_soldier.af
Black sky, opaque plants See step 5 See step 5
Third-person view in batch screenshots Test setting saved into the shared config Shots retaken with pm_thirdPerson 0
Black test screenshots A stale virtual display at 1024×768 Fresh displays per run

Known issues and next steps

  • Decompiled maps have no original lights (sun + ambient only); night maps are too bright. Relighting is waiting on a decision.
  • Gameplay entities (spawns, objectives) are saved but not placed in the maps; also waiting on a decision.
  • obj_alcatraz still shows white stripes in its sky.
  • First-person hands don't animate (only the gun moves), and the Beretta's hands sit too high.
  • Switching guns refills the magazine, because the engine doesn't remember a magazine per gun yet.
  • NPCs haven't yet been seen shooting at the player in tests.
  • Next: per-gun iron sight offsets (the AK-47 sits a bit close to the eye), and a player prone body animation for third person.

See also: APThreat project overview · Credits

apthreat/build_log.txt · Last modified: by basta

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki