Search Unity

Question What kind of sensors would you suggest I use for this match-3/shmup project?

Discussion in 'ML-Agents' started by JesseSTG, Aug 20, 2021.

  1. JesseSTG

    JesseSTG

    Joined:
    Jan 10, 2019
    Posts:
    236
    I'm making a game that's a combination of a match-3 puzzler and an arcade-styled shmup. It will support local multiplayer, and will include an AI player that follows the same rules as the human player. I tried conventional behavior trees, but there are too many moment-to-moment considerations to make one that's useful and comprehensible. That's where ML-Agents comes in; given my needs as described in this post, what sensors should I use (or implement)?

    You can play an early build here to see what I'm talking about. But I'm not here to promote my game; I'm here to ask for opinions on implementing AI.

    Based on my understanding of ML-Agents, I'm assuming that:
    • I can add as many actuators and sensors as I want, but I'm responsible for combining them
    • The agent behavior doesn't need to be attached to the GameObject that it's controlling, as long as the agent can access it
    • Visual sensors are sensitive to the game's art
    Please correct me if I'm wrong.

    My game, in a nutshell:
    • You control a ship that can move along a grid.
    • Colored enemies descend from the top of the screen and drop colored blocks when you shoot them. They're also shooting back.
    • Match three or more blocks in a line to clear them.
    • You can grab and drop up to three blocks at once, but you're defenseless while doing so.
    • You can also catch blocks as they fall.
    • The game ends when the grid fills to the top.
    • When you die, two rows of garbage blocks are added to the bottom of the grid. Garbage blocks don't match with anything, they're only cleared when colored blocks next to them are cleared.
    A player in my game needs to be aware of the following information:
    • Their own position on their grid
    • The position and color of each block on the grid
    • The blocks that they're holding
    • The position and color of each enemy
    • The next wave that will appear (there's a Tetris-styled indicator on the screen)
    • The position of the bullet that they fired, if applicable (you can only fire once bullet at once)
    • The position of each enemy's fired bullets
    • Whether or not there's a bonus round active (the rules change slightly in the bonus round)
    • The position and type of the power-up on-screen, if any
    And that's without looking at the other player's grid to build a strategy.

    As for the player's actuators, the player can do the following discrete actions:
    • Move in the four cardinal directions
    • Fire a bullet
    • Hold a button to speed up the enemies
    There are no continuous actions.

    I believe the sensors will be a trickier problem than the actuators, simply because there's a lot of state. One thing that comes to mind is the Match-3 integration, and this does indeed seem helpful. However, it won't be enough because:
    • The player doesn't control every entity on the grid
    • Not all movement can be described as two adjacent grid cells swapping positions