• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Fry_hunter

A couple of questions about Monte Carlo Tree Search (MCTS)

4 posts in this topic

Hi everyone,

 

First of all sorry for possible mistakes. English is not my native language... 

 

I'm trying to implement MCTS with UCT, to do an intelligence capable of play Go game. However, I have an important question about the algorithm. I know there are 4 phases: Selection, Expansion, Simulation and Backtracking.

 

My question is about Selection phase. I've been reading some papers, documentation and so on, and from what I understand, if a move has not been tried before, we must priorize it before anything else. That's make sense to me, but at the same time, I don't undertstand how to grow the tree in depth with this rule. For example, let's suppose we have 3 possible moves. We initialitze the tree, with just the root node.

 

  • 1st playout: 0 moves. No childs yet. So we choose randomly 1 of the three possible moves, we add as a child of the root node, and we make a simulation from it. Then we update this new node incrementing the visit counter and the win counter (if playout has been won). 
  • 2nd and 3rd playout: We have 1 child in root node. But there are two moves that have not been tried yet. So, we must priorize them, isn't it? At the end of 3rd playout, we'll have 3 childs at first level of the tree, with 1 simulation each one.
  • 4th playout: Okay. Now, in the selection phase, we travel down the tree and use UCT formula to select the first node (for example). We have three untried moves here because any simulation has been tried before through this node yet.

And here comes my question: everytime we get an unexploedr node, we will have to try the 3 possible moves before going deeper? That means that we will have always a branching factor of 3 for all nodes, isn't it?  However in the next image (an example I've found in the Internet), the selected node is part of a level with only 2 of the 3 possible moves. How is that possible? 

 

z8z6c.png

 

Am I doing this right? Or I'm missing something?

 

Thanks in advance!

 

0

Share this post


Link to post
Share on other sites

And here comes my question: everytime we get an unexploedr node, we will have to try the 3 possible moves before going deeper? That means that we will have always a branching factor of 3 for all nodes, isn't it?  However in the next image (an example I've found in the Internet), the selected node is part of a level with only 2 of the 3 possible moves. How is that possible?


Where do you think that each node in that diagram is supposed to have 3 available moves? As far as I can tell, your question can only be answered by referring to the original paper that contains that diagram. I doubt the original paper with that diagram says that it represents a game that always presents three choices at every step of the game.

Edit: Even if you're right about the diagram, I think this can still happen:

The first three nodes, if you have three choices at the beginning, will be those three choices before it goes deeper. I believe you're right about that. However, once all three were tried once, you may have simulated 1 win and 2 losses. Now your search will start to favor the sub-tree with the win. If you continue to find mostly wins in that sub-tree, the other two choices will be ignored for awhile while you go deeper into the winning choice. Edited by Pink Horror
0

Share this post


Link to post
Share on other sites
Yes, I understand that. But my question is if in these subtrees, the rule that priorizes untried moves is applied too.

One thing I think I'm missunderstanding too, is the possible moves in these subtrees. We have 3 possible moves at the first level of the tree. In following levels can we have just two moves or even three different moves from the three of the begining? If so, my previous question is answred but it generates a new different question to me:

In the expansion phase which moves are generated? I though that were always the three same moves from the begining, but if we can have different moves how are they generated? Randomly like the in the simulation phase? Or we must track all possible moves in each node in the tree?

Thanks for your response!
0

Share this post


Link to post
Share on other sites
I implemented UCT for go a few years ago, but I am having a hard time understanding your language.

The way I think of it, the "expansion phase" is not a phase at all. Moves are picked from a rule like UCB1 while we have statistics to do so, and from some playout policy function when we don't. We then may want to add a new node to the UCT tree along the line we just explored (but if you only add a node after it has been searched a few times, the algorithm works just fine; it's a tradeoff of performance for memory consumption).

Although in the original description of the algorithm you do try each move once before trying any move for a second time, this detail is not important, and it's actually detrimental to the performance of the program. It's not hard to see why this is a bad idea. Imagine that you are using "heavy" playouts (e.g. the simulation phase picks moves from a non-uniform probability distribution biased towards better moves). Then a full playout (selection + simulation, in the language you are using) typically consists of a few high-quality moves (picked by the UCB1 rule based on good statistics), then a totally random move when you reach the leaf (because you need to pick an unexplored move), then reasonable moves again.

There are several techniques that have been proposed to fight this problem. Off the top of my head, "progressive widening" (CrazyStone?), using statistics from the grandparent node (Mogo?) or heuristics from the heavy playouts to initialize counts when a new node is created. I believe RAVE may also contribute to ameliorate the situation.

Notice that if you are using "light playouts" (which was probably the case for the first implementation of UCT), this issue doesn't exist, because the last move in the UCT tree is then of comparable quality to the moves in the "simulation phase". Edited by Álvaro
0

Share this post


Link to post
Share on other sites

Well... I followed the way explained in some papers and wikipedia (for example). 

 

http://en.wikipedia.org/wiki/Monte-Carlo_tree_search

 

Every playout has 4 steps, and the UCT is applied at Selection step, to find a balance between exploration and explotation. I think exactly the same you are saying but with other words :) 

 

Thanks for the explanation anyway. You have clarified me some things. I would like to try RAVE and heavy playouts but this game is my Bachelor's final project and I don't have so much time :( Anyway, when I'm done with it, I'll keep enhacing my AI in my free time.

 

Thanks again!

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0