As decided by roughly a ⅔ majority vote of those in class on November 7, our final project will be a distributed text-based adventure game in the spirit of Colossol Cave or Zork.
This page assumes you have implemented and understood the closely-related MP 10.
You may start working on this project by copying your MP10 solution, renaming domain.py
as newdomain.py
, and modifying those files.
We provide starting files in project.zip:
newdomain.py
, mostly blank, in case you want to start over instead of copying MP10’s domain.py
1 Starting over might be helpful, allowing you to benefit from the design principle of plan to throw one away.I wrote up how I’d do it if I was starting over which might be helpful to those doing a redesign.
hub.py
, like MP10’s but with more featuressubmitcode.sh
to help with submitting from your course VMMakefile
with make start
, make background
, and make stop
targetsYou will need to submit a file named newdomain.py
The sections below are outlined in the order we recommend completing them. First refactor your MP10 to allow multiple users, then implement /depart
’s 409 responses, and so on.
Track one copy of game state for each user that /arrive
s.
Nothing that one user does should impact the game experience of other users.
Test multi-user experience by opening up two web UIs at once in separate browser tabs or windows.
New hub
Multiple users also requires some hub support not present in MP10’s hub. This support is present in hub.py found in project.zip.
When a user leaves the domain the hub will send you a /depart
message with the user’s ID. You should refuse to answer commands from that user until they again /arrive
.
The data provided to /arrive
will include a new field, "from"
. This will be one of six possible values:
"login"
if they just logged in and this is their first domain
"north"
, "south"
, "east"
, or "west"
if they journey
ed from that direction.
In other words, if the user arrived after saying journey east
, /arrive
will get "from":"west"
.
"direct"
if they journeyed to the domain by name or ID.
The entire domain should be accessible from any arrival type. Do not have puzzles that have to be solved by journeying to the domain from the north or have users coming from the east get different items than users coming from the west.
Journey limitations
The hub server will create a map of domains which may have borders or gaps. Because of this, journey south
may return a response like You can't journey in that direction
with neither a /depart
nor an /arrive
being generated.
Handle departures and arrival’s from different directions
/depart
endpoint that returns status 200./depart
ed more recently than they’ve /arrive
d, return 409-status responses to all commands until they next /arrive
./arrive
’s "from"
to make your domain more location-aware.New hub
/depart
is not sent by MP10’s hub. It is sent by the hub.py found in project.zip. "from"
is not sent by MP10’s hub. It is sent by the hub.py found in project.zip.
Make a new domain, with multiple locations and items.
Distribute at least one depth-0 and one depth-1 item for others to host.
Have at least one location each to host depth-0, depth-1, and depth-2 items.
The domain should be of non-trivial complexity. This is a fuzzy measure, but here are some rough guidelines:
believable.This doesn’t need to be realistic (fantasy and science fiction elements are fine, for example) but it shouldn’t be nonsenical chaos.
A user can’t lose
: the domain should remain solvable no matter what the user does.
This does not mean you cannot cause items to disappear
: it is fine, for example, to /transfer
and item to some nonexistent location like "gone"
. However, if you do that then there must be some way to access the full domain without the item.
Secret areas do not need to follow these rules.
A user can solve the domain using only in-game information.
You should not make a puzzle depend on knowing how UIUC campus is laid out or the specific gravity of linseed oil or the professor’s hairstyle.
Secret areas do not need to follow these rules.
Verify that your domain
/newhub
, including at least
"prize"
s during /arrive
New hub
MP10’s hub doesn’t follow all the depth rules outlined above. They are followed by the hub.py found in project.zip.
The project’s hub.py will randomly pick one depth (either 0, 1, or 2) to give 2 items.
We have a page explaining more about depth
When a user completes your domain, send the hub a /score
message with value 1:
"domain": ... # your domain ID
{ "secret": ... # your domain's secret
, "user": ... # the user's ID as given in /arrive
, "score": 1.0 # the user's score in this domain
, }
You are welcome to also give scores between 0 and 1 if you wish.
Keep and report score.
/score
with "score":1.0
to the hubNew hub
MP10’s hub doesn’t have a working /score
endpoint. project.zip’s hub.py does.
You may chose to add secret areas to your domain. A secret area has the following properties:
It is not obvious from normal play that the secret even exists.
You have some some clues, or can have it fully unadvertised.
The content accessible via the secret is significantly smaller than the main part of the domain.
Each secret a user discovers gives them +0.001 to their score, possibly exceeding the usual 1.0 maximum.
A secret area cannot host items for other domains.
Secrets areas have exceptions to some of the Creative Domain rules. Even if there are secret areas, those rules continue to apply outside of the secret.
The code you upload must match the code you run during the project checkoff.
Submit your code
newdomain.py
to the upload pageEach domain must provide at least one item of depth 0 and one item of depth 1 to the hub during /newhub
to be hosted by other domains.
Each domain must have at least one of each of the following
A location to store depth 0 items it hosts for other domains.
These items must be accessible by visiting the domain alone; they cannot be hidden behind any items hosted by other domains.
A location to store depth 1 items it hosts for other domains.
These items must not be accessible by visiting the domain alone; a user must first acquire one of the domain’s depth 0 items hosted by another domain before they can obtain any depth 1 items that are hosted by this domain.
A location to store depth 2 items it hosts for other domains.
These items must not be accessible by visiting the domain alone; a user must first acquire one of the domain’s depth 1 items hosted by another domain before they can obtain any depth 2 items that are hosted by this domain.
The hub will put copies of each hosted item in more than one domain to protect against one getting lost in a misconfigured or impossibly-hard domain. The hub will remove all other copies from its internal tracking once one of the host domains /transfer
s the item to the user’s "inventory"
. Because of this, the following sequence is possible:
/arrive
s with a given item in their list of prize
s.journey
s to another domain and gets that item there (this is invisible to your domain)./arrive
s again; the item is no longer in their list of prize
s.If you are tracking your own inventory, you should check for this condition to avoid giving them the same hosted item twice.
Item names are in general not unique.
It is quite possible that a user may get an item named "key"
in domain 1, and another item named "key"
in domain 2, and then travel to domain 3 and try to use key on lock
without first getting domain 3’s "key"
.
Your domain should use the following conventions:
Always allow users to specify items by id.
Example: take 42
should take
the item with id
= 42.
Allow users to specify items by unambiguous names.
Example: take key
should take
item 42 if item 42 is the only item in the location with name key
.
Decide whether to have actions require item IDs or item names.
Example: use axe on door
probably makes sense to work with any item named axe
.
Example: use key on door
probably makes sense to work only with one specific item named key
.
If the user does something that would have worked with a different item with the same name, give a response that makes that clear.
Example: You don't have a key that fits this lock.
If you need a specific item ID, make that item’s description
sufficiently complex to likely be unique.
Each user will get their own copy of the entire game world. In other words, when I play the game, no part of my play experience should depend on what other players are doing.
The hub will track the following information about users:
completion scoreper domain provided by domains they’ve visited in the form of a number between 0 and 1.
This will be used to display a map and scoreboard.
When a user finds something about a domain that they think is nifty, they can use the praise ...
command to leave a comment for the designer of the domain. These comments have no impact on grades, but will be given to the domain developer after the course completes.
When a user finds something about a domain that they think is broken, they can use the report ...
command to leave a comment for the course staff to look into. The report will be accompanied by the log of actions the user has taken. These reports may result in course staff removing points from the project based on failure to implement it correctly.
To help us review the reports, we will group them by their first word. The following opening words are predefined for specific purposes:
report mp10
if the domain seems to be substantively identical to MP10’s domain.report tiny
if the domain seems to have very little content.report abuse
if the domain sends strings that are abusive, triggering, or inappropriate.report broken
if the domain is violating the basic behavioral norms of the adventure, such as not showing drop
ped items or not responding to take
or look
.