Fragment physics: 64-bit collision layer masks with names (SIX-206) #267

Manually merged
github merged 3 commits from gh-pr/267/head into gh-pr/267/base 2026-11-26 20:22:58 +00:00
Owner

@⁠holdmysocks on GitHub · 2026-11-25 12:55 UTC · original
holdmysocks:six-frag-layers → master · +227 −27 · 4 files · 3 commits · merged 2026-11-25 13:37 UTC

Collision layer masks in the physics block, read in full and named (SIX-206). This is stacked on #265: until #265 lands, the diff includes its commit.

What changes

  • Masks are 64-bit. Fragment child type/include masks are u64 at child +0x38 and +0x40, and the archetype's are at +0x28 and +0x30. Only the low halves were read before.
    • type_flags and include_flags are now 16-digit hex.
    • The physics version goes from 1 to 2.
  • New name lists: type_layers and include_layers for children, and archetype_type_layers and archetype_include_layers for the archetype. An all-ones mask gives ["all"]. A bit without a name gives layer_<bit>.
  • dr drawables: the bound children of dr drawables now carry their masks too, from the 16-byte records at composite +0x88.
  • Research examples: mapboundflags tallies the map collision's child masks with their material ids. surfnames prints surface id → material name from extracted common files.

How the names were checked

Bits 0–31 follow GTA V's collision layer order. I checked them against the masks of every map collision composite in levels: 22 distinct type/include pairs, with the materials of each. Each checked layer sits on the surfaces and collides with the layers its name implies:

type material / use collides with
0x3e, layers 1–5 (map_weapon, map_dynamic, map_animal, map_cover, map_vehicle) the plain map mesh peds, ragdolls, animals, objects, projectiles, test layers
0x2 map_weapon alone weapon-only meshes, and most small fragment chunks projectile, test_weapon, test_camera only
0x3c, without the weapon bit mover-only meshes the same as 0x3e minus test_weapon
0x10 map_cover alone cover test_ai only
0x20 map_vehicle alone road reflectors, submerged rock vehicle_not_bvh, test_vehicle_wheel only
bit 30 map_stairs stairs ped, animal and the test layers only
bit 27 map_river all LIQ_WATER the test layers only
bit 31 map_deep_surface DEFORM_* sand, mud and gravel
bit 19 foliage VEG_* leaves and twigs

Foliage is also found only on vegetation fragments. Bits not checked this way are placed by the same order only, and the source marks them so. On all 40,705 level fragments, the archetype's type mask equals the OR of its children's masks plus bit 0.

Not named

Bits 32 and up are layers the older engine did not have. Patterns seen:

layer used on collides with
35 bushes test_camera only
41 trees
42 light bulbs explosion and test_weapon
46 shop shelf rows
36, 40 the test layers only

Most include masks have layer 37. Map collision uses 34, 35, 41, 43 and 47.

The rare group flag bits do not line up with any layer of their children.

Tests: sixng-core tests pass, merged with current master.

**@⁠holdmysocks** on GitHub · 2026-11-25 12:55 UTC · [original](https://github.com/holdmysocks/SixNG/pull/267) `holdmysocks:six-frag-layers` → `master` · +227 −27 · 4 files · 3 commits · merged 2026-11-25 13:37 UTC Collision layer masks in the `physics` block, read in full and named (SIX-206). This is stacked on #265: until #265 lands, the diff includes its commit. ## What changes - **Masks are 64-bit.** Fragment child type/include masks are u64 at child +0x38 and +0x40, and the archetype's are at +0x28 and +0x30. Only the low halves were read before. - `type_flags` and `include_flags` are now 16-digit hex. - The `physics` version goes from 1 to 2. - **New name lists:** `type_layers` and `include_layers` for children, and `archetype_type_layers` and `archetype_include_layers` for the archetype. An all-ones mask gives `["all"]`. A bit without a name gives `layer_<bit>`. - **`dr` drawables:** the bound children of `dr` drawables now carry their masks too, from the 16-byte records at composite +0x88. - **Research examples:** `mapboundflags` tallies the map collision's child masks with their material ids. `surfnames` prints surface id → material name from extracted common files. ## How the names were checked Bits 0–31 follow GTA V's collision layer order. I checked them against the masks of every map collision composite in levels: 22 distinct type/include pairs, with the materials of each. Each checked layer sits on the surfaces and collides with the layers its name implies: | type | material / use | collides with | |---|---|---| | 0x3e, layers 1–5 (map_weapon, map_dynamic, map_animal, map_cover, map_vehicle) | the plain map mesh | peds, ragdolls, animals, objects, projectiles, test layers | | 0x2 `map_weapon` alone | weapon-only meshes, and most small fragment chunks | `projectile`, `test_weapon`, `test_camera` only | | 0x3c, without the weapon bit | mover-only meshes | the same as 0x3e minus `test_weapon` | | 0x10 `map_cover` alone | cover | `test_ai` only | | 0x20 `map_vehicle` alone | road reflectors, submerged rock | `vehicle_not_bvh`, `test_vehicle_wheel` only | | bit 30 `map_stairs` | stairs | `ped`, `animal` and the test layers only | | bit 27 `map_river` | all LIQ_WATER | the test layers only | | bit 31 `map_deep_surface` | DEFORM_* sand, mud and gravel | | | bit 19 `foliage` | VEG_* leaves and twigs | | Foliage is also found only on vegetation fragments. Bits not checked this way are placed by the same order only, and the source marks them so. On all 40,705 level fragments, the archetype's type mask equals the OR of its children's masks plus bit 0. ## Not named Bits 32 and up are layers the older engine did not have. Patterns seen: | layer | used on | collides with | |---|---|---| | 35 | bushes | `test_camera` only | | 41 | trees | | | 42 | light bulbs | `explosion` and `test_weapon` | | 46 | shop shelf rows | | | 36, 40 | | the test layers only | Most include masks have layer 37. Map collision uses 34, 35, 41, 43 and 47. The rare group flag bits do not line up with any layer of their children. Tests: sixng-core tests pass, merged with current master.
The preset file in common has 157 presets that list every boolean. Bit
18 is override_vehicle_defaults, damage_around_break is confirmed and
weapon_health (tuning slot 6) too. Notes which booleans are never true
in a preset and the group-name patterns of the bits still unnamed. Adds
the fraggroups research example (group names and flag words per
fragment).
Type and include masks are u64 (child +0x38/+0x40, archetype
+0x28/+0x30); only the low halves were read. Exports type_layers /
include_layers, named after GTA V's layer order and checked against the
map collision (weapon-only, cover, vehicle-only, stairs, river, deep
surface and foliage children). Drawable bound children get their masks
too (composite +0x88). physics version 2. Adds the mapboundflags and
surfnames research examples.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:22:56 +00:00
github manually merged commit f619c7df23 into gh-pr/267/base 2026-11-26 20:22:58 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.