Giter Site home page Giter Site logo

w-henderson / kascreech Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 1.0 5.27 MB

💡 Real-time multiplayer quiz platform to make learning fun, based on Kahoot and built with Rust and React.

Home Page: https://kascreech.whenderson.dev

HTML 9.37% Rust 37.16% TypeScript 35.35% SCSS 17.32% Dockerfile 0.80%
kahoot quiz multiplayer full-stack education websocket

kascreech's Introduction

👋 Hi there, I'm William

I'm a Computer Science student at the University of Cambridge with a passion for solving problems by developing efficient, robust and maintainable software, built with performance in mind. I thrive on projects where every millisecond counts, and I find immense satisfaction in delivering performant and reliable solutions across diverse domains, from systems development to web applications, back-end infrastructure to mobile apps.

Please visit my portfolio and blog for more information.

💬 Contact Me

If you want to get in touch, feel free to use any of the platforms below!

kascreech's People

Contributors

flauntingspade4 avatar w-henderson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

kascreech's Issues

error[E0554]: `#![feature]` may not be used on the stable release channel

[root@zmanda server]# cargo run --verbose
Fresh unicode-xid v0.2.2
Fresh cfg-if v1.0.0
Fresh autocfg v1.0.1
Fresh version_check v0.9.3
Fresh slab v0.4.3
Fresh lazy_static v1.4.0
Fresh futures-sink v0.3.15
Fresh cfg-if v0.1.10
Fresh pin-project-lite v0.2.6
Fresh futures-io v0.3.15
Fresh pin-project-lite v0.1.12
Fresh bytes v0.5.6
Fresh pin-utils v0.1.0
Fresh smallvec v1.6.1
Fresh scopeguard v1.1.0
Fresh matches v0.1.8
Fresh convert_case v0.4.0
Fresh percent-encoding v2.1.0
Fresh tinyvec_macros v0.1.0
Fresh itoa v0.4.7
Fresh copyless v0.1.5
Fresh unicode-segmentation v1.7.1
Fresh ppv-lite86 v0.2.10
Fresh either v1.6.1
Fresh bytes v1.0.1
Fresh cc v1.0.67
Fresh match_cfg v0.1.0
Fresh fnv v1.0.7
Fresh quick-error v1.2.3
Fresh linked-hash-map v0.5.4
Fresh hashbrown v0.9.1
Fresh adler v1.0.2
Fresh version_check v0.1.5
Fresh regex-syntax v0.6.25
Fresh mime v0.3.16
Fresh byteorder v1.4.3
Fresh cpufeatures v0.1.4
Fresh opaque-debug v0.3.0
Fresh language-tags v0.2.2
Fresh base64 v0.13.0
Fresh bytes v0.6.0
Fresh once_cell v1.7.2
Fresh fastrand v1.4.1
Fresh instant v0.1.9
Fresh tracing-core v0.1.18
Fresh lock_api v0.4.4
Fresh unicode-bidi v0.3.5
Fresh form_urlencoded v1.0.1
Fresh tinyvec v1.2.0
Fresh heck v0.3.2
Fresh bytestring v1.0.0
Fresh http v0.2.4
Fresh lru-cache v0.1.2
Fresh fxhash v0.2.1
Fresh buf-min v0.2.0
Fresh proc-macro2 v1.0.26
Fresh libc v0.2.94
Fresh memchr v2.4.0
Fresh log v0.4.14
Fresh proc-macro-hack v0.5.19
Fresh futures-core v0.3.15
Fresh proc-macro-nested v0.1.7
Fresh futures-task v0.3.15
Fresh bitflags v1.2.1
Fresh unicode-normalization v0.1.17
Fresh typenum v1.13.0
Fresh ryu v1.0.5
Fresh const_fn v0.4.7
Fresh crc32fast v1.2.1
Fresh httparse v1.4.1
Fresh encoding_rs v0.8.28
Fresh quote v1.0.9
Fresh net2 v0.2.37
Fresh iovec v0.1.4
Fresh signal-hook-registry v1.3.0
Fresh parking_lot_core v0.8.3
Fresh num_cpus v1.13.0
Fresh getrandom v0.1.16
Fresh hostname v0.3.1
Fresh aho-corasick v0.7.18
Fresh socket2 v0.3.19
Fresh indexmap v1.6.2
Fresh miniz_oxide v0.4.4
Fresh standback v0.2.17
Fresh tracing v0.1.26
Fresh unicase v2.6.0
Fresh futures-channel v0.3.15
Fresh idna v0.2.3
Fresh generic-array v0.14.4
Fresh brotli-sys v0.3.2
Fresh nom v4.2.3
Fresh syn v1.0.72
Fresh mio v0.6.23
Fresh threadpool v1.8.1
Fresh parking_lot v0.11.1
Fresh rand_core v0.5.1
Fresh resolv-conf v0.7.0
Fresh regex v1.5.4
Fresh flate2 v1.0.20
Fresh url v2.2.2
Fresh block-buffer v0.9.0
Fresh digest v0.9.0
Fresh brotli2 v0.3.2
Fresh mio-uds v0.6.8
Fresh futures-macro v0.3.15
Fresh pin-project-internal v0.4.28
Fresh derive_more v0.99.14
Fresh actix-macros v0.1.3
Fresh serde_derive v1.0.126
Fresh thiserror-impl v1.0.24
Fresh time-macros-impl v0.1.1
Fresh pin-project-internal v1.0.7
Fresh async-trait v0.1.50
Fresh enum-as-inner v0.3.3
Fresh actix-web-codegen v0.4.0
Fresh v_escape_derive v0.8.4
Fresh rand_chacha v0.2.2
Fresh sha-1 v0.9.6
Fresh tokio v0.2.25
Fresh futures-util v0.3.15
Fresh pin-project v0.4.28
Fresh actix-threadpool v0.3.3
Fresh serde v1.0.126
Fresh thiserror v1.0.24
Fresh time-macros v0.1.1
Fresh pin-project v1.0.7
Fresh v_escape v0.14.1
Fresh rand v0.7.3
Fresh mime_guess v2.0.3
Fresh tokio-util v0.3.1
Fresh actix-service v1.0.6
Fresh futures v0.3.15
Fresh actix-rt v1.1.1
Fresh serde_urlencoded v0.7.0
Fresh serde_json v1.0.64
Fresh actix-router v0.2.7
Fresh time v0.2.26
Fresh tracing-futures v0.2.5
Fresh v_htmlescape v0.11.0
Fresh actix-codec v0.3.0
Fresh trust-dns-proto v0.19.7
Fresh cookie v0.14.4
Fresh h2 v0.2.7
Fresh actix-utils v2.0.0
Fresh trust-dns-resolver v0.19.7
Fresh actix-connect v2.0.0
Fresh actix-server v1.0.4
Fresh actix-tls v2.0.0
Fresh actix-http v2.2.0
Fresh actix-testing v1.0.1
Fresh awc v2.0.3
Fresh actix-web v3.3.2
Fresh actix-cors v0.5.4
Fresh actix-files v0.4.1
Compiling server v0.1.0 (/var/www/html/Kascreech/server)
Running rustc --crate-name server --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=6f1b4ff6a6c682cf -C extra-filename=-6f1b4ff6a6c682cf --out-dir /var/www/html/Kascreech/server/target/debug/deps -C incremental=/var/www/html/Kascreech/server/target/debug/incremental -L dependency=/var/www/html/Kascreech/server/target/debug/deps --extern actix_cors=/var/www/html/Kascreech/server/target/debug/deps/libactix_cors-07e3ff62ccce64e4.rlib --extern actix_files=/var/www/html/Kascreech/server/target/debug/deps/libactix_files-1c4575eae6972461.rlib --extern actix_web=/var/www/html/Kascreech/server/target/debug/deps/libactix_web-9545ea505ec1c35b.rlib --extern fastrand=/var/www/html/Kascreech/server/target/debug/deps/libfastrand-5269f8b8a8e12999.rlib --extern serde=/var/www/html/Kascreech/server/target/debug/deps/libserde-11df8d6276dc785e.rlib --extern serde_json=/var/www/html/Kascreech/server/target/debug/deps/libserde_json-5a14a89a08640a3a.rlib -L native=/var/www/html/Kascreech/server/target/debug/build/brotli-sys-48176562eaa37722/out
error[E0554]: #![feature] may not be used on the stable release channel
--> src/main.rs:1:1
|
1 | #![feature(drain_filter)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try rustc --explain E0554.
error: could not compile server

Caused by:
process didn't exit successfully: rustc --crate-name server --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=6f1b4ff6a6c682cf -C extra-filename=-6f1b4ff6a6c682cf --out-dir /var/www/html/Kascreech/server/target/debug/deps -C incremental=/var/www/html/Kascreech/server/target/debug/incremental -L dependency=/var/www/html/Kascreech/server/target/debug/deps --extern actix_cors=/var/www/html/Kascreech/server/target/debug/deps/libactix_cors-07e3ff62ccce64e4.rlib --extern actix_files=/var/www/html/Kascreech/server/target/debug/deps/libactix_files-1c4575eae6972461.rlib --extern actix_web=/var/www/html/Kascreech/server/target/debug/deps/libactix_web-9545ea505ec1c35b.rlib --extern fastrand=/var/www/html/Kascreech/server/target/debug/deps/libfastrand-5269f8b8a8e12999.rlib --extern serde=/var/www/html/Kascreech/server/target/debug/deps/libserde-11df8d6276dc785e.rlib --extern serde_json=/var/www/html/Kascreech/server/target/debug/deps/libserde_json-5a14a89a08640a3a.rlib -L native=/var/www/html/Kascreech/server/target/debug/build/brotli-sys-48176562eaa37722/out (exit code: 1)

Set up full game

I'm going to outline my plan in an issue because it's much more professional than using layout.md!

Server contact throughout game:

At start of game:

  • all clients request server's /generateGame POST method with the game ID, which sends a JSON string with game information. This includes colours corresponding to which answer is right for each question among other stuff. Don't send the questions because they're unnecessary. The answers can be drawn from a JSON file of questions, which is outlined later in this issue. Example response:
{
    "answers": [[0], [3], [2], [1]],
    "timePerQuestion": 20000, // this is milliseconds
    "timeShowingAnswers": 5000, // also milliseconds
    "timeShowingLeaderboard": 5000, // also also milliseconds
    "gameStartTime": 123456789 // timestamp in milliseconds of when the game starts so they're all 100% in sync, should be at least 30 seconds after request is made
}
  • all clients do some for loops to set up timeouts telling them when to send the server response data as outlined later

Every question:

  • when a client makes a guess their response is sent to the server's /makeGuess POST method as a JSON string. This request does not require any response except from a 200 status code to tell the frontend that it's been processed. When it's received, the server should probably just add the score to their uuid's key in a dictionary or something overly rusty and complicated. The request is in the following format:
{
    "gameId": "whatever the game id is",
    "uuid": "some uuid goes here, could be later replaced with usernames",
    "correct": true, // or false obviously
    "score": 1000 // up to 1000, based on how long they took to respond, calculated client side to not disadvantage players with bad ping
}
  • if they don't make a guess, nothing is sent so their scores won't be updated

At the end of the game:

  • every client makes a request after time runs out on the last question to the server's /leaderboard POST method, to which they send the game ID and are returned a simple JSON array with UUIDs, in order from first place to last place so the client side can tell the player where they placed

What will Big Chungus™ do? (yes you are required to call it that in the code)

  • Big Chungus™ will also request all the answers at the start of the game, but it will be through a different route so Big Chungus™ can also see the questions to display. The route will be /chungusGameInfo and the response should look like this:
{
    "bigChungus": true, // required otherwise front end redirects to a rick roll
    "questions": [
        {
            "question": "Which of the following is not a cheese?",
            "responses": [
                    "Elliot's feet",
                    "Elliot's head",
                    "Elliot's nose",
                    "Elliot",
            ],
            "correct": [2] // index 2 (elliot's nose) is the only correct answer
        }
    ],
    "timePerQuestion": 20000, // this is milliseconds
    "timeShowingAnswers": 5000, // also milliseconds
    "timeShowingLeaderboard": 5000, // also also milliseconds
    "gameStartTime": 123456789, // timestamp in milliseconds of when the game starts
    "gameId": "some id i dont care how you format it but have a string"
}
  • Big Chungus™ will also run on timeouts but they will be slightly different so players have time to read the question before having to answer it
  • Big Chungus™ will call the /leaderboard POST method many times so it needs to work not just at the end of the game

That's all I've thought of for now, refer to this when you're writing the backend (I'll do the same as I make the frontend), and use this issue to track your progress in replies.

SSL peer certificate or SSH remote key was not OK

cargo run
error: failed to download from https://crates.io/api/v1/crates/actix-codec/0.3.0/download

Caused by:
[60] SSL peer certificate or SSH remote key was not OK (SSL certificate problem: unable to get local issuer certificate)

Kascreech v2 Roadmap

Definitions

Client (Host): client who creates the lobby and is on the beeg screen
Client (Player): client who joins the lobby and plays the game

Starting a game

Client (Host) sends:

{
    "command": "host",
    "id": "<kahoot id>"
}

If successful, server returns:

{
    "success": true,
    "gameId": "<some game id>",
    "gameName": "<kahoot game name>",
    "questionCount": 69
}

Default error response for everything:

{
    "success": false,
    "message": "<error message go brrrr>"
}

Client (Host) displays game code which is used by Clients (Players) to join with the message:

{
    "command": "join",
    "gameId": "<some game id>",
    "playerName": "<some player name>"
}

Server returns this unless an error was encountered.

{
    "success": true
}

Every time a player joins, the server sends to Client (Host) the following

{
    "event": "newPlayer",
    "playerName": "<player name>"
}

Client (Host) presses start game button and sends:

{
    "command": "start"
}

During the game

Initially the host is sent the first question and the clients are broadcast the message

{
    "event": "questionStart",
    "numberOfAnswers": 4
}

Every question is sent to the host in the following format:

{
    "question": "<question text>",
    "duration": 20,
    "answers": [
        {
             "text": "<answer text>",
             "correct": true
        }
    ]
}

When the time is up, the host sends:

{
    "command": "leaderboard"
}

The server returns

{
    "leaderboard": [
        {
            "userName": "<some user name>",
            "points": 69420,
            "streak": 3
        }
    ]
}

When the host is ready for the next question, they send

{
    "command": "question"
}

When a player guesses an answer, they send

{
    "command": "guess",
    "index": 0
}

When the round ends and the leaderboard is shown, the server sends each player

{
    "event": "questionEnd",
    "correct": true,
    "pointsThisRound": 800,
    "pointsTotal": 69420,
    "streak": 2,
    "position": 3,
    "behind": "<player name or null>"
}

At the end of the game, every player is sent

{
    "event": "end",
    "position": 3
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.