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:
- STEER_LEFT (1)
- STEER_RIGHT (2)
- ACCEL (4)
- BRAKE (8)
- NITRO (16)
- DRIFT (32)
- RESCUE (64)
- FIRE (128)
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
- You should hand in your code, as a python file and any model checkpoint and parameters it uses. You do not need to hand in the starter code again (it’s fairly large).
- A 2 page writeup describing how you managed to play tuxkart, preferably using the CVPR 2018 stylesheet. The writeup should contain * An intro and abstract outlining the method you chose and why it’s better than alternatives. * A technical section, with a detailed overview of your method. * A thorough evaluation of any aspects of your method. Try to justify every choice you made either with a sound argument.
- A recording of you agent playing the level for reference.
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
- 25pts originality of idea: How many things did you try? Do you understand what makes tux drive?
- 25pts linear grading based on track completion time between 10 mins and 5 mins. You will get the full 25 pts if your tux kart completes the track in less than 5 mins. Similarly, you will receive 0 pts if it takes more than 10 mins.
- 25pts writeup: Structure of the writeup, exposition, how well is the idea motivated and explained.
- 15pts presentation
- 10pts participation in competition (you need to be physically present and have your kart move)
- 15 pts maximum extra credit for top 3 teams in the competition. The extra credit for the top 3 submissions will be dependent on their team size and can be given by the following python snippet
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.