CM10228 / Programming Ib:   Assignment 2  (2010)

Networking & Concurrency:  Crowding the Labyrinth of Dooom

Assignment Date:  Tuesday,  9 March  Due date:  Tuesday,  23 March at 10:00 AM


This assignment is the first of four you will have in this course.  Your mark in Programming Ib is composed of 50% coursework, 50% exam.  This assignment is worth 10% of your final mark for the unit. The assignments will be:




Mark
Handed Out
Due
1
Labyrinth of Dooom:  Reading & using maps 10%
23 February
9 March
2
Labyrinth of Dooom:  Networking and multiple concurrent agents in one dungeon 10%
9 March
23 March
3
Labyrinth of Dooom:  GUIs to show your friends & family 25%
23 March
16 April
demoed in lab 19-23 April
4
Back on the surface:  Databases & The Web 5%
20 April
done in lab 26-30 April
demoed in lab 3-7 May

Exam
50%
May

Objectives:

This assignment brings you further adventures in the Labyrinth of Dooom.  The second coursework emphasises networking and concurrency.

You will continue to expand the game you built in Coursework I, which you should now be able to play either from the command line or with an AI bot.  The objective of the game is still to gather enough gold that you are able to exit the dungeon, and then to exit it.  However, now there will be multiple players in one dungeon, so there may be some competition for that gold.  Alternatively, if you like, you can invent collaborative projects, such as seeing how quickly you can have multiple players solve a large dungeon together, or providing human-controlled bot guidance for an artificial-partially-intelligent bot.

The primary objective of this coursework is to introduce you to networking and concurrency.  
  1. Networking:  You will split your previous coursework up into one server, which loads the map and gives feedback on the game, and (at least) two clients, one of which allows you to play the game, and one of which has your bot play the game.
  2. Concurrency:  You will be able to play either with or against your bot in the same dungeon.  You should also be able to support your friends and their bots joining you in the dungeon.
Notice that now that you will have more players in your dungeon, you will also have the chance to exploit more aspects of the game -- for example, the performance of weapons, armour and health potions.  You may be tempted to therefore improve your AI bot, or to make multiple AI bots to have them play with or against each other.  Please notice that improved AI is not an objective of this coursework.  This coursework is meant only to ensure that you are competent at networking, concurrency and also error checking, in advance of your third and most significant coursework, which will use GUIs.  However, there is one minor AI goal of this coursework:
This coursework will be marked entirely in the laboratory.  There you will provide a demo, and if your networking & concurrency work, we will ask you to find your bot in the dungeon.  You will have an opportunity to demonstrate an interaction with your bot (e.g. hurting it or helping it), but this must be quick.  The demo should be just 5 minutes total, including starting up the server and clients.

You will not get detailed feedback on your code in this coursework.  You will be demoing your coursework in lab on the week of 23 March, and will receive your mark then.  Note that we are not asking for any documentation of your requirements-gathering & design phase for this coursework, but you may find that doing these properly still helps you perform your task, regardless of whether anyone looks at the output.  You may also want to show a spec to the tutors in lab in the early stages of development, just to get feedback about whether you are on the right track.

Warning:  If you are assigned to Monday's lab, you will be reallocated to another laboratory for marking the week of 22 March only.  You should attend laboratory on 22 March to receive your allocation.

You are encouraged to use the eclipse IDE in programming and debugging your code.  However, your code must run from the command line.  This is how we will be marking it.   The code should be platform and operating-system independent.  It should run in Java 1.5.  To be safe, you should probably test that your code works on one of the BUCS unix servers

This assignment is expected to take the average student (one who got about 58 in Programming I) about 15 hours.  As mentioned in class, this is a double unit, so it is expected you spend at least 12 hours a week of self-study on the course, besides the two hours in lab and the two hours in lecture.  We expect you will spend 7.5 self-study hours a week for the next two weeks on this assignment, in addition to the two hours you have in lab.  (Notice this still leaves you plenty of time for lecture preparation.)   Because programming takes different people radically different amounts of time, some students will spend something more or less than 15 hours on this assignment.

An important note on plagiarism:  Plagiarism occurs any time that you use someone else's ideas without acknowledging them.  Plagiarism is much, much worse than asking for help -- in fact, asking for help isn't bad at all.  If you get help on any part of your assignment you should acknowledge this in the comments.  This includes asking coursemates, tutors, or other staff questions, and of course any code or ideas you get from  books or the Internet.  Say exactly where your ideas came from, and exactly how much of the code you hand in is your own. 

What to do:

Note:  You need to do all these steps to make sure you get full marks.   You can probably pass this coursework if you only get as far as 3 or 4, but do a very good job on these.  See how you will be marked.
  1. Take LODGame and LODMap, and wrap these as a Server.  See the lecture notes on networking -- you are free to copy code from them, provided the source is properly acknowledged.
    1. Note, you need to use a new LODGame which is provided on Moodle.
    2. If you want to have any effect if you attack something, be sure to modify clientAttack() in LODGame.  See the comments in that file.
  2. Wrap PlayGame as a Client.  The client & server should communicate using the protocol provided in Moodle.  Be sure to have the client also print things out to your terminal screen, so you can see what you are doing when you play the game.
  3. Debug your new client & server. 
    1. This may be hard -- be sure to do this in good time so you can take your code to lab if necessary & get help from the tutors.
    2. You will probably want to write some test code to make sure that your client & server are doing what you think they should.
  4. Make your AIbot into a client too.  This should be easy if you have already made your other working client.
  5. Improve your server to take multiple clients.  Note that you will want to protect access to your map (and any other shared data) via either sychronize or using Semaphore.
  6. Modify your AI bot to make sure it is playable (see earlier in the spec).
  7. Practice your demo in advance of the tutorial.
  8. Invite some of your coursemates to try their clients on your dungeon, so you can be certain that you got the protocol right.

What to hand in:

  1. Note:  For this lecture you do not need to physically hand in anything.  You need to upload your code to demonstrate you have met the deadline.  You should bring a hard copy of the code along with you to your assigned marking session, so that the tutors can help you debug it.
  2. A printout of your fully-commented code for all the classes you wrote or altered.
  3. A zip file containing uncompiled versions of your code.
  4. In your demonstration, you should be able to connect your bot to your dungeon, leave it running, and enter the dungeon yourself through your client. 
    1. Your demo should be five minutes long, including starting up the server & clients.  You should practice this.
    2. You will get a few marks for interacting with your bot in some way.
    3. The tutor will also be connecting a client to your server, so you must maintain the standard protocol.
Remember, marks are not given just because a program compiles or runs.  It should run robustly, and it should be well commented and well documented as specified above.

How you will be marked:

The marks allocation for this assignment is as follows:
  1. Code legibility & comments. 20% 
  2. Correct error checking 20% 
  3. Everything works 60 % 
Total 100%

Threshold for Pass (40%+)
  1. Basic networking functions: able to demo connecting user client to server, playing the game.
  2. Basic concurrency & protocol functions: tutor able to connect an additional client with the standard protocol.
  3. Code is properly formatted & commented.
Good Pass (~55%)
  1. Meets all the criteria of a threshold pass.
  2. Demonstrated interaction between user and AI bot is clearly visible to a casual observer.
  3. Correct use of semaphore.
Distinction (70%+)
  1. All criteria of a good pass are met.
  2. Demonstration is sophisticated and entertaining, and within requisite time limit.
  3. Code structure is clear & easily comprehensible in a quick overview.

Marks Table:

Note:  Because this coursework is marked in lab, all marks will be to the nearest 5 points (e.g. for Formatting you can get 0, 5 or 10 marks).


Specific Criteria Marks
Out Of
Code Legibility
Formatting
                       
10

Commenting

10




Functionality
Networking (one client & server communicate)

20

Concurrency (two clients can connect)

10

Semaphore (present, no collisions)

10

Protocol (tutor can add & control a bot with own client)

10
Demonstration AI bot moves at visible rate
10

User & AI bot interact 
20




Penalties
e.g. does not compile,
difficult to test, failure to encapsulate
client from server, platform dependencies

Explanation:


(20)




Total


100


page author: Joanna Bryson
3 March 2010 (checked by MDV 5 March 2010)