Skip to content

Parse CS2 map vphys file (extract from vphys_c in VPK file) to triangles for visibility check via moller-trumbore algo

Notifications You must be signed in to change notification settings

M3351AN/Vphys-Parser-Online

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Map Parser

Convert vphys file to a .tri file (a list of vec3 point, each 3 points repersents a triangle)
Reason why I do that is vk3 parser takes lots memory to save the .vphys text (especially for inferno [5.9Gb] )
and .vphys contains lots useless info. And save the time of converting vphys to vector in ur code

Format of Triangle in .tri

typedef struct Vector3 {
    float x, y, z;
};

typedef struct Triangle {
    Vector3 p1, p2, p3;
};

File size

# Map Name .vphys .tri .tri to .vphys .tri.minz .tri.minz to .vphys
1 inferno 674MB 307MB -54.46% 25.5MB -96.23%
2 overpass 113MB 57.1MB -49.47% 4.62MB -95.93%
3 ancient 370MB 22.1MB -94.03% 4.76MB -98.70%
4 anubis 256MB 18.3MB -92.85% 3.31MB -98.67%
5 dust2 175MB 13.3MB -92.40% 2.25MB -98.70%
6 vertigo 129MB 9.44MB -92.68% 1.27MB -99.02%
7 nuke 54.4MB 8.18MB -84.96% 887KB -98.37%
8 mirage 24.8MB 5.67MB -77.13% 522KB -97.93%
9 office 21.4MB 4.40MB -79.43% 451KB -97.93%

Instructions for end users (using the web tool)

Use


1. Open the Vphys file decoder webpage

2. Click "Choose File" or drag the .vphys file to the upload area

3. Choose whether to compress the output

4. Click the "Start Decoding" button

5. Wait for the processing to complete, then click the Download button to get the output file

Instructions for developers (build and deploy)

Build and Deploy

You have to configure the Emscripten toolchain to compile C++ code to WebAssembly


1. Compile C++ code to WebAssembly:

Use Emscripten to compile vphys_parser.cc to generate vphys_parser.js and vphys_parser.wasm

Linux : Use build.sh
Windows : Use build.bat

2. Put the following files in the same directory:

- index.html

- vphys_parser.js

- vphys_parser.wasm

3. Deploy web pages through a web server (direct access to file:// does not work with WebAssembly)

Tips. You can use Python to quickly start a local web server: python -m http.server 8000, then access it in a browser: http://localhost:8000

Credits

About

Parse CS2 map vphys file (extract from vphys_c in VPK file) to triangles for visibility check via moller-trumbore algo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 95.5%
  • C++ 4.2%
  • Other 0.3%