Code Monkey home page Code Monkey logo

steadyhand's Introduction

SteadyHand

An auto-aim/recoil assist program for Counter-Strike: Global Offensive (CS:GO) created by Keon (Isaac) Park, CS @ Illinois, and written in C++ using the Windows API, openFrameworks, Valve's Game-State Integration, and Crow.

Demo Video from 2018. There are differences in the UI between the current master branch and video demo (based off the legacy2018 branch), but the key aspects and functionality of the program remain the same. The main differences involve better coding style and documentation/comments in the master branch.

Disclaimer: This program is a proof-of-concept, meaning that it is not meant to be used in live CS:GO games to cheat. If you want to test SteadyHand in-game, run CS:GO with the launch option -insecure and play in a offline map/match. I developed this project in order to learn and practice C++, Windows programming, and GUI design.

Why and How

In CS:GO, every gun recoils in a set pattern. For example, every time a player fires an M4 rifle in-game, the gun will recoil in a pattern that looks like a flipped-seven. To compensate for recoil, players move their mouse in such a way that the mouse movement mirrors the weapon's recoil across the y=x axis. Because the recoil pattern for each gun is constant, it is feasible to manually record a set mouse movement path (i.e. a macro) for a spray pattern once and have a program (i.e. SteadyHand) exactly replicate it every time the user fires the particular gun in the game.

By simulating mouse movements in place of the user (through the Windows C++ API), SteadyHand automatically controls in-game weapon recoil and maintains accurate aim without human error whenever the player fires a gun. SteadyHand also automatically detects real-time which weapon the user has equipped and loads the corresponding pattern to control the recoil. It accomplishes this using Valve's Game-State Integration, which sends live information about in-game events in JSON format to a HTTP endpoint.

Since CS:GO is mainly available on Windows and SteadyHand uses the Windows API, SteadyHand can only be used on the Windows operating system, preferably 7/10.

Architecture

SteadyHand is structured as an openFrameworks application with a real-time GUI, background webserver, and a Win32 API backend. Detailed and in-depth documentation and explanation are present within the files themselves (for the master branch), but here's a brief overview:

  • GUI: Allows user to switch between "Active" and "Recording" modes, as described below. Displays which weapon SteadyHand detects the user to be using in real-time so that user can validate that the program is recording/aiming for the correct weapon in-game.

    • Relevant files: ofApp.h, ofApp.cpp
  • Webserver: Detects in real-time the currently equipped weapon of the user in-game so that the rest of the program can record a pattern for or automatically control the recoil for the correct weapon, depending on the current mode ("Active" vs. "Recording").

    • Relevant files: threads.h, threads.cpp
  • Win32 API backend: Handles the "recording weapon recoil patterns" and "recoil aimbot" functionality of SteadyHand. Reads inputs from user's mouse and keyboard via Windows. Simulates user mouse input via Windows.

    • Relevant files: mouse_handler.h, mouse_handler.cpp, mouse_mover.h, mouse_mover.cpp, mouse_recorder.h, mouse_recorder.cpp

As for the changes added in August 2019 to the master branch, they largely involved refactoring the code to have better style (fewer global variables/constants, more OOP, etc) and more documentation.

Building and Setup

Visual Studio (2015 and above) is recommended/needed for VC++ and the Windows.h file. openFrameworks is required. The solution and project files must be generated using the openFrameworks project-generator application, and while doing so, the ofxDatGui addon needs to be included; follow the detailed instructions on the ofxDatGui and openFrameworks website.

After generating the openFrameworks project/solution, external dependencies need to be included.

  • Boost v1.67 needs to be downloaded, compiled, and included into the project; follow instructions in this SO answer.
  • Afterwards, Crow will need to be included into the project to set up the HTTP endpoint server to use game-state integration. This library is already located in this github repository, so just add the crow/ folder to the additional include directories in your project like you did for ofxDatGui and Boost.
  • This JSON library is also required to parse JSON payloads. Like Crow, this library is already in the repository. Add the nlohmann/ folder to additional include directories as well.

Usage Instructions

  1. Set up your CS:GO client for game-state integration: detailed instructions on Valve dev website. The required cfg file is in this repository as "gamestate_integration_main.cfg".

  2. After building the executable through Visual Studio, launch the program executable. A GUI window will display, showing a dropdown menu with options.

    • Select "Active" to start using SteadyHand's automatic recoil compensation.
    • Select "Recording" Patterns" to record new weapon spray patterns.
  3. The "Currently Equipped" part of the GUI auto-updates to show which weapon the program currently detects from the player in-game. This will correctly correspond to the actively equipped gun in-game if game-state integration was correctly set up and the state of SteadyHand is set to one of the two states described above.

  4. Active Mode

    • If SteadyHand was able to locate the patterns/ folder in the same directory of your executable, then it will have loaded all of the spray patterns and correctly compensate recoil for the gun equipped by the player in-game.
    • The bin/patterns/ directory in this repository already contain some example pattern files, but users may need to record their own weapon patterns to better fit their game-specific settings (in-game sensitivity, resolution, more weapons).
    • Test this feature by firing a full spray, half spray, short bursts, etc with various weapons. The cross-hair will also reset to the center automatically.
  5. Recording Mode

    • Once this mode is toggled on, SteadyHand will start recording all mouse movements you make while the mouse left button is pressed down. All other mouse movements are tracked but never saved to file.
    • Test this feature by manually compensating a full spray of a gun of your choice (i.e. SteadyHand will record this because the mouse left button is clicked down while firing in-game). Afterwards, release the left mouse button. Then press "u" on the keyboard to save (to file) the mouse path movement that was just recorded.
    • SteadyHand will detect which gun that was just recorded and appropriately save the movement to the gun's pattern file upon the "u" key press.
    • If you are unsatisfied with the spray that was just recorded, press "i" on the keyboard to clear the temporary buffer and redo the recording. You can also re-record patterns even if you already saved a prior one to file.
  6. Press ENTER in any state of SteadyHand to quit.

steadyhand's People

Contributors

parkkeo1 avatar gcevans avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.