This is a in-course project for Introduction to Artificial Intelligence. I chose this mini game in Starbew Valley as the target to learn.

The Game

Fishing in Starbew Valley(Source: https://yearofstardew.wordpress.com/2016/03/21/day-2-spring-2-gone-fishing/)

In this minigame, a fish-like icon moves up and down inside a vertical space. The player controls a green bar, which ascends while the left mouse button is pressed and drops while it’s not. The green bar bounces when it reaches the bottom boundary of the minigame unless a Lead Bobber is equipped. A catch meter increases while the fish is kept inside the green area and decreases while it’s not. Once the catch meter is fulfilled, the fish is caught. The fish escapes if the meter becomes empty. – Fish - Starbew Valley Wiki

The source code for this project is written in Python. Run play.py to start a simulated fishing game. Use space key to control the green bar.

RL

The training results using discrete tables(Q-learning and SARSA) are not very well. After 2000 epoches training, it still doesn’t success to catch one fish.

But Deep Reinforment Learning works well. I used 1 8-cell hidden layer and trained the model with 8000 frames human play records.

Here is the losses across the epoches. It drops after ~45 epoches.

Losses across the epoches

At epoch 1:
At epoch 100:
The model is still able to catch the fish when the fish’s max. acceleration limit is doubled: