How to Solve a Match-3 with Machine Learning! (Unity ML-Agents) -

How to Solve a Match-3 with Machine Learning! (Unity ML-Agents)

Code Monkey
Views: 14636
Like: 571
✅Get the ML-Agents Match-3 Extension
📝Playlist Machine Learning AI in Unity
🌍 Get my Complete Courses! ✅
👍 Learn to make awesome games step-by-step from start to finish.
🎮 Get my Steam Games

Sponsored by Unity

🌍 ML-Agents Latest Releases –

How to use Machine Learning AI in Unity (ML-Agents)

I made a Match-3 Game in under 6 HOURS! (Experience is SPEED!)

How to Playtest your Game 100 Times in 10 MINUTES! (Unity Game Simulation)

Achieve Perfect Game Balance with Unity Game Simulation!

AI Learns to Play Flappy Bird!

Make your Games Designer Friendly! (Scriptable Objects)

00:00 Machine Learning Match-3
01:10 Unity Match-3 ML-Agents Extension
02:10 AbstractBoard, Match3Actuator, Match3Sensor
03:13 Implementing AbstractBoard
09:00 Agent, Match3Actuator, Match3Sensor
09:46 Requesting Decisions
10:50 Adding Rewards
13:27 Heuristics Testing
14:55 Training
17:24 Results
20:32 Machine Learning Match-3

🌍 Get Code Monkey on Steam!
👍 Interactive Tutorials, Complete Games and More!

If you have any questions post them in the comments and I’ll do my best to answer them.

🔔 Subscribe for more Unity Tutorials

See you next time!

📍 Support on Patreon
🤖 Join the Community Discord
🎮 Grab the Game Bundle at
📝 Get the Code Monkey Utilities at

#mlagents #unitytutorial #unity #unity2d #unity3d​ #gamedev​ #indiegame​ #gamedevelopment #madewithunity​ #indiedev​


Hello and Welcome!
I’m your Code Monkey and here you will learn everything about Game Development in Unity using C#.

I’ve been developing games for several years with 8 published games on Steam and now I’m sharing my knowledge to help you on your own game development journey.

I do Unity Tutorials on just about every topic, Unity Tutorials for Beginners and Unity Tutorials for Advanced users.

You can see my games at

– Other great Unity channels:
Brackeys –
Dani –
Jabrils –
BlackthornProd –
Sykoo –
Jason Weimann –
Jonas Tyroller –

– Website:
– Twitter:
– Steam:


  1. Really cool project as always. I will try to implement this as well.

  2. sir, any tuts for Using AI with BOLT visual scripting (specially from basics)

  3. I was literally just thinking about this today like, "Wouldn't it be cool if we could play Candy Crush with AI?"

    get out of my head

  4. Another great episode on the possibilities of Unity's AI. Thank you very much.

  5. This is cool. But I don't see the use if implementing an already Created AI to my game. Would be much cooler to actually create the match 3 machine learning rather than use the already made match 3 agent. Because here were are really just learning how to provide a preprogrammed AI with the relevant data. We are not actually learning about AI

  6. Hey Code Monkey, i recently started to use Ressource.Load to load files like PNGs or Prefabs. But i read, that it is not the best way to load objects because of memory usage. Maybe you can do a tutorial on this, like how to structure your project in matters of perfomance, memory and loading/unloading.

  7. But why? There are problems simply more suitable for algorithms. I know it's just a tutorial of possible implementation but still, ML-Agents should be applied to more complex problems where simple algorithms would not be feasible.

  8. Hello I have a question about how I do to protect my code made in unity. How do I make my code more secure avoiding changes or visualization of the code?

  9. I always wanted to do a Gem Drop game, but like Puzzle fighter with the gems that made bigger gems, I was thinking maybe it would be with Layers and auto Tiling but Ive never tried all just a lame theory

  10. Thanks, do you have a tutorial that contains how to use game objects from Scene to an other Scene?

  11. When i edit the config file can i resume the brain training or i need to init a new one with initialize-from ?

  12. Really interesting, but would have been nice if you included the section you hinted about. "You can use the MLBrain to display recommended moves."
    That would be incredibly helpful, as it would cover adding additional interaction with the created brain.

  13. I am confused. How does the agent observe the environment? Also, in general, how does an agent collect observation in a 2D environment? Anyone? Please

  14. Bro u Made my day that is exactly what i was looking for hug thanks bro

  15. How does the Agent know which move can it perform?
    The example in Unity have the behaviour parameters actions set to 0, I'm confused about how do the Agent can interact with the board 🙁

  16. Will Match-3 Extension Work for games like Toy Blast and Toon Blast?

  17. if the match 3 board have different obstacles need to be broke to win, how can the match3 integration customize to teach it to break the obstacle?

  18. Thank goodness I found this video. Without it, I would still be using camera sensors.

  19. I'm having problems on trying to use an old training model. This is what I have "–run-id=1 –resume" but How do I use the –inference flag to run an older version of the id=1
    I want it to start training from a past step and not default to the most resent.

Leave a Reply

Your email address will not be published.