CSC/ECE 517 Spring 2013/OSS E629
E629: Integrating game frontend for Expertiza
Project Introduction
This is a game made for the Expertiza system (Ed Gehringer, NCSU). It transforms an assignment-based course into a "game" in which the player levels up and completes areas. The player doesn't receive grades; rather, he gains experience, and the professor would convert the experience values of the players at the end of the course into grades. The map is split up into distinct "rooms" unlocked by completing assignments; these are arrayed around a "center" in the middle of the map which contains portals to each room (portals which unlock as the player progresses).
Project Requirement
Students will need to develop a page that runs the Expertiza game in JavaScript when a user is logged in and calls the code from E407 to get the JSON string to be parsed by the frontend.
The page should basically load the frontend JavaScript and point it to the JSON string (a URL that will check to make sure that the current user is logged in correctly).
Our Work
Experience Point Report
In this game, the player doesn't receive grades; rather, he gains experience(XP), and the professor would convert the experience values of the players at the end of the course into grades.
The Previous XP is a fake one, they just send the "grade" score as the XP point. So one part of work is to rewrite this part.
The new XP point system is a weighted score system, where instructor can assign or automatically generate the XP point.
The following is the code for XP point report system:
Assignment Group Modules
Assignment group module is used to
Previous assignment group from the previous project E407 is a fake module. In this version, the code to decide whether an assignment group is “available” to a student should appear in both frontend and backend, but neither of them works. So we rewrite it and assign privileges to it.
The following is the code for the assignment group module:
JavaScript Code Reconstruction
When the game is running on the Expertiza system, Expertiza should send the game the info it needs to generate the level and game state at load-time. The page should basically load the frontend JavaScript and point it to the JSON string.
Previous system get JSON by polling the server. In this strategy, the computer does nothing other than check the status of the backend until it is ready, at which point the device is accessed. In order to improve the efficiency of the CPU, we introduced Event Driven Programming (EDP) into our design. In EDP, the flow of the program is determined by events. In our case, a callback closure is called when the JSON data hit the frontend.
We also Change the ig module a little bit to support visiting module variable in closure.
The related code is as following:
Fixing Mega Bugs
Uncaught Exception
Previous JSON backend throws an uncaught exception when the user has an unsubmitted assignment and he is participating in that assignment.
We fix this bug by
The following is the related code:
Gate Name Error
Previous JSON backend didn’t set gate name correctly. Thus when having multiple assignment group (>3) and at least one hub threshold is higher than current user’s XP point, JavaScript frontend falls into infinite loop.
We fix this bug by
The following is the related code:
Assignment Group Error
In previous JSON backend, if an assignment group has X assignment in it, it will return X copy of that an assignment group, thus there’ll be X*X assignment in total. X times greater than it should be.
We fix this bug by
The following is the related code:
Fixing Minor Bugs
- Previous backend send all assignment data to frontend even if the student is not participate in the assignment.
- Previous JSON backend didn’t set MIME type correctly. That result in frontend code can only use low layer API to capture JSON data, when using high layer API, a silent error will occur.
- Previous MIME type result in IE and Chrome has different behavior.
- Sending a JSON string “null” to frontend will make it stop responding.
General Introduction to the System Setup
Please follow these steps to setup the program:
a) Download and deploy the code from http://commondatastorage.googleapis.com/silverwzw/expertiza-json.zip
b) Drop the database “pg_development”
c) Create an empty database “pg_development”
d) Run “db:migrate”
e) Start the server
f) Login as admin
g) Go to Navigation bar -> Administration -> Setup -> Menu Editor
h) In Menu Editor page, find “Assignment Group” row (it should be the last but six row)
i) You should see an up arrow at the left column of that row, click it.
j) Then the “Assignment Group” row goes up, click the 2nd column of that “Assignment Group” row, in which it should say “assignment_groups:list”
k) In the pop up page named “Editing controller_action” there’s a drop down box with label ”Permission”, choose “administer assignment” in that drop down box, then click button “Edit”
l) Create a student account, let’s say its name is “st1”.
m) Create 2 additional assignment groups (then we will have 3 assignment groups). Set the XP value of the “Default Group” to -1. Set the XP value of the “2nd Group” to 200. Set the XP value of the “3rd Group” to 3000. (XP value of an assignment group is the threshold to open that assignment room).
n) Create 5 assignment: Please do it carefully and ONE BY ONE in order, set all deadlines to anytime LATER than May, 2013, select the “available to student” check button.
a1 : Group = Default Group | XP = 120 | directory = /submitted_content/edit/1
a2 : Group = Default Group | XP = 200 | directory = /submitted_content/edit/2
a3 : Group = 2nd Group | XP = 2000 | directory = /submitted_content/edit/3
a4 : Group = 3rd Group | XP = 2000 | directory = /submitted_content/edit/4
a5 : Group = Default Group | XP = 2000 | directory = /submitted_content/edit/5
add participant “st1” to a1, a2, a3, a4 ( NOT for a5 )