---
# System prepended metadata

title: Week 9

---

# Week 9


# App 1: Star Wars: The git clone wars(WebRTC + Sensor)



WebRTC implementation:
    Use a datachannel to send data about the position, speed and direction to the other player.Also the score each player has, to  display a leaderboard. We can also implement a way to communicate with another player through audio, not video because we         don't want to waste game display area. The main focus is to establish a connection between players.

WebRTC testing:
    Testing of the datachannel is done with the node package wrtc. This currently does not work yet.

Multiplayer (2 Player):
    One player has to start a session (which will be called room) & is given a roomId that they will share to a friend. when the friend entered the roomId that was given, the SDP has been exchanged automatically and the ICEcandidates have been acknowledged. Now they can play with each other and talk to each other.

tasks:
    -rendering done by Arnout
    -connection setup done by William & Filip
        - filip: looked for a way to automate the SDP exchange.
    
    
Sensor implementation:



Space Game:
    Possible features:
     - Stars
     - Space dust (to visualize movement)
     - Speed slider
     - Player ship models
         Polyhedron
         Quaternions
     - Crosshair
     - Rotation lead (makes crosshair harder)
     - Asteroids
         Circles? will work poorly when flying close
         icosahedra? pointy...  +slow?
         cubes?
     - Ammo
     - Health
     - Respawning/Regenaration
     - Scoreboard
 ![](https://i.imgur.com/wiMUtZs.jpg)
 
 





# App 2(REST API + QR code)
A choose your own adventure type game that can be played through the browser.
Each level/puzzle can be loaded on a different URL and finishing a level/puzzle provides a new URL to progress through the game. Puzzles can be anything from soduko to a simple word pun. Some of these puzzles could also be generated based on a seed, as to introduce replayability by changing the seed. A leaderboard can be made to compare stats between players.
To be able to return to a previous URL, QR-codes will be used. This provides both save points to a player as well as a way to share interesting puzzles with friends.
Tests can be run to see if the following works:
QR-code generation and reading brings us to the right page
Puzzles are solvable
Giving a correct solution provides a working new URL
Speedrun leaderboard correctly displays/updates statistics
![](https://i.imgur.com/qmQx6vh.jpg)

User Interaction:

On the start screen: press buttons to redirect to the following: see leaderboard, load a previous game through QR-code, start a new game.
On a puzzle page: type the answer into a HTML post form, which gets send to the server and verified. The player gets redirected to a following puzzle if correct, otherwise a message is send telling the player that the answer is incorrect. These requests can be used to keep progress of the player.
The user can press a button to generate a QR code encoding the current URL.
On the last puzzle page (after x amount of puzzles solved): When solved a request is sent to the server which also updates the leaderboard with the solve time of the player. The player gets redirected to leaderboard to see his time.
On leaderboard: Player can go back to start screen. 
On QR-loading page: User can upload an img file containing a QR-code to the page. When a submit button is pressed, the user gets redirected to the encoded URL.


Message board feature:

The leaderboard can be implemented based on the message board feature.
As to keep track of progress of a player, a secret file concerning the player can be stored on the server. This could be implemented using a secret user based message board.
When the player wants to verify a solution, a POST request will be send out to the server. (REST API)


QR-code:

Each page will have the possibility to generate a QR-code to save progress while puzzling.
Each QR-code can be placed on a special load-page as to be able to revisit the corresponding page.


Puzzles:

To start only 1-2 types of puzzles will be implemented, as to not spend to much time on this. These could be generated by an algoritm instead of hardcoding each puzzle for puzzles like sudoku.
Possibility: -Sudoku?
                    -word pun puzzles?
                    -trivia?


Requirements:

- Page redirects
- leaderboard (<-- partial msg board feature)
- Puzzle verification (POST requests)
- Puzzle generation
- QR-code creation
- QR-code readout (<-- QR feature)
(- User stats tracking (<-- partial msg board feature))

API methods:
- get start page (render start page)
- get QR-load page (render QR-load page)
- get new_puzzle (with reaction messages) (render puzzle page with a new puzzle)
- get QrCode_puzzle (with reaction messages) (render puzzle page with puzzle based on QR code)
- get leaderboard page (render leaderboard page with total user scores of top 10 users)
- post reaction message on puzzle
- post generate_user_account (id, password, etc.) (cookies to keep track of user)
- put alter_user_account
- del delete_user_account
- put user_puzzle_complete (userId, password, puzzleId, puzzle_data)(verifies puzzle and updates total user score if correct)

