CSC/ECE 517 Spring 2013/OSS E629: Difference between revisions
(25 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
==Project Introduction== | ==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). | This is a game made for the [http://wikis.lib.ncsu.edu/index.php/Expertiza 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== | ==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. | 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). | The page should basically load the frontend [http://en.wikipedia.org/wiki/JavaScript JavaScript] and point it to the [http://en.wikipedia.org/wiki/JSON JSON] string (a URL that will check to make sure that the current user is logged in correctly). | ||
[https://docs.google.com/a/ncsu.edu/document/d/1SVNx7Eh6dUdrz2a9rGSgBxLkxAmuBUm8eu08nHEdjIg/edit# Project Description] | [https://docs.google.com/a/ncsu.edu/document/d/1SVNx7Eh6dUdrz2a9rGSgBxLkxAmuBUm8eu08nHEdjIg/edit# Project Description] | ||
Line 14: | Line 14: | ||
===Experience Point Report=== | ===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. | In this game, the player doesn't receive grades; rather, he gains experience(XP), the most important thing about the XP points is that they can accumulate instead of just getting average as student’s final score. As an example, if a student scored 80 in the first several assignments may eventually lower his/her grade if he decides to do some extra work on extra assignment and got 70 in the extra assignment. The grade can either automatically generated by multiplying percentage score with the weight of assignment, it can also be set by the instructor manually. The professor would convert the experience values of the players at the end of the course into grades. | ||
The | The previous XP logic in JSON string generating module is a piece of static code which always just sends a manually set percentage score as the XP point. A part of our work is to rewrite this XP point system. | ||
The new XP point system is a weighted score system, where instructor can assign or automatically generate the XP point. | The new XP point system is a weighted score system, where instructor can assign or automatically generate the XP point. | ||
===Assignment Group Modules=== | ===Assignment Group Modules=== | ||
Assignment group module is used to group similar assignments in to one assignment group, such that as long as the student accumulates enough XP points in one assignment group, he can continue to the next group regardless whether there is any assignment in this group left untouched. | |||
Previous assignment group from the previous project E407 is a fake module. We believe the fake module is there for testing proposes. So we rewrite the MVC code for the assignment group module and assign access privilege to it. | |||
In addition, in previous version of backend code, the code to decide whether an assignment group is “available” to a student appears in both frontend and backend, but neither of them works. So we also rewrite that part and have it implemented at backend. | |||
===JavaScript Code Reconstruction=== | ===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 fetches JSON string by sending the request and by [http://en.wikipedia.org/wiki/Polling_(computer_science) polling] the socket for response. In this strategy, the computer does nothing other than check the status of the socket until it get hit, at which point the device is accessed. In order to improve the utilization of the CPU time, we introduced [http://en.wikipedia.org/wiki/Event-driven_programming Event Driven Programming (EDP)] into our design. In EDP, the flow of the program is now driven 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. | |||
===Fixing Mega Bugs=== | ===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. | |||
'''Cause''': previous code checks the submitting status prior to the privilege checking. | |||
'''Reproduce''': imitate a new assignment, add a student as participant. Then login to the game interface as the student directly. | |||
'''Status''': Fixed | |||
====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. | |||
'''Cause''': frontend gate control code not working, we moive that part of code into backend. | |||
'''Reproduce''': Just create multiple assignment groups, each group with a XP threshold. Depend on the browsers and browser versions, the front end may stop responding, show black screen or some portal gates not functioning. | |||
'''Status''': Fixed | |||
====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. | |||
'''Cause''': the backend uses inner join to query the database where it should be left join. | |||
'''Reproduce''': Create 3 assignment groups, each contains 3 assignments. Make all assignments available to student. Then log into game interface as student. One should see much more assignments there than it should be. | |||
'''Status''': Fixed. | |||
===Fixing Minor Bugs=== | ===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== | ==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 ) |
Latest revision as of 14:20, 24 March 2013
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), the most important thing about the XP points is that they can accumulate instead of just getting average as student’s final score. As an example, if a student scored 80 in the first several assignments may eventually lower his/her grade if he decides to do some extra work on extra assignment and got 70 in the extra assignment. The grade can either automatically generated by multiplying percentage score with the weight of assignment, it can also be set by the instructor manually. The professor would convert the experience values of the players at the end of the course into grades.
The previous XP logic in JSON string generating module is a piece of static code which always just sends a manually set percentage score as the XP point. A part of our work is to rewrite this XP point system.
The new XP point system is a weighted score system, where instructor can assign or automatically generate the XP point.
Assignment Group Modules
Assignment group module is used to group similar assignments in to one assignment group, such that as long as the student accumulates enough XP points in one assignment group, he can continue to the next group regardless whether there is any assignment in this group left untouched.
Previous assignment group from the previous project E407 is a fake module. We believe the fake module is there for testing proposes. So we rewrite the MVC code for the assignment group module and assign access privilege to it.
In addition, in previous version of backend code, the code to decide whether an assignment group is “available” to a student appears in both frontend and backend, but neither of them works. So we also rewrite that part and have it implemented at backend.
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 fetches JSON string by sending the request and by polling the socket for response. In this strategy, the computer does nothing other than check the status of the socket until it get hit, at which point the device is accessed. In order to improve the utilization of the CPU time, we introduced Event Driven Programming (EDP) into our design. In EDP, the flow of the program is now driven 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.
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.
Cause: previous code checks the submitting status prior to the privilege checking.
Reproduce: imitate a new assignment, add a student as participant. Then login to the game interface as the student directly.
Status: Fixed
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.
Cause: frontend gate control code not working, we moive that part of code into backend.
Reproduce: Just create multiple assignment groups, each group with a XP threshold. Depend on the browsers and browser versions, the front end may stop responding, show black screen or some portal gates not functioning.
Status: Fixed
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.
Cause: the backend uses inner join to query the database where it should be left join.
Reproduce: Create 3 assignment groups, each contains 3 assignments. Make all assignments available to student. Then log into game interface as student. One should see much more assignments there than it should be.
Status: Fixed.
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 )