CS2 Fog Of War: Server-sided anti-wallhack occlusion culling for CS2 servers
CS2 Fog Of War (CS2FOW)
Server-Side Anti-Wallhack Occlusion Culling for Counter-Strike 2
📌 Overview
CS2FOW is a specialized Metamod plugin designed for community-run and dedicated CS2 servers. Its primary goal is to combat wallhacking by implementing server-sided occlusion culling.
The Core Logic: If a player is completely obscured by the map's solid geometry, the server simply stops transmitting that player's entity data to the opponent's client. If the client never receives the coordinates, a cheat has no data to render on the screen.
🛠️ Deployment & Compatibility
- Installation: This is a server-side tool.
Client-side installation requiredNot required.Works on Valve Official MatchmakingImpossible (unless Valve integrates this logic natively).- Impact: It does not modify local files, inject code into the player's game, or require any user-end software.
⚙️ How It Works
The plugin acts as a gatekeeper for entity data. Instead of the server broadcasting every player's position to everyone, it performs a visibility check.
📊 Data Filtering Matrix
The current preview version focuses specifically on living combatants.
| Entity Type | Filtered? | Note |
|---|---|---|
| Living Enemy Pawns | ✅ | Primary target for occlusion |
| Held Weapons | ✅ | Filtered along with the pawn |
| Teammates / Self | ❌ | Always transmitted |
| Dead Players / Bots | ❌ | Not filtered |
| Spectators / HLTV | ❌ | Different behavior; unfiltered to prevent bugs |
| Projectiles / Particles | ❌ | Out of scope |
| Dropped World Items | ❌ | Currently an information leak |
🔍 Technical Deep Dive
Spatial Analysis
CS2FOW doesn't rely on manually created maps. Instead, it utilizes the actual CS2 map physics resources.
- The Baker extracts static collision triangles from the mounted map.
- It constructs a
BVH8(Bounding Volume Hierarchy) acceleration structure. - At runtime, the server checks multiple points on the observer and target to determine visibility.
Preventing "Pop-in"
To ensure that players don't suddenly "teleport" into view the millisecond they round a corner, the plugin uses a predictive buffer. It reveals enemies slightly before they are mathematically visible.
The reveal window is calculated based on the recipient's network latency:
This ensures that higher-ping players still see enemies smoothly, though this is capped via configuration to prevent excessive data leakage.
⚠️ Limitations & Nuances
It is important to understand that CS2FOW is a mitigation tool, not a total cure.
- What it DOES NOT stop:
- Sound-based cheats (footsteps, gunfire).
- Knowledge of "common prefire spots."
- Information from teammates.
- Last-known position tracking.
- Gameplay Integrity: Because hit registration, damage, and movement are handled server-side, shooting through walls/doors still works perfectly. The server processes the bullet regardless of whether the client "knew" the enemy was there.
Current Technical Gaps
- Dynamic Objects: Doors, breakables, and smokes are currently not used as occluders.
- Weapon Muzzles: Currently, the plugin checks points around the body. If a gun barrel pokes around a corner before the body does, the player might "pop in" slightly late.
🚀 Future Roadmap
The development of CS2FOW is ongoing. The following items are targeted for future updates:
- Dropped Weapon Filtering: Prevent "clutch" leaks where a weapon appearing/disappearing reveals a rotation.
- Muzzle Visibility: Add sampling for weapon bounds to trigger reveals earlier.
- Smoke Approximation: Researching volume-based occlusion for active smokes without breaking game mechanics.
- Sound Filtering: (High Difficulty) Exploring ways to strip sound data without affecting legitimate players.
// Conceptual logic for future weapon filtering
if (entity->is_dropped_weapon()) {
if (!is_visible(observer, entity)) {
stop_transmission(observer, entity);
}
}