text stringlengths 0 1.99k |
|---|
that any player could expose them. |
Custom clients, especially within gaming communities, inevitably bring about |
discussions of fairness. The course viewer received a fair bit of scrutiny |
for making it artificially easy to vet the difficulty of a course before |
playing, which combined with certain gamemodes in the game can give an |
unfair advantage, but the ability to identify developer exits eventually |
convinced many players of its importance in the metagame. And, with the |
normalization of the course viewer on social media and streaming sites, it |
eventually became a competitive necessity to match other players. |
--< 5. The Scrape |
Once one gets access to the feed of data it is imperative to reduce your |
reliance on it. The company that operates the feed is trying their best to |
shut you down. So I began exploring more endpoints in the hopes of querying |
all the data on the servers. |
For example course comments. They come in a number of different types: text, |
reaction images and drawings. Drawings were found to be GZIP compressed |
320x180 RGBA bitmaps, accessible from a external server. |
response = await http.get(comment.picture.url, |
headers=custom_comment_image_headers) |
img = Image.frombuffer("RGBA", (320, 180), |
zlib.decompress(response.body), "raw", "RGBA", 0, 1) |
Comments can also be placed somewhere within the course, as well as have the |
requirement of completing the course before seeing them. This endpoint gave |
insight into a creative side of the game that is usually inaccessible |
outside the official client given to us [29]. |
After almost all of the endpoints were discovered, with both their request |
and response fields documented, it was time to begin scraping. |
The key considerations behind effective scraping is: how can I request as |
much as possible, how can I remain undetectable and how can I know I am |
done. |
I first tried requesting from the endless endpoint. Endless mode is a |
gamemode that has a player complete as many courses as possible when |
starting with a fixed number of lives. One can choose to start endless in |
one of four difficulties, where every course on the servers is assigned a |
difficulty. Unless Nintendo additionally prioritizes courses given a |
specific criteria, like number of plays or ratio of likes to dislikes, this |
endpoint is mostly randomly distributed. Sounds ok, but in practice there |
are over 25 million courses uploaded. When tested this approach likely takes |
multiple years. |
And, anyway, how do we know we have all the courses anyway? Courses are |
referred to by 9 letters and numbers, with some visibly similar characters |
removed. This series of letters and numbers is just for ease of use, as it |
represents a base 30 alphabet bitwise number. This bitwise encodes whether |
the ID refers to a course or a "maker", as well as a checksum. The number is |
then XORed, which appears to scramble the ID [30]. The reason why this |
scrambling is necessary is because games utilizing the DataStore NEX |
protocol allocate new objects with a continuous incrementing ID, known as |
the data ID. |
def course_id_to_dataid(id): |
course_id = id[::-1] |
charset = "0123456789BCDFGHJKLMNPQRSTVWXY" |
number = 0 |
for char in course_id: |
number = number * 30 + charset.index(char) |
left_side = number |
left_side = left_side << 34 |
left_side_replace_mask = 0b1111111111110000000000000000000000000000000000 |
number = number ^ ((number ^ left_side) & left_side_replace_mask) |
number = number >> 14 |
number = number ^ 0b00010110100000001110000001111100 |
return number |
When converted into a course ID or a maker ID the XOR serves to hide the |
fact that the ID is incrementing, likely an attempt to prevent a sweep |
through all courses or makers for nefarious purposes. We know the algorithm, |
however, so this reversible algorithm just means there are two ways of |
representing a course or maker. |
Since it is incrementing where do we start? Not 0. The region of Data IDs |
below 3 million in SMM2 cannot be queried. With manual testing the first |
course found in the game is 4RF-XV8-WCG, data ID 3000004 uploaded on 6/27/19 |
02:05, a day before the game officially released. Using the method |
SearchCoursesLatest (method 73), which is used in game to return a random |
list of recent courses, I received a data ID close to the most recently |
allocated, at the time around 40000000. Using this approach one can query |
for 500 courses' info at once using GetCourses (method 70). Courses that |
have since been deleted, with their ID not being reallocated, return empty |
course info that could be ignored. This is the primary approach for courses. |
Next is players, or makers as they are occasionally referred, which cannot |
be queried as easily. Instead of querying players now we need to look at |
some other methods. |
In-game one can query a number of lists, like player leaderboards and lists |
of courses with a search filter. The last 1000 players of a course, |
including whether they liked and/or completed it, can also be queried. |
Course info includes the players who created, first completed and have the |
current world record, so we'll also use our potential list of 37 million |
courses here. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.