Coder Social home page Coder Social logo

adamxuuuu / rts-ai-framework Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 2.0 2.03 MB

A framework for AI research in RTS game (under construction)๐Ÿฑโ€๐Ÿ‘“๐Ÿฑโ€๐Ÿš€๐Ÿฑโ€๐Ÿ‰๐Ÿฑโ€๐Ÿ’ป

License: GNU General Public License v3.0

Java 100.00%
rts ai java

rts-ai-framework's Introduction

alphaRTS

alphaRTS is a Java framework for AI research in real-time strategy game enviorment.

Installation

Currently the only way to run this framework is to clone the repositroy to your local system and run it under a Java enviorment (preferably a IDE).

Put the libraries in the lib folder inside the project structure.

Usage

To run a pre-defined game, locate the class in the root of the 'src' directory.

Select a example configuration in the main method:

enum PlayerType {DONOTHING,HUMAN,RANDOM,RANDOM_BIASED,MC,SIMPLE,MCTS,}

public static void main(String[] args) {
    Game g = init(new PlayerType[]{PlayerType.HUMAN, PlayerType.RANDOM});
    ...
    runGame(g);
}

and simply watch the game play.

Using the API

To create your own bot, please make a package and put in the player directory. The main class of your bot must extend the class or a subclass of it. Implement the following method:

/**
 * Function requests an action from the agent, given current game state observation.
 *
 * @param gs - current game state.
 * @return - action to play in this game state.
 */
public abstract PlayerAction act(GameState gs);

public abstract Agent copy();

Add the type to the enum in the class with its constructor (this will be imporved).

Creating unit

It is very simple to define your own unit in alphaRTS, simple write a JSON file with following format:

{
  "type": 0,
  "name": "light",
  "speed": 2,
  "range": 2,
  "cost": 5,
  "maxHp": 10,
  "attack": 2,
  "buildTime": 1,
  "rateOfFire": 1,
  "spriteKey": [
    "scifiUnit_01.png",
    "scifiUnit_13.png",
    "scifiUnit_25.png",
    "scifiUnit_37.png"
  ]
}

Spritekey can be found in the 'kenny_rtsci-fi' directory or you can use your own sprite sheet. (Don't forget to change things in the 'sprite' folder)

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

GPL-3.0 License

rts-ai-framework's People

Contributors

adamxuuuu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

qatar-aw xiaoyi20

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.