Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Using ML-Agents for a 2D card game.

Discussion in 'ML-Agents' started by Prokage, Apr 18, 2021.

  1. Prokage


    Apr 18, 2021
    Hey, I'm brand new to ML-Agents and only slightly experienced with AI. My master thesis is on solving a social card game with reinforcement learning and I was thinking about creating the environment on Unity and leveraging ML-Agents for this task.

    My question is, is this feasible? Most of the examples I've seen take in visual observations and the decisions are physical movements of an agent, but in my case it would just be a 2D top down view of a board and an agent making a decision when it comes to its turn based on the environment and actions of the other players up until that point (the opponents will be heuristically hard coded with how they play, with self play being implemented once the agent becomes good enough).

    If it is feasible and something similar has been done before in a tutorial (or the closest thing that I can adapt for my use case), I would really appreciate a direction to it being implemented. Thanks in advance unity gang!
  2. mamaorha


    Jun 16, 2015
    Why visual? U can collect observations based on the "game variables" u defined, its a closed data with small amount of options.
    What cards i have, what cards are on the board etc...
    Prokage likes this.
  3. ruoping_unity


    Unity Technologies

    Jul 10, 2020

    Overall from your description it sounds feasible to do. ML-Agents provides you different ways to collect custom observations so it doesn't have to be visuals. For 2D observations we have camera sensor, grid sensor, Match3 sensor or you can customize your own. For actions, you can do on-demand decision making for turn-based game, which means it doesn't take action every step but only when it's required to take an action.

    The closest example we have is Match 3 games - 2D top-down board view, turn based game. You might need to modify things like board settings and action moves, but it should be a pretty good starting point.
    twobob and Prokage like this.