BSP (Source Engine Map) Ray Tracer / Ray Caster Library.
Allows to do static / out-of-engine visibility checks and ray casting on BSP map files.
Can be used to get more accurate visibility info between players than there is available in CS:GO demos/replays (.dem files).
You may want to use this together with csgo-centrifuge to get the correct map version to trace against per demo.
- Faces (basic map geometry)
- Brushes (walls / level shape)
- Static Props (boxes, barrels, etc.)
- Orientation / Angle
- Displacements (terrain bumps and slopes)
- Entities ("dynamic" props - doors, vents, etc.)
package main
import (
"fmt"
"os"
"github.com/go-gl/mathgl/mgl32"
"github.com/saiko-tech/bsp-tracer/pkg/bsptracer"
)
func main() {
csgoDir := os.Getenv("CSGO_DIR") // should point to "SteamLibrary/steamapps/common/Counter-Strike Global Offensive"
m, err := bsptracer.LoadMapFromFileSystem(csgoDir+"/csgo/maps/de_cache.bsp", csgoDir+"/csgo/pak01", csgoDir+"/platform/platform_pak01")
if err != nil {
panic(err)
}
fmt.Println("A site -> A site, open:", m.IsVisible(mgl32.Vec3{-12, 1444, 1751}, mgl32.Vec3{-233, 1343, 1751})) // true
fmt.Println("T spawn -> A site:", m.IsVisible(mgl32.Vec3{3306, 431, 1723}, mgl32.Vec3{-233, 1343, 1751})) // false
fmt.Println("mid through box:", m.IsVisible(mgl32.Vec3{-94, 452, 1677}, mgl32.Vec3{138, 396, 1677})) // false
fmt.Println("T spawn -> T spawn:", m.IsVisible(mgl32.Vec3{3306, 431, 1723}, mgl32.Vec3{3300, 400, 1720})) // true
}
Uses golangci-lint
Follows https://github.com/golang-standards/project-layout
- This library is based on the C++ valve-bsp-parser by @ReactiioN1337
- Thanks to @jangler for porting the C++ library to Go
- Thanks to @Galaco for creating Go tooling for the BSP file format & source engine