Welcome to AIBirds Snap!

In order to run the Chrome version of Angry Birds which we use for AIBirds Snap!, you will have to install the offline version of the game on your computer. Please follow the instructions here to obtain the offline version. 

 

We have implemented a version of the Angry Birds AI game playing software that allows you to build your own Angry Birds AI agent without any programming experience. Please try it out, it is very easy to do. 

It is implemented using Snap!, a simple visual programming language that is very easy to learn and to use. For an introduction on how to use Snap!, please visit code.org and try some of their simple lessons for absolute beginners. Alternatively, visit the Snap! homepage, or just read the simple instructions on this page. 

The main requirement for our software to run is that you use the Chrome browser which you can download from https://www.google.com/chrome/browser/ if you don't have it installed already. Please note that our software does not work on iPad's or other tablet and mobile gadgets where Chrome does not support Chrome extensions. 

Once you have Chrome installed, please follow the next steps to get the AIBirds Snap! software working:

Step 1: Download the AIBirds Snap! extension

Please download and save the AIBirds Snap! extension. This is a small piece of software which allows you to quickly start the AIBirds Snap! software and to let your AI agent play Angry Birds by itself. It is an add on to the Chrome browser, a so called Chrome Extension. Please download the AIBirds Snap! extension from http://aibirds.org/bootcamp/ABSnapCE.zip. Once downloaded, you need to unpack the downloaded zip file (usually works by double clicking on it, or right clicking it) and remember where you saved it. The name of the folder you created is ABSnapCE. 

 

Step 2: Install the AIBirds Snap! extension

The next step is to add the AIBirds Snap! extension to the Chrome browser. Please start the Chrome browser and copy the following URL: chrome://extensions into your browser navigation bar. You will then see the following options: 

Loading Chrome extensions

Please check the box "Developer mode", you are now a developer. Then click on "Load unpacked extensions..." and navigate to the folder ABSnapCE that you created earlier. Mark the folder (with a mouse click on it) and then click "Select" in the bottom right corner of the file navigation window. 

Now the AIBirds Snap Extension has been loaded into the Chrome browser and you only need to activate it by checking the "Enabled" check box next to it: 

The loaded Angry Birds Snap extension

Once the extension is enabled, you will see a red square at the top right corner of your Chrome browser, next to the navigation bar. (If you want to disable the extension, simple go to chrome://extensions again and uncheck the "Enabled" box next to the Angry Birds Snap! extension.)

Now you are ready to use the AIBirds Snap! software to build your own Angry Birds AI agent! 


Step 3: Start AIBirds Snap!

In order to use AIBirds Snap! please click on the red square on the top right of the Chrome browser. It allows you to "Open Snap" or to "Open Angry Birds". Click on "Open Snap" to load a new Chrome window that contains a sample Angry Birds AI agent implemented using Snap! just like the following image:

The Angry Birds Snap! agent 

 

Step 4: Use the AIBirds Snap! AI agent

The AI agent requires three pieces of information in order to play Angry Birds:

  1. Shoot with a high or a low trajectory?
  2. When to tap? This is determined as the percentage of the trajectory in horizontal direction to the target. For example 50% means that the agent taps half way to the target
  3. Which target to hit? 

We provide a number of Angry Birds specific blocks that you can use to determine the answer to these questions. For example you could select a "random pig" as the target, or the "rightmost pig", or the "leftmost wooden supporter of the highest pig". The task is to design a set of Angry Birds game playing strategies that work for any Angry Birds level. 

The following image shows you an example Snap! program. The top block with the green flag is used to start the agent, followed by a "forever" block which repeats your program forever until the red stop button is pressed. The green flag and the red stop button can be found at the top right of the Snap! window. In this example, the first "if...else..." block determines when to tap depending on the bird type. Here the agent taps at 85% if the bird is yellow and at 75% otherwise. The second "if...else..." block determines whether to shoot with a high or a low trajectory. We use a random number generator to decide whether to shoot with a high or with a low trajectory. In case we select a high trajectory, we set the target to a random pig, which must always exist. 

In case we shoot with a low trajectory, our target selection in this example is a bit more complicated. We first test if our intended target object exists. In this case it is the leftmost wooden supporter of the leftmost pig, where the supporter is reachable with a low trajectory. A supporter is a block that directly or indirectly supports a pig. If it does exist, we shoot at it, if it doesn't exist, we select the leftmost pig as our target. By default, the target point is the centre point of the selected target object. In order to have some randomness in our shot, we then randomly adjust the target point by a few pixels both in x and in y direction. Positive x is to the right, positive y is down. Finally, we shoot using the previously selected choices of trajectory, tap point and target object and wait a few seconds, before the program is repeated. The agent automatically moves on to the next level once a level is solved and reloads a level if it is not solved. 

A Snap! program

You can change the values inside the blocks or replace blocks with other blocks, add more blocks, etc. It is recommended to add some randomness to the different selections you make (trajectory, tap point, target selection, target adjustment), just like we do for trajectories in the example. Otherwise you always make the same shots, which could lead to a dead end if the selected shots are unsuccessful.

The Angry Birds specific blocks can be found by clicking on the blue "AIBirds" button on the top left of the window. There are also the other standard categories such as variables and operators. In order to use any of these blocks for your program just click on a block and drag it to the area in the centre of the screen or directly snap it in the desired position in your program. It is best to play with it a bit to see how you can put the blocks in place and remove them again.

The following image shows all AIBirds specific blocks. The ones with pointy ends return either true or false, depending on whether the selected condition is satisfied. These can only be snapped into other blocks that expect a true/false value. For each "set target" block, there is a "test target" block that allows you to test if the selected target condition results in an actual target. For example, if there is no wooden block, but you set the target to a wooden block, then the selected target is empty. By default, whenever the target is empty, the agent shoots at a random pig. You can test if a target is reachable with a high or with a low trajectory, but note that only reachability of the centre point of an object is tested. Reachability means that the target object can be directly hit by a bird with the selected trajectory without hitting an obstacle. Obviously this can change if you activate the birds special power by tapping.  

AIBIRDS blocks

Once you have built your own strategy, please press the green flag at the top right corner of the window to start the agent. If you have not yet opened the Angry Birds game in your Chrome browser, you will now be asked to open a window. 

Now sit back and watch how your AI agent plays Angry Birds. While observing your AI agent, think of ways of how to improve it and experiment with the blocks and their settings. Remember that the main challenge is to design strategies that work for any Angry Birds level. 

Note that when you click on the red square of the Chrome extension while the agent is playing, you will be able to see the output of the image segmentation. This is exactly what the agent can see and what game objects it can recognise. When you move the mouse inside this image, the coordinates of the mouse pointer within the image are displayed. 

Have fun! 

 

Jochen Renz, Peng Zhang, XiaoYu (Gary) Ge, Steve Gould, and Steve Blackburn 

Australian National University

 

Please send us your feedback to This email address is being protected from spambots. You need JavaScript enabled to view it.