Giter Club home page Giter Club logo

agent-gpy's Introduction

Agent-GPY

A python bot which is tailor made to play Counter Strike 1.6 using Image Processing and Controller Emulation

Read this paper if you want to know how it works in detail

https://ieeexplore.ieee.org/document/8474885

Check this presentation out for a cool overview of the project

https://github.com/jaspreetbhamra/Agent-GPY/blob/master/Slideshow/Agent%20GPY%20Slideshow.pdf

Screenshots

This image indicates the process of training the model with 1 Positive & 1 Negative sample

The model training process

This image shows the controller status during testing (using a picture from the web)

The model training process

This image shows the simple navigation model's working

  1. The Bold-White lines are all the lines we get from Hough Lines - Line recognition algorithm
  2. The red lines show the estimated trace of the Hough Lines we used to read the 3D space
  3. The green circle indicates the centre of the closest horizontal line we can trace, thus giving us the desired direction of travel The model training process

Instructions

  1. Install Python3
  2. Download the source
  3. Run Counter Strike 1.6, and pick a team
  4. Run g.py using the following command
    $ g.py -t <team>
    (team can be either 'ct' or 't')

Working mechanism/algorithm

  1. Grab screen for the game's viewport
  2. Use Haar Cascades to recognize teammates vs hostiles (The trained data had been made using a set of 1200 images of targets)
  3. Use Controller Emulator scripts like PyAutoGUI to flick mouse after identifying targets on the viewport
  4. Use the library to click
  5. Check back the viewport data for movement clues
    5.1. Use CV2 image processing library to get a greyscale version of the viewport
    5.2. Use Gaussian Blur to blur out the high noise tiled regions on the screen
    5.3. Run Hough Lines transform to get lines
    5.4. Discard vertical lines
    5.5. Check for two adequately long lines on opposite halves of the viewport with opposite slope, to recognize them as the edges at the feet of walls
    5.6. Apply Forward movement input if you get a positive for the pattern in 5.5
    5.7. Check for oppositely sloped lines on the same halves
    5.8. Apply Right/Left movement input against the half in which you get a positive for the pattern in 5.7

Future Work

Try using the same code, train for images of real life objects/robots_from_opp_teams, and make a robot that plays the same objectives as in Counter Strike

agent-gpy's People

Contributors

jaspreetbhamra avatar psyclone20 avatar vieper1 avatar

Watchers

 avatar  avatar  avatar  avatar  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.