Straddle groups #86
Replies: 8 comments 12 replies
-
|
Afaik there's nothing in the bsp to say which GridCells each straddle group connects It's worth noting that some maps use the |
Beta Was this translation helpful? Give feedback.
-
|
Straddle group 0 might be just for Primitives & GeoSets contained to one GridCell, idk. |
Beta Was this translation helpful? Give feedback.
-
>>> bsp = maps["mp_glitch"]
>>> [i
... for i, gc in enumerate(bsp.CM_GRID_CELLS)
... for gs in bsp.CM_GEO_SETS[gc.first_geo_set:gc.first_geo_set+gc.num_geo_sets]
... for p in bsp.CM_PRIMITIVES[gs.primitive.index:gs.primitive.index+gs.num_primitives]
... if p.type.name == "PROP"][:4]
[559, 559, 559, 560]
>>> bsp.CM_GRID_CELLS[559]
<GridCell (first_geo_set: 74, num_geo_sets: 1)>
>>> bsp.CM_GEO_SETS[74]
GeoSet(
straddle_group=242, num_primitives=4,
primitive=<BitField (type: <PrimitiveType.BRUSH: 0>, index: 80, unique_contents: 6)>)
>>> bsp.CM_PRIMITIVES[80:80+4]
[<Primitive (type: <PrimitiveType.TRICOLL: 64>, index: 223, unique_contents: 6)>,
<Primitive (type: <PrimitiveType.PROP: 96>, index: 29, unique_contents: 6)>,
<Primitive (type: <PrimitiveType.PROP: 96>, index: 906, unique_contents: 6)>,
<Primitive (type: <PrimitiveType.PROP: 96>, index: 905, unique_contents: 6)>]
>>> {bsp.GAME_LUMP.sprp.model_names[bsp.GAME_LUMP.sprp.props[i].model_name] for i in (29, 906, 905)}
{'models/foliage/tree_cherry_blossom_large_01.mdl',
'models/homestead/rock_cluster_basalt_01_wet_sm.mdl'}>>> [i
... for i, gc in enumerate(bsp.CM_GRID_CELLS)
... if 74 in [*range(gc.first_geo_set,gc.first_geo_set+gc.num_geo_sets)]]
[559, 560, 561, 600]
>>> bsp.CM_GEO_SETS[74].straddle_group # 1st geo set w/ props
242
>>> [i
... for i, gc in enumerate(bsp.CM_GRID_CELLS)
... for gs in bsp.CM_GEO_SETS[gc.first_geo_set:gc.first_geo_set+gc.num_geo_sets]
... if gs.straddle_group == 242]
[559, 560, 561, 562,
600, 601, 602, 603, 604,
641, 642, 643, 644, 645,
683, 684, 685, 686,
725, 726, 727, 767, 768]>>> bsp.CM_GRID_CELLS[601]
<GridCell (first_geo_set: 148, num_geo_sets: 3)>
>>> bsp.CM_GEO_SETS[148:148+3]
[GeoSet(straddle_group=242, num_primitives=4, ..., index: 80, unique_contents: 6), # clone of 74
GeoSet(straddle_group=312, num_primitives=4, ..., index: 100, unique_contents: 6),
GeoSet(straddle_group=506, num_primitives=2, ..., index: 104, unique_contents: 1)]
>>> {gs for gs in bsp.CM_GEO_SETS if gs.straddle_group == 242}
{GeoSet(straddle_group=242, num_primitives=4, primitive=<BitField (type: <PrimitiveType.BRUSH: 0>, index: 80, unique_contents: 6)>)} |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
looks like really big >>> import bsp_tool
>>> bsp = bsp_tool.load_bsp("E:/Mod/Titanfall2/maps/mp_glitch.bsp")
>>> bsp.grid_cell_primitives(1806)
[(<Primitive (type: <PrimitiveType.BRUSH: 0>, index: 12, unique_contents: 0)>,
Bounds(origin=vec3(-6200.0, -1488.0, 1284.0), negative_cos=-32768, extents=vec3(2009.0, 4033.0, 1276.0), positive_sin=0)),
(<Primitive (type: <PrimitiveType.BRUSH: 0>, index: 285, unique_contents: 0)>,
Bounds(origin=vec3(5816.0, 1744.0, 1284.0), negative_cos=-32768, extents=vec3(2009.0, 4033.0, 1276.0), positive_sin=0)),
(<Primitive (type: <PrimitiveType.BRUSH: 0>, index: 286, unique_contents: 0)>,
Bounds(origin=vec3(2048.0, 4240.0, 1262.0), negative_cos=-32768, extents=vec3(1761.0, 1521.0, 1298.0), positive_sin=0)),
(<Primitive (type: <PrimitiveType.PROP: 96>, index: 16182, unique_contents: 6)>,
Bounds(origin=vec3(-1503.0, -3865.0, 5299.0), negative_cos=-31384, extents=vec3(4060.0, 7604.0, 5489.0), positive_sin=9423)),
...]the 1 prop: >>> bsp.GAME_LUMP.sprp.props[16182]
StaticPropv13(
origin=vec3(0.0, 0.0, 0.0), angles=<MappedArray (y: 0.0, z: 90.0, x: 0.0)>, scale=1.0,
model_name=27, solid_mode=<StaticPropCollision.VPHYSICS: 6>, flags=<StaticPropFlags.NO_DRAW: 4>, skin=0, cubemap=1,
forced_fade_scale=-1.0, lighting_origin=vec3(nan, 34.12068176269531, 16.043363571166992),
cpu_level=<MappedArray (min: -1, max: -1)>, gpu_level=<MappedArray (min: -1, max: -1)>,
diffuse_modulation=<RGBExponent (r: 0, g: 0, b: 0, exponent: 0)>, collision_flags=<MappedArray (add: 0, remove: 0)>)
>>> bsp.GAME_LUMP.sprp.model_names[27]
'models/levels_terrain/mp_glitch/glitch_godrays.mdl' |
Beta Was this translation helpful? Give feedback.
-
>>> import bsp_tool
>>> bsp = bsp_tool.load_bsp("E:/Mod/Titanfall2/maps/mp_glitch.bsp")
>>> bsp.CM_GRID.count.x * bsp.CM_GRID.count.y
1806
>>> min([gs.first_geo_set for gs in bsp.CM_GRID_CELLS[:1806] if gs.num_geo_sets > 0])
0
>>> max([gs.first_geo_set + gs.num_geo_sets for gs in bsp.CM_GRID_CELLS[:1806] if gs.num_geo_sets > 0])
3246
>>> gridcell_geosets = set()
>>> for grid_cell in bsp.CM_GRID_CELLS[:1806]:
... if grid_cell.num_geo_sets > 0:
... start = grid_cell.first_geo_set
... end = start + grid_cell.num_geo_sets
... gridcell_geosets.update({*range(start, end)})
...
>>> {*range(3246)}.difference(gridcell_geosets)
{3229, 3230, 3231, 3232, 3233, 3234, 3235, 3236, 3237, 3238, 3239, 3240, 3241, 3242, 3243}
>>> bsp.CM_GRID_CELLS[1806:]
[<GridCell (first_geo_set: 3229, num_geo_sets: 15)>] |
Beta Was this translation helpful? Give feedback.
-
|
grid cells (+ indices) containing [(gc, i)
for i, gc in enumerate(bsp.CM_GRID_CELLS)
if 432 in [
gs.straddle_group
for gs in bsp.CM_GEO_SETS[gc.first_geo_set:gc.first_geo_set+gc.num_geo_sets]]] |
Beta Was this translation helpful? Give feedback.
-
|
>>> import bsp_tool, os, fnmatch
>>> md = "E:/Mod/Titanfall/maps/"
>>> maps = {fn[:-4]: bsp_tool.load_bsp(os.path.join(md, fn)) for fn in fnmatch.filter(os.listdir(md), "*.bsp")}
>>> all({gs.primitive.unique_contents} == {p.unique_contents for p, b in bsp.geo_set_primitives(i)}
... for bsp in maps.values()
... for i, gs in enumerate(bsp.CM_GEO_SETS))
True
>>> md = "E:/Mod/Titanfall2/maps/"
>>> maps = {fn[:-4]: bsp_tool.load_bsp(os.path.join(md, fn)) for fn in fnmatch.filter(os.listdir(md), "*.bsp")}
>>> all({gs.primitive.unique_contents} == {p.unique_contents for p, b in bsp.geo_set_primitives(i)}
... for bsp in maps.values()
... for i, gs in enumerate(bsp.CM_GEO_SETS))
True |
Beta Was this translation helpful? Give feedback.



Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Rough Summary
A
GeoSetcontains a group of physics objects (Primitives)The "grouping" is done with the common
.first_X,.num_XsystemEach
Primitiveappears only once, butGeoSetsappear multiple timesGrid&GridCellsindexGeoSetsa few spans at a timeThis means some
GeoSetsare duplicatesEach duplicate has the same
straddle_groupvalueSeems to be an ID to aid with caching
GeoSetsI haven't done any reverse engineering of engine
.dlls to confirm thisGrid.num_straddle_groupsmatches the maximumstraddle_groupvalue + 1A value of
0is commonly used forGeoSetswith no duplicates (unique to their parentGridCell)Lump Relationships
Beta Was this translation helpful? Give feedback.
All reactions