1 / 18

Assignment 1 – Mazewar Review Session

Assignment 1 – Mazewar Review Session. CS244B Distributed Systems April 4 th , 2014 Wei Shi, Stanford University. Agenda. Logistics Mazewar Game rules Protocol design Implementation. Logistics. 0% Teams : due April 4, 2014, 11: 59pm - Jointly

aislin
Download Presentation

Assignment 1 – Mazewar Review Session

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Assignment 1 –MazewarReview Session CS244B Distributed Systems April 4th, 2014 Wei Shi, Stanford University

  2. Agenda • Logistics • Mazewar • Game rules • Protocol design • Implementation

  3. Logistics • 0% Teams: due April 4, 2014, 11:59pm - Jointly • 40% Design: due April 10, 2014, 11:59pm - Jointly • 40% Program: due April 21, 2014, 11:59pm - Individually • 20% Questions: due April 21, 2014, 11:59pm – Individually • Demo tentatively the week of April 21 • Will post sign-up sheet on Piazza • Local students: in myth clusters(Gates basement) • SCPD: at least one member comes to campus; others join remotely

  4. Game Rules • Rat control • (Done) Movement with a,s,d,f • (Done) Peek left/right with Mouse Left/Right button • Launch missiles with Mouse Middle button • Scoring • Shoot projectile: -1 • Hit opponent: +11 • Opponent hits you: -5 • Player’s view • (done) Map view that shows other players • Rat’s view that shows missile

  5. Game Rules • Only one rat can occupy a square at a time • Rats hit by others should respawn at an unoccupied random location instantly • Cool-down time for firing (time up to you) • Multiple missiles can occupy the same space (speed up to you) • One projectile can hit at most one rat

  6. What You are Given • Implementation of the graphics • Implementation of the basic control • Stub code for setting up UDP multicast • Event loop (void play())‏ • Receives Packets • Keyboard events • Timer events (EVENT_TIMEOUT) • Default is 500ms, defined in winsys.cpp

  7. What You Need to Edit • netInit()‏ • Stub networking code in place • Most of your work will be editing play()‏ • Main event loop • Receive packets and update local state • Change local state and send packets

  8. Protocol Design • Team creates protocol, members implement individually • At most three team members • Must be distributed • Can't have central point of failure • Over UDP Multicast • Must deal with lost packets in a reasonable way

  9. Protocol Assumptions • Players know the UDP multicast group for the game • No cheating • One standard maze • One game per UDP multicast group • Defined as MAZEPORT in mazewar.h • To be posted on Piazza after team registration

  10. Protocol Hints • Determine shared state • Which state is shared by which clients? • How will sufficient consistency be maintained? • Who are the readers/writers of each piece of state? • Create the protocol which will define • Syntax - clients agree on format of messages • Semantics - clients agree on meaning of messages • Timing - clients agree on timing semantics

  11. Protocol Hints • Use network byte order(use htonl(), etc.) • When are ACKs needed? • As opposed to "fire and forget" packets • A believes he shot B. Do they need to agree? • A, B both believe they shot C. What do they do? • Joining / Exiting game • How do players discover each other? • How should failures / network congestions be handled?

  12. Protocol Hints • There’s absolutely no globally synchronous clock • Ensure inconsistencies don't accumulate • Think about the tradeoff of the size or frequency of the packets

  13. Protocol Example Latex: \usepackage{bytefield}

  14. Implementation Hints • Look at the code early • Implement some local functionality, e.g. launch missile • Will help you think about your protocol • Starter code is heavily influenced by CS249 framework • Start testing interoperability ASAP • Test with simulated packet loss (commented out in starter code)

  15. Implementation Hints • Develop/test/grade on myth clusters • ssh –X myth.stanford.edu (enable X forwarding) • If you wish to develop locally, you might encounter errors. • Try sudo apt-get install • libxaw7-dev (if missing X11/Xaw/Cardinals.h) • libx11-dev (if missing X11/stringdefs.h or X11/xlib.h)

  16. Starter Code • ssh–X myth.stanford.edu • cd /afs/ir.stanford.edu/class/cs244b/mazewar • cp MazewarSpring2014.tar.gz ~/<your directory> • cd ~/<your directory> • tar –zxvf MazewarSpring2014.tar.gz • Develop!

  17. Mazewar Demo

  18. Questions? Post your questions on Piazza https://piazza.com/class#spring2014/cs244b

More Related