-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LambdaMUD--Anthony Greb #131
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anthony, you have a very solid project here. Only things I might highlight are you should be careful about putting your secret key in committed code and you should commit your code more frequently and with more detail. Currently you have only three commits in your commit history but you want to add one every time you add a new feature (e.g. a new method, structure, file or creation of a group of variables). All the same, this looks great, good work here!
player_id = player.id | ||
player_uuid = player.uuid | ||
data = json.loads(request.body) | ||
message = data['message'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's small thing, but have you thought about how you'd handle the case in which the user sends a blank message, or a message with malicious code?
@@ -45,3 +45,5 @@ | |||
p.currentRoom=r_outside.id | |||
p.save() | |||
|
|||
cfe1913928b90b3516e9981d7f3cd76524ecc870 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is your secret key? Why the choice to store it here?
Adventure Project Week
This week you'll be implementing a frontend interface for a multi-user
dungeon (MUD) game called LambdaMUD. The backend is partially written
but needs to be completed.
Using API requests, clients are able to create, read, update and delete
data on remote servers but what if the server needs to initiate a
request to the client? Say, to alert them that another player has
entered their room or that they have received a chat message. This is
where WebSockets come in.
WebSocket is a computer communications protocol, providing full-duplex
communication channels over a single TCP connection. You will be using
the Pusher service to handle the WebSocket connections for your project.
You can read more about them here.
You are to treat this week as if you are working at a company and the
instructor is your client. The project managers will be your main
support throughout the week.
The main objective of this week is to develop the MVP feature set listed
below using any other technologies you have learned here at Lambda
School. There are design files in this repository you should use as a
creative guide.
Git Commits
This will let your project manager know where you are and if you need
help. This also allows the client to get progress reports from the
company in a real world setting.
Trello Set Up:
backlog
,To Do
,In Progress
, andDone
To Do
list with the MVP features listed belowbacklog
list with all the extra features listed belowhttps://trello.com/b/62H8aKgt/lambdamud-anthony-greb
MVP Features:
Client
say
command to say things that other people in the room will see (server implementation incomplete)p-channel-<uuid>
broadcast
events and display the messages to the playerServer
say
which broadcasts a message to other players in the current roomGeneral
Upon your first commit, please submit a Pull Request and add both the
Trello Set Up and MVP Features Task lists to your first Pull
Request comment:
Once you have completed the Minimum Viable Product requirements,
direct message your project manager for approval. If approved, you may
continue working on the Extra Features.
Once your MVP has been approved, you have been given a feature list that
the client would love to have completed. Your goal would be to finish
MVP as soon as you can and get working the list of features.
Extra Features:
shout
command that broadcasts a message to every playerwhisper
command that sends a private message to a single playerDirections
Set up a Pusher account
Set up your local server
Set up your virtual environment
pipenv --three
pipenv install
pipenv shell
Add your secret credentials
.env
in the root directory of your projectRun database migrations
./manage.py makemigrations
./manage.py migrate
Add rooms to your database
./manage.py shell
util/create_world.py
into the Python interpreterRun the server
./manage.py runserver
Test API commands
Registration
curl -X POST -H "Content-Type: application/json" -d '{"username":"testuser", "password1":"testpassword", "password2":"testpassword"}' localhost:8000/api/registration/
{"key":"6b7b9d0f33bd76e75b0a52433f268d3037e42e66"}
Login
curl -X POST -H "Content-Type: application/json" -d '{"username":"testuser", "password":"testpassword"}' localhost:8000/api/login/
{"key":"6b7b9d0f33bd76e75b0a52433f268d3037e42e66"}
Initialize
curl -X GET -H 'Authorization: Token 6b7b9d0f33bd76e75b0a52433f268d3037e42e66' localhost:8000/api/adv/init/
{"uuid": "c3ee7f04-5137-427e-8591-7fcf0557dd7b", "name": "testuser", "title": "Outside Cave Entrance", "description": "North of you, the cave mount beckons", "players": []}
Move
curl -X POST -H 'Authorization: Token 6b7b9d0f33bd76e75b0a52433f268d3037e42e66' -H "Content-Type: application/json" -d '{"direction":"n"}' localhost:8000/api/adv/move/
{"name": "testuser", "title": "Foyer", "description": "Dim light filters in from the south. Dusty\npassages run north and east.", "players": [], "error_msg": ""}
<name> has walked north.
<name> has entered from the south.
Say (NOT YET IMPLEMENTED)
curl -X POST -H 'Authorization: Token 6b7b9d0f33bd76e75b0a52433f268d3037e42e66' -H "Content-Type: application/json" -d '{"message":"Hello, world!"}' localhost:8000/api/adv/say/
<name> says "Hello, world!"
Deploy server to Heroku
heroku config:set KEY=VALUE
heroku run python manage.py shell
)Client Frontend
init
request upon loading game view to receive the player's starting location and uniqueid
p-channel-<uuid>
and bind tobroadcast
eventsbroadcast
messages by displaying them to the player@Dilstom