All Projects → Ludeme → LudiiExampleAI

Ludeme / LudiiExampleAI

Licence: MIT license
Project with examples for the implementation of third-party AI algorithms / agents for the Ludii general game system.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to LudiiExampleAI

Warez
All your base are belong to us!
Stars: ✭ 584 (+2820%)
Mutual labels:  games, research
Warezz
It's illegal cuz they can't tax you!
Stars: ✭ 386 (+1830%)
Mutual labels:  games, research
QuestJS
A major re-write of Quest that is written in JavaScript and will run in the browser.
Stars: ✭ 47 (+135%)
Mutual labels:  games
sar2
Search and Rescue II. Helicopter flight simulator for Linux and OSX.
Stars: ✭ 20 (+0%)
Mutual labels:  games
trackswitch.js
A Versatile Web-Based Audio Player for Presenting Scientific Results
Stars: ✭ 39 (+95%)
Mutual labels:  research
BlueVGA
VGA library for STM32F103C (BluePill) that can manipulate a screen with 28x30 tiles with 8x8 pixels each, in a total resolution of 224x240 pixels with 8 colors using a very low footprint
Stars: ✭ 39 (+95%)
Mutual labels:  games
hyper-radar
💡 Research and development at Hyper
Stars: ✭ 12 (-40%)
Mutual labels:  research
Groundbreaking-Papers
ML Research paper summaries, annotated papers and implementation walkthroughs
Stars: ✭ 90 (+350%)
Mutual labels:  research
fuzvisor
A framework provides an interface to monitor and control fuzzers
Stars: ✭ 31 (+55%)
Mutual labels:  research
EtherEngine
简明易用的 Lua 跨平台游戏接口
Stars: ✭ 132 (+560%)
Mutual labels:  games
Discord-Games
A library for making implementing conventional games into your discord bot, easier.
Stars: ✭ 31 (+55%)
Mutual labels:  games
htrgouvea.github.io
My past public researches are archived here
Stars: ✭ 18 (-10%)
Mutual labels:  research
cry
SageMath/Python Toolkit for Cryptanalytic Research
Stars: ✭ 23 (+15%)
Mutual labels:  research
AssetRipper
GUI Application to work with engine assets, asset bundles, and serialized files
Stars: ✭ 820 (+4000%)
Mutual labels:  games
Jetpack-Joyride-CE
A port of the iOS and Android Jetpack Joyride game for smartphones for the TI-84 Plus CE graphing calculators.
Stars: ✭ 22 (+10%)
Mutual labels:  games
awesome-utrecht-university
A curated list of awesome open source projects from Utrecht University.
Stars: ✭ 31 (+55%)
Mutual labels:  research
hack
Kubernetes security and vulnerability tools and utilities.
Stars: ✭ 56 (+180%)
Mutual labels:  research
MHW-Shop-Editor
Monster Hunter World Provisions Stockpile Shop Editor
Stars: ✭ 52 (+160%)
Mutual labels:  games
phaser-mario
Mario-like class for Phaser
Stars: ✭ 19 (-5%)
Mutual labels:  games
UAV-Stereo-Vision
A program for controlling a micro-UAV for obstacle detection and collision avoidance using disparity mapping
Stars: ✭ 30 (+50%)
Mutual labels:  research

Ludii Example AI

license release-version Maintenance code-size top-language twitter

This project contains instructions and examples for the implementation of third-party AI algorithms / agents for the Ludii general game system. After developing your own agent, you can load it locally through the GUI of the Ludii application, and watch it play any game supported by Ludii!

Agents implemented according to the instructions on this page will also be suitable for submission to any future agent-based playing competitions organised using the Ludii system.

Most of the documentation found in this repository may also be found in the Ludii User Guide, accessible from the Ludii webpage.

We also recommend taking a look at the Ludii Tutorials for tutorials on AI development as well as any other aspects of Ludii, and Ludii Python AI for implementing AIs using Python.

Table of Contents

Requirements

The minimum version of Java required is Java 8.

Getting Started

AI Development

  1. Download Ludii's JAR file. This is the JAR file that can also be used to launch the Ludii application.

  2. Create a new Java project using your favourite IDE. You can also create a fork of this github repository to get started with some example implementations of basic agents.

  3. Make sure to add the Ludii's JAR file downloaded in step 1 as a library for your project.

  4. Any agent that you'd like to implement will have to extend the abstract class util.AI. This contains four methods that may be overridden:

    1. public Move selectAction(final Game game, final Context context, final double maxSeconds, final int maxIterations, final int maxDepth). It takes a reference to the game being played, and the current context (which contains, among other data, the current game state) as arguments, and should return the next Move to be played by the agent. The final three arguments can be used to restrict the agent's processing (its search time, or its maximum iteration count or search depth for example).
    2. public void initAI(final Game game, final int playerID). This method can be used to perform any initialisation of the AI when the game to be played has been determined, but before the initial game state has been generated.
    3. public boolean supportsGame(final Game game). This method has a default implementation to return true for any game, but may be overridden to return false for games that your agent cannot play. For example, it may be unable to play simultaneous-move games, and then be implemented to always return false for those. Ludii will then know not to try to make your AI play such a game.
    4. public void closeAI(). This method can be used to perform any cleanup of resources when a game has been finished.

    For a simple example class that extends this abstract class, see the Example Random AI.

  5. Export your project to a new JAR file.

Loading AI in the Ludii Application - Programmatically

The LaunchLudii.java file included in this example repository demonstrates how you can write your own main method that programmatically launches the Ludii application (including its graphical user interface), while also registering your own custom AI implementations such that they can be selected in Ludii's dropdown menus for agent selection. The code used for this looks as follows:

// Register our example AIs
AIRegistry.registerAI("Example Random AI", () -> {return new RandomAI();}, (game) -> {return true;});
AIRegistry.registerAI("Example UCT", () -> {return new ExampleUCT();}, (game) -> {return new ExampleUCT().supportsGame(game);});
AIRegistry.registerAI("Example DUCT", () -> {return new ExampleDUCT();}, (game) -> {return new ExampleDUCT().supportsGame(game);});
	
// Run Ludii
StartDesktopApp.main(new String[0]);

Each of the three AIRegistry.registerAI() calls registers a custom AI entry for the dropdown menus in Ludii. In each of these calls, the first argument is the name displayed in dropdown menus, the second argument is a function that Ludii calls whenever it wishes to instantiate such an AI object, and the third argument is a function that, for any give game, tells Ludii whether or not that agent is applicable to that game. For example, an agent that cannot play simultaneous-move games should return false when a simultaneous-move game is passed into this function. The final line of code simply launches the Ludii application.

Loading AI in the Ludii Application - From JAR

In the Ludii application, the dialog in which agent types can be assigned to players can be opened by clicking one of the player names in the GUI, or by selecting Ludii > Preferences... in the menubar. In addition to a number of built-in agents, the drop-down menus contain a From JAR option.

To load your own custom AI implementation into Ludii, export your project containing it to a new JAR file. Next, select the From JAR option, and then select the JAR file containing your custom AI's .class file. A dialog will appear with all the different classes in the selected JAR file that extend Ludii's util.AI abstract class, and you will be required to choose one of them. Note that this means that it is fine if you have a single JAR file containing many different, custom AI implementations; they can all be loaded.

Ludii will attempt to instantiate an agent of the selected class by calling a zero-arguments constructor of that class. This will only work correctly if your class does indeed provide a zero-args constructor, and it will have to be public as well!. After loading it as instructed here, the custom AI can be used to play any games in the Ludii application, just like any other built-in AI.

Note: while the Ludii application is running, it will only load all the .class files of any selected JAR file once. If you have already selected a JAR file once, and then re-build your custom JAR file without changing its filepath, you will have to close and re-open the Ludii application if you wish to try loading agents from the modified JAR file.

Example Agents

Citing Information

When using Ludii in any publications (for example for running experiments, or for visual inspections of your agent's behaviour during development, etc.), please cite our paper on the Ludii system. This can be done using the following BibTeX entry:

@inproceedings{Piette2020Ludii,
        author      = "{\'E}. Piette and D. J. N. J. Soemers and M. Stephenson and C. F. Sironi and M. H. M. Winands and C. Browne",
        booktitle   = "Proceedings of the 24th European Conference on Artificial Intelligence (ECAI 2020)",
        title       = "Ludii -- The Ludemic General Game System",
        pages       = "411-418",
        year        = "2020",
        editor      = "G. De Giacomo and A. Catala and B. Dilkina and M. Milano and S. Barro and A. Bugarín and J. Lang",
        series      = "Frontiers in Artificial Intelligence and Applications",
        volume      = "325",
		publisher	= "IOS Press"
    }

Background Info

This repository contains information and examples for the development of third- party AI implementations which can be loaded into the Ludii General Game System. Note that this repository does not contain the full Ludii system, or its built-in AI options.

This work, as well as the full Ludii system itself, are developed for the Digital Ludeme Project. More info on the project and the system can be found on:

Contact Info

The preferred method for getting help with troubleshooting, suggesting or requesting additional functionality, or asking other questions about AI development for Ludii, is creating new Issues on the github repository. Alternatively, the following email address may be used: ludii(dot)games(at)gmail(dot)com.

Changelog

  • 14 September, 2021: Updated repository for new version 1.2.9 of Ludii.
  • 23 April, 2021: Updated repository for compatibility with new version 1.1.17 of Ludii.
  • 12 February, 2021: Updated repository for compatibility with new version 1.1.14 of Ludii.
  • 2 November, 2020: Updated repository for compatibility with new version 1.1.0 of Ludii.
  • 31 August, 2020: Updated repository for compatibility with new version 1.0.5 of Ludii.
  • 16 August, 2020: Updated repository for compatibility with new version 1.0.3 of Ludii.
  • 24 July, 2020: Updated repository for compatibility with new version 1.0.0 of Ludii.
  • 4 July, 2020: Updated repository for compatibility with new version 0.9.4 of Ludii.
  • 3 April, 2020: Updated repository for compatibility with new version 0.6.1 of Ludii.
  • 13 December, 2019: Updated repository for compatibility with new version 0.5.0 of Ludii.
  • 27 November, 2019: Updated repository for compatibility with new version 0.4.1 of Ludii.
  • 6 September, 2019: Updated repository for compatibility with new version 0.3.0 of Ludii.
  • 13 August, 2019: Initial release.

Acknowledgements

This repository is part of the European Research Council-funded Digital Ludeme Project (ERC Consolidator Grant #771292), being run by Cameron Browne at Maastricht University's Department of Advanced Computing Sciences.

European Research Council Logo

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].