Giter Site home page Giter Site logo

genericgamebot-ai's Introduction

Python / FastAI CNN - Playing Game

This code was used to gather and process data while playing the game Fall Guys.

This code will be modified for permit the use in every game with a minimum edit of the config.yaml file The network was then trained using the FastAI Libary.

THIS IS A BIG WORK IN PROGRESS

Setup

  • Edit the config.yaml [SEE THE SECTION BELOW]
  • Open the game in a small window ( i suggest something 4:3 like 480 x 480 for now)
  • Run CreateData.py
  • Start changing the value of the region_capured in the config file until the game is perfectly visible in the black window
  • Pressing B will start the screen / key grab. These will be stored in lists until you press H.
  • Once the episode ( Round ) ends pressing h will stop the screen / key grab process and all data will be moved to a numpy array.The array will be stored in data/target_data_<nameofthegame>.npy and data/training_data_<nameofthegame>.npy
  • Go in Utils folder and run CreateImages.py to generate images that will be splitted in folders corresponding to their actions.The images are stored in images/<nameofthegame>/

Example of a configuration file with explanation

game_name:  Tower_Hero #name of the game that will be used for rename the folder and the model (please use underscore intead of space)
path_game: test_path #not used for now
region_captured:  #where the window of the game is located on the screen
  left: 710 #starting point at the left
  top: 300 #starting point at the top
  extensionOfX: 1110 #how far the window of the game extends on the X axis (starting from the left point)
  extensionOfY: 807 #how far the window of the game extends on the Y axis (starting from the top point)
dummmy_direction: LEFT_KEY #direction where to point when you are doing nothing in the game
commands: #association of -key pressed- : -name of the folder where the image will be stored-
  UP_KEY : 'Nothing'
  LEFT_KEY : 'Left'
  DOWN_KEY : 'Down'
  RIGHT_KEY : 'Right'
  ' ' : 'Fire'

Train

  • Run training.py

Run Agents

  • Open the game withe the window in the same position of the CreateData.py operation
  • Run TrainedAgent.py





OLD INSTRUCTION

Setup

  • I used dual monitors with a game playing at a 800 X 600 resolution on one screen.
  • You can start data collection by running CreateData.py
  • Pressing B will start the screen / key grab. These will be stored in lists until the episode is done.
  • Once the episode ( Round ) ends pressing h will stop the screen / key grab process and all data will be moved to a numpy array.
  • Then I used a script in util folder called CreateImages.py to put then onto a disk drive in folders corresponding to their actions.

Train

  • Use the file called training.py
  • Point it at your image directory

Run Agents

  • Fully random agent is RandomAgent.py
  • Trained Agent is TrainedAgent.py
  • You will have to load in the pkl created from training.

Inputs (Observations)

  • Uses inputs to the neural network (Observations) of pixes in the game.
  • 224 X 224
  • Line detection

Contact!

genericgamebot-ai's People

Contributors

claritycoders avatar nuked88 avatar

Watchers

 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.