0

I want to train an AI using Reinforcement Learning in python. The goal is that AI should be able to shoot moving balls come to the game env. randomly at different speeds and from different positions. The AI (player) position is fixed and it can only specify the angle of the bullet. The bullet speed is also fixed. Actually, I don't know what are the States and Actions in this continuous and stochastic environment. And please let me know if there is any tutorial available for this type of game environment. Mostly game RL tuts are about the optimal moving of AI from point A to Point B, which I think is not applicable to my problem.

Farbod.T
  • 41
  • 7
  • Here you could define states as screens pixel and your action could be changing angel and shooting. you could find the variety of tutorials based on Atari game, [here](https://github.com/DongjunLee/dqn-tensorflow) is some source code you could check. – Soroush Dec 11 '18 at 17:48

1 Answers1

0

The state would probably be a representation of where each ball is in the game environment. If the balls are different sizes, then the size of each ball would have to become part of the state as well. The action space would consist of every possible action the agent could take during a given step. This means it includes not shooting, as well as shooting in every possible angle. Therefor, the action space would look something like [don't shoot, shoot at angle x, shoot at angle y, shoot at angle z...] so that it contains every angle at which the agent cant shoot.

One library you should look into is OpenAI's gym. It's a framework for reinforcement learning within the context of video games. It breaks down the game environment and action space for you, and provides step-by-step updates of the game state, allowing the agent to take a different action depending on the state of the game environment. You can make your own environment, or look at one of the environments which already exist. They're mostly based off of old Atari games.

For example, take a look at the Asteroids environment. This could potentially operate in a very similar manner to the environment you proposed above. In Asteroids, the agent tries to avoid being hit by various asteroids moving across the screen. They can shoot at the asteroids to destroy them, and they can also move. However, if you were to force your agent to avoid taking the "move" action, it essentially boils down to a very similar problem to the one you described.

R.F. Nelson
  • 2,254
  • 2
  • 12
  • 24