Stride/NumVertices/PrimCount matching is expected, not the bug. Those three describe the geometry batch, and both teams are the same mesh with a different skin, so no amount of tuning there will ever separate them. You need an attribute that is per-actor.
What actually differs, in the order I'd try it:
- Texture. Skins are almost always split per team. Inside your DrawIndexedPrimitives hook call
Code:
dev->GetTexture(0, &tex)
- it just reads cached state, so you don't need a separate SetTexture hook - and use the texture pointer as the key. Resolve texture -> team once and cache it.
- World matrix / shader constants. One character is drawn as several consecutive primitives under the same transform. Group them with
Code:
GetTransform(D3DTS_WORLD)
(or hash the vertex shader constant block), then find the constant that flips between the two teams. Engines usually pass a tint or team id rather than baking it into the model.
- Vertex buffer.
Code:
GetStreamSource(0, &vb, &offset, &stride)
. Usually a different VB pointer per team, or one VB used with different stream offsets.
If none of that holds, stop classifying at draw time and go for the actor instead: find the entity array once, then correlate each draw to an actor by world matrix or vertex range. More work up front, but you get team, name, health and distance out of one struct, and it survives map changes - texture-pointer maps don't, because the device recreates them on reset.
Cheapest way to find the discriminator: log a fingerprint per draw (texture ptr, VB ptr, stride, numverts, world matrix hash, first few constants), stand in front of team 1, then team 2, and diff the two logs. The field that flips is your answer. Don't try to guess it from the outside.