Answers.Body: <p>The state space is certainly continuous, assuming that you can somehow feed that AI exact coordinates. You may have to resort to CNNs if you do not have access to this information. For the action space, you should consider how the game actually plays. Since you use a mouse to simply show the direction, you could use (x,y) positions of the mouse as an action, or even just the angle <span class="math-container">$\theta$</span> of the mouse cursor in a circle around the agent. If you are playing on the site, then your observations would have to be from a CNN, it should be possible to use the score as your reward, as well as the possibility for eating things or distance from opponents that are bigger or smaller as intermediate rewards. The number of nodes in your network is something that you must find experimentally, you may like to research what kind of architectures other people have used in this field. You shouldn't need to account for different numbers of players. Nothing special needs to be done to get a single node giving a continuous output to represent the angle <span class="math-container">$\theta$</span>, or alternatively two nodes representing x and y. You can then use tanh or sigmoid to limit the output node values for eject and split actions.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-10-18T05:46:58.583Z
Answers.LastActivityDate: 2020-10-18T05:46:58.583Z
Answers.UserDisplayName: Cameron Chandler
Body: <p>I am trying to implement an AI bot for my Agar.io clone using deep neural network.<br />
  However, I am struggling with the state and action space of the AI bot.<br />
  Because the bot can take real number for position and velocity, can I say the state space is continuous?<br />
  For the action space, I am thinking something like (velocityX, velocityY, &quot;split to half&quot;, &quot;eject mass&quot;).<br />
  What should be the number of input nodes in the input layer for my Neural network? And what are those input(observations, rewards)?<br />
  As the number of players and AI bots are changing, how can I train a dynamic network with changing input node number?<br />
  For the outputs, how can I get a continuous action output like velocity?</p>
  <p>As a reference, you can learn about the game rules from this short youtube video:<br />
  <a href="https://www.youtube.com/watch?v=xAry4_9yuis" rel="nofollow noreferrer">20 Rules and Game Mechanism of Agar (How to Play Agar.io)</a></p>
  
Tags: <neural-networks><reinforcement-learning><deep-learning><game-ai>
Title: How to define Agar.io state and action space?
UserDisplayName: Martin M
ThreadText: # How to define Agar.io state and action space?
  
  (Asked by: username_0 on 2020-10-17)
  
  I am trying to implement an AI bot for my Agar.io clone using deep neural network.  
  However, I am struggling with the state and action space of the AI bot.  
  Because the bot can take real number for position and velocity, can I say the state space is continuous?  
  For the action space, I am thinking something like (velocityX, velocityY, "split to half", "eject mass").  
  What should be the number of input nodes in the input layer for my Neural network? And what are those input(observations, rewards)?  
  As the number of players and AI bots are changing, how can I train a dynamic network with changing input node number?  
  For the outputs, how can I get a continuous action output like velocity?
  
  As a reference, you can learn about the game rules from this short youtube video:  
  [20 Rules and Game Mechanism of Agar (How to Play Agar.io)](https://www.youtube.com/watch?v=xAry4_9yuis)
  
  **Tags:** neural-networks, reinforcement-learning, deep-learning, game-ai
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-10-18. Score: 3
  
  The state space is certainly continuous, assuming that you can somehow feed that AI exact coordinates. You may have to resort to CNNs if you do not have access to this information. For the action space, you should consider how the game actually plays. Since you use a mouse to simply show the direction, you could use (x,y) positions of the mouse as an action, or even just the angle $\theta$ of the mouse cursor in a circle around the agent. If you are playing on the site, then your observations would have to be from a CNN, it should be possible to use the score as your reward, as well as the possibility for eating things or distance from opponents that are bigger or smaller as intermediate rewards. The number of nodes in your network is something that you must find experimentally, you may like to research what kind of architectures other people have used in this field. You shouldn't need to account for different numbers of players. Nothing special needs to be done to get a single node giving a continuous output to represent the angle $\theta$, or alternatively two nodes representing x and y. You can then use tanh or sigmoid to limit the output node values for eject and split actions.
  
  
  ---
  
  