-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Match3 example #4515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Match3 example #4515
Conversation
* WIP special pieces * add special piece types to obs (need more from master first) * update sensors and models * docstrings
* handle no valid moves more gracefully * rename callback
com.unity.ml-agents.extensions/Runtime/Match3/Match3ActuatorComponent.cs
Show resolved
Hide resolved
com.unity.ml-agents.extensions/Runtime/Match3/Match3ActuatorComponent.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to review more but looks good so far.
Project/Assets/ML-Agents/Examples/Match3/Scripts/Match3Agent.cs
Outdated
Show resolved
Hide resolved
Project/Assets/ML-Agents/Examples/Match3/Scripts/Match3Agent.cs
Outdated
Show resolved
Hide resolved
Project/Assets/ML-Agents/Examples/Match3/Scripts/Match3Board.cs
Outdated
Show resolved
Hide resolved
} | ||
|
||
/// <summary> | ||
/// Check if the "half" of a move is matches 3 or more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Check if the "half" of a move is matches 3 or more. | |
/// Check if the "half" of a move matches 3 or more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is a half move ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated:
/// Check if one of the cells that is swapped during a move matches 3 or more.
/// Since these checks are similar for each cell, we consider the Move as two "half moves".
public Direction Direction; | ||
|
||
/// <summary> | ||
/// Construct a Move from its index and the board size. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A little more details on this method. Replace a
with the
since there is a 1 to 1 mapping between index and move and explain that the index corresponds to the index in the list of all potential moves on a board of size (maxRows, maxCols).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rearranged some of the comments and moved them off of the MoveIndex member and into the class summary. I think between that and the comments on the moveIndex argument, it's fairly clear now.
time_horizon: 1000 | ||
summary_freq: 10000 | ||
threaded: true | ||
Match3SimpleHeuristic: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very strange to have a section for a heuristic. If possible, I would remove, if not possible (so the curves can be observed, I would remove all hyperparameters except for max_steps and set it to 0 or 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplified
public int MaxMoves = 500; | ||
|
||
[Tooltip("If selected, will pick the move that makes the most points. Otherwise, will pick a random valid move.")] | ||
public bool UseSmartHeuristic = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename UseSmartHeuristic to SmartHeuristic. The word Use
makes it sound like Heuristic will be used, but this is dependent on the Actuator setting "Force Heuristic".
Ideally, the UseSmartHeuristic
checkbox should be next to Force Heuristic
in the Actuator.
Also, I think it might confuse users that we now have 3 different places for the Heuristic:
Behavior Parameters (behavior type); Match3Agent(UseSmartHeuristic); and Actuator (ForceHeurisitic)
Not sure what can be done though...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to an enum for Greedy vs RandomValidMove, and updated some GameObject and behavior names.
Ideally, the UseSmartHeuristic checkbox should be next to Force Heuristic in the Actuator.
Maybe for this specific case, but Greedy vs RandomValidMove is specific to the Match3Agent
@@ -0,0 +1,67 @@ | |||
# Match-3 Game Support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This document is not linked anywhere (not that I could see). I think we can link it from the examples page or from the com.unity.ml-agents.extensions.md page in the contents section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added links from the extensions readme
Proposed change(s)
Work in progress match-3 example.

The abstract board, sensor, and actuator are in the
com.unity.ml-agents.extension
package. An example with basic mechanics is in the Match3 scene (and corresponding scripts).TODO
Useful links (Github issues, JIRA tickets, ML-Agents forum threads etc.)
Types of change(s)
Checklist
Other comments