Code Monkey home page Code Monkey logo

cs_net's Introduction

CS_Net

This github repository serves as the artifacts repository for the AIIDE-20 paper Learning to Reason in Round-based Games: Multi-task Sequence Generation forPurchasing Decision Making in First-person Shooters.

This is a baseline deep RL model for round-based game strategy learner.

A good explanation of CS:GO economy strategy can be found here.

Quick Links

Task

The goal is to assign weapons and equipment to a target player each round. To deal with the intrinsic attributes and preferences of each team and each player, the problem is defined as few-shot learning. Each game is identified as a task. For each task, the model can observe k rounds (not necessarily need to be consecutive) as the support set. Predict player's weapon purchasing in the rest rounds. We formulize it as a sequence generation problem.

Input: player's current weapons and equipment, player's current money, other teammates' purchasing decision, opponent's previous round weapons and equipment, all players' performance score, round score.

Output: Weapon purchasing sequence.

Evaluation: F1 score

Getting the Data

You can use CS:GO demo files and preprocess the structured data with this visualizer.

Method

Embeddings are generated using self-supervised learning. Similar to word2vec, the action sequence is sorted in a certain manner (e.g. the player have to buy pistols first, then assault rifles, grenades, equipment). We predict the action before and after every action. Here's a t-SNE visualization:

Meta-learning algorithm: Reptile

Reward: F1 score

Objective function: Self-critical

Model Architecture

Model

Usage

Installation

Install PyTorch (>= 1.4.0) following the instuctions on the PyTorch. Our code is written in Python3.

Dataset

Download dataset at Google Drive and put it in data/dataset folder. The raw dataset consists of json files extracted from demos. The 'processed.npy' is acquired by src/preprocess.py.

Dataset is processed in the data folder.

  • 'action_capacity.npy': Capacity for each weapon.
  • 'action_embedding.npy', 'action_embedding.xlsx': Action embedding file.
  • 'action_money.npy': Cost of each weapon.
  • 'action_name.npy': Name of each weapon.
  • 'action_type': Type of each weapon -- guns, grenades, equipment.
  • 'mask.npz': This file indicates what weapons can be purchased for two sides, terrorist and counter-terrorist.
  • 'type_capacity.npy': Capacity for each type of weapons.
  • 'type_name.npy': The name of each type.
  • 'weapon_index.json': Indices of the weapons.

Training

The following command can be used to train the model.

CUDA_VISIBLE_DEVICES=$GPU_ID
python3 run.py --mode='train' --history_encoding='score_weighted' --statedir=$MOVEL_SAVE_PATH

Evaluation

To generate prediction on test set, simply change the --mode flag in the command above from train to test.

CUDA_VISIBLE_DEVICES=$GPU_ID
python3 run.py --mode='test' --history_encoding='score_weighted' --statedir=$MOVEL_SAVE_PATH

We provide the checkpoint of our best model. Download it at Google Drive and put it in log/checkpoint/iteration3-score-weight folder. To test it, run the following command:

CUDA_VISIBLE_DEVICES=$GPU_ID
python3 run.py --statedir='iteration3-score-weighted' --mode='test' --lstm_mode='triple' --history_encoding='score_weighted'

cs_net's People

Contributors

beiieb avatar derenlei avatar

Watchers

 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.