Final Project

In the final project you’ll train a neural network to play supertuxkart. We provide you with a python interface to supertuxkart, the interface will give you information about the game and an image of the screen. You can send 6 actions back to the game (accelerate, brake, steer left, steer right, fire, use nitro).

You are free to design your agent as you see fit, as long as it involves a deep neural network somewhere in it’s decision process. It doesn’t need to be fully end-to-end trainable, but is certainly encouraged.

Getting started

We will play a single race track (lighthouse). The goal is to complete the race track once under 5 minutes.

The starter code is available here: https://github.com/philkr/supertuxkart.git

To build it use:

git clone https://github.com/philkr/supertuxkart.git
svn co https://svn.code.sf.net/p/supertuxkart/code/stk-assets
cd supertuxkart
mkdir build
cd build
cmake .. -DBUILD_RECORDER=off
make -j4
cp bin/supertuxkart ../pykart/

We tested the code on one of the lab machines and it should compile. You can also use the binary that has been compiled for the lab machines.

Once the code is compiled, you’re ready to use the pykart interface to play supertux kart using python. PyKart will give you an image and basic information about the game state (see pykart/__main__.py for an example). Whenever you’re ready to interact with the game call the step function. The step function expects an action, which is a bitmask of the following values:

See a the supertuxkart documentation, or tutorial for the meaning of the actions. You can perform multiple actions at once (e.g. 4|1 = 5 means accelerate and steer left)

You can modify the starter code as you desire to train your model. However, during testing we expect you to hand in just a single python file that interacts with a vanilla pykart interface.

You have to be locally logged into a machine to use pykart, it won’t run over ssh. However, it should compile just fine for any linux and mac.

This code might help you get started

from pykart import Kart

K = Kart("lighthouse", 300, 200)
K.restart()
K.waitRunning()

# Pick your favorite number of iterations here
for i in range(10000):
  state, obs = K.step( 4 ) # For now we just accelerate and crash
  # state is a dict with the internal game state
  # obs is a 300 x 200 x 3 uint8 image
  # Your job is to figure out what action to perform in the next step.
  # Note unlike pytux, pykart is not synchronized. If it takes you too to make
  # up your mind here, your action will be applied with a certain delay.

Flash presentation

Due date: Dec 4, in class

You will present your main idea to the rest of class. Be prepared to give a 3 min presentation on your main idea, and why you think it’s awesome. Slides are optional. All the members of the team need not present.

Deliverables

Due date: Dec 4, 11:59pm

Competition

Due date: Dec 6, in class

We have a tux kart competition on the last day of class. Each team should bring a laptop capable of playing the game. If you do not own a laptop you may use a lab machine, but please let us know in advance. Logistics to be figured out.

Grading

100 points in total

 def extra_credit(top3):
	# The list top3 contains the team sizes of the top 3 teams in decreasing order of their positions in the competition.
	start = 15
	credits = []
	for team_size in top3:
		credits += [np.mean(list(range(start, start - team_size, -1)))]
		start = start - team_size
	return credits

Groups

You are allowed to work in groups of up to 6 students. You can deliver one presentation, and enter the competition together. Inform the TAs by Nov 27th, if you work in a group.

Data Sharing

You are allowed to share the data among your classmates. However, data sharing can not be done with other groups selectively, it has to be done with the entire class. For this create a Google drive folder (use your UT account for avoiding space requirements), put your data in the folder and share it on Piazza. The rest of the class can then also add their datasets in the same folder to make it accessible for the whole class. You would also need to mention in your report if you used the shared dataset or only your own.