This project is a proof-of-concept system to detect aimbot-like behavior in CS2 (Counter-Strike 2) matches using machine learning—specifically, an LSTM-based neural network trained on engineered features from in-game demo files.
To build a neural network that can differentiate between cheater and non-cheater gameplay by analyzing player input data (pitch, yaw, velocity, acceleration, etc.) extracted from .dem files.
- 
Parsing - .demfiles are parsed into CSV using- demoparser2.
- For every kill event, a 300-tick window is extracted for the attacker.
 
- 
Processing - Irrelevant columns like player name are dropped.
- Files are organized by class (cheater vs. legit).
 
- 
Feature Engineering - First, second, and third derivatives of aim angles (velocity, acceleration, jerk).
- Cumulative displacement, statistical summaries, etc.
 
- 
Modeling - A two-layer LSTM reads each 300×20 feature segment.
- Outputs a probability of the segment being a cheater.
 
| Metric | Value | 
|---|---|
| Accuracy | 81% | 
| Legit Recall | 91% | 
| Cheat Recall | 60% | 
| F1 Score | 0.87 (legit), 0.67 (cheat) | 
These results are based on an initial dataset of 104 labeled segments. Performance is expected to improve significantly as more cheater sessions are collected.
The repository implements a real-time cheat-detection pipeline for CS2 using LSTM networks on parsed pitch/yaw data. The main folders and files include:
- data— Data root directory- /raw/— Original- .demfiles and external datasets.
- /interim/parsed_csv/— Parsed tick-by-tick CSVs (before feature engineering).
- /processed/features/— Feature-engineered datasets.
 
- scripts/— Pipeline scripts to run in sequence:- 00_listSteamid.py
- 01_parser.py
- 02_process_and_engineer.py
- 03_model.py
 
- notebooks/— Jupyter notebooks for exploratory data analysis and visualization.
- legacy_ver/— The first version of the project with a simpler flow and parser, kept for documentation and evolution tracking.
- Expand cheater dataset across more sessions and cheat types.
- Tune class weights and decision threshold.
- Explore attention mechanisms and bidirectional LSTMs.
- Improve false-positive control to avoid flagging legit players.
- Python 3.8+
- Jupyter
- demoparser2
- TensorFlow
- pandas, numpy, tqdm, matplotlib
Follow the steps below to set up this project locally:
git clone https://github.com/yviler/cs2-cheat-detection.git
cd cs2-cheat-detectionpython3 -m venv venv
source venv/bin/activateor on Windows
venv\Scripts\activatepip install --upgrade pip
pip install -r requirements.txtpython scripts/01_parser.py
python scripts/02_process_and_engineer.pypython scripts/03_model.py