Skip to content

Commit bf712fe

Browse files
authored
Release 10 match3 doc (#4647)
* Change title * added overvierw, cleaned up structure. * Updated with getting started, clean up * added link to form. added note about playable * clean up * Update Match3.md
1 parent 4feccd2 commit bf712fe

File tree

1 file changed

+33
-12
lines changed
  • com.unity.ml-agents.extensions/Documentation~

1 file changed

+33
-12
lines changed

com.unity.ml-agents.extensions/Documentation~/Match3.md

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,30 @@
1-
# Match-3 Game Support
1+
# Match-3 with ML-Agents
22

3-
We provide some utilities to integrate ML-Agents with Match-3 games.
4-
<img src="images/match3.png" align="middle" width="3000"/>
3+
<img src="images/match3.png" align="center" width="3000"/>
54

6-
## AbstractBoard class
5+
## Overview
6+
One of the main feedback we get is to illustrate more real game examples using ML-Agents. We are excited to provide an example implementation of Match-3 using ML-Agents and additional utilities to integrate ML-Agents with Match-3 games.
7+
8+
Our aim is to enable Match-3 teams to leverage ML-Agents to create player agents to learn and play different Match-3 levels. This implementation is intended as a starting point and guide for teams to get started (as there are many nuances with Match-3 for training ML-Agents) and for us to iterate both on the C#, hyperparameters, and trainers to improve ML-Agents for Match-3.
9+
10+
This implementation includes:
11+
12+
* C# implementation catered toward a Match-3 setup including concepts around encoding for moves based on [Human Like Playtesting with Deep Learning](https://www.researchgate.net/publication/328307928_Human-Like_Playtesting_with_Deep_Learning)
13+
* An example Match-3 scene with ML-Agents implemented (located under /Project/Assets/ML-Agents/Examples/Match3)
14+
15+
If you are a Match-3 developer and are trying to leverage ML-Agents for this scenario, [we want to hear from you](https://forms.gle/TBsB9jc8WshgzViU9). Additionally, we are also looking for interested Match-3 teams to speak with us for 45 minutes. If you are interested, please indicate that in the [form](https://forms.gle/TBsB9jc8WshgzViU9). If selected, we will provide gift cards as a token of appreciation.
16+
17+
## Interested in more game templates?
18+
Do you have a type of game you are interested for ML-Agents? If so, please post a [forum issue](https://forum.unity.com/forums/ml-agents.453/) with [GAME TEMPLATE] in the title.
19+
20+
## Getting started
21+
The C# code for Match-3 exists inside of the extensions package (com.unity.ml-agents.extensions). A good first step would be to familiarize with the extensions package by reading the document [here](com.unity.ml-agents.extensions.md). The second step would be to take a look at how we have implemented the C# code in the example Match-3 scene (located under /Project/Assets/ML-Agents/Examples/match3). Once you have some familiarity, then the next step would be to implement the C# code for Match-3 from the extensions package.
22+
23+
Additionally, see below for additional technical specifications on the C# code for Match-3. Please note the Match-3 game isn't human playable as implemented and can be only played via training.
24+
25+
## Technical specifications for Match-3 with ML-Agents
26+
27+
### AbstractBoard class
728
The `AbstractBoard` is the bridge between ML-Agents and your game. It allows ML-Agents to
829
* ask your game what the "color" of a cell is
930
* ask whether the cell is a "special" piece type or not
@@ -14,27 +35,27 @@ These are handled by implementing the `GetCellType()`, `IsMoveValid()`, and `Mak
1435

1536
The AbstractBoard also tracks the number of rows, columns, and potential piece types that the board can have.
1637

17-
#### `public abstract int GetCellType(int row, int col)`
38+
##### `public abstract int GetCellType(int row, int col)`
1839
Returns the "color" of piece at the given row and column.
1940
This should be between 0 and NumCellTypes-1 (inclusive).
2041
The actual order of the values doesn't matter.
2142

22-
#### `public abstract int GetSpecialType(int row, int col)`
43+
##### `public abstract int GetSpecialType(int row, int col)`
2344
Returns the special type of the piece at the given row and column.
2445
This should be between 0 and NumSpecialTypes (inclusive).
2546
The actual order of the values doesn't matter.
2647

27-
#### `public abstract bool IsMoveValid(Move m)`
48+
##### `public abstract bool IsMoveValid(Move m)`
2849
Check whether the particular `Move` is valid for the game.
2950
The actual results will depend on the rules of the game, but we provide the `SimpleIsMoveValid()` method
3051
that handles basic match3 rules with no special or immovable pieces.
3152

32-
#### `public abstract bool MakeMove(Move m)`
53+
##### `public abstract bool MakeMove(Move m)`
3354
Instruct the game to make the given move. Returns true if the move was made.
3455
Note that during training, a move that was marked as invalid may occasionally still be
3556
requested. If this happens, it is safe to do nothing and request another move.
3657

37-
## Move struct
58+
### Move struct
3859
The Move struct encapsulates a swap of two adjacent cells. You can get the number of potential moves
3960
for a board of a given size with. `Move.NumPotentialMoves(NumRows, NumColumns)`. There are two helper
4061
functions to create a new `Move`:
@@ -43,22 +64,22 @@ iterate over all potential moves for the board by looping from 0 to `Move.NumPot
4364
* `public static Move FromPositionAndDirection(int row, int col, Direction dir, int maxRows, int maxCols)` creates
4465
a `Move` from a row, column, and direction (and board size).
4566

46-
## `Match3Sensor` and `Match3SensorComponent` classes
67+
#### `Match3Sensor` and `Match3SensorComponent` classes
4768
The `Match3Sensor` generates observations about the state using the `AbstractBoard` interface. You can
4869
choose whether to use vector or "visual" observations; in theory, visual observations should perform
4970
better because they are 2-dimensional like the board, but we need to experiment more on this.
5071

5172
A `Match3SensorComponent` generates a `Match3Sensor` at runtime, and should be added to the same GameObject
5273
as your `Agent` implementation. You do not need to write any additional code to use them.
5374

54-
## `Match3Actuator` and `Match3ActuatorComponent` classes
75+
#### `Match3Actuator` and `Match3ActuatorComponent` classes
5576
The `Match3Actuator` converts actions from training or inference into a `Move` that is sent to` AbstractBoard.MakeMove()`
5677
It also checks `AbstractBoard.IsMoveValid` for each potential move and uses this to set the action mask for Agent.
5778

5879
A `Match3ActuatorComponent` generates a `Match3Actuator` at runtime, and should be added to the same GameObject
5980
as your `Agent` implementation. You do not need to write any additional code to use them.
6081

61-
# Setting up match-3 simulation
82+
### Setting up Match-3 simulation
6283
* Implement the `AbstractBoard` methods to integrate with your game.
6384
* Give the `Agent` rewards when it does what you want it to (match multiple pieces in a row, clears pieces of a certain
6485
type, etc).

0 commit comments

Comments
 (0)