{"id":22672172,"url":"https://github.com/jimlynchcodes/quackers-backend","last_synced_at":"2025-03-29T11:24:25.919Z","repository":{"id":257964658,"uuid":"864932012","full_name":"JimLynchCodes/Quackers-Backend","owner":"JimLynchCodes","description":"Websocket backend for the online ducks game and virtual world.","archived":false,"fork":false,"pushed_at":"2024-10-29T17:01:43.000Z","size":162,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-29T18:28:40.523Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JimLynchCodes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-29T14:55:18.000Z","updated_at":"2024-10-29T17:01:32.000Z","dependencies_parsed_at":"2024-10-26T17:31:09.063Z","dependency_job_id":"203042e8-87bf-4cc7-a772-11012163158b","html_url":"https://github.com/JimLynchCodes/Quackers-Backend","commit_stats":null,"previous_names":["jimlynchcodes/quackers-backend"],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JimLynchCodes%2FQuackers-Backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JimLynchCodes%2FQuackers-Backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JimLynchCodes%2FQuackers-Backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JimLynchCodes%2FQuackers-Backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JimLynchCodes","download_url":"https://codeload.github.com/JimLynchCodes/Quackers-Backend/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246176048,"owners_count":20735685,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-09T16:18:12.720Z","updated_at":"2025-03-29T11:24:25.886Z","avatar_url":"https://github.com/JimLynchCodes.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Quackers Websocket Backend Server\n\nBackend server for the Quackers mmo game.  \n\n--- \n\n\n\n## Running the server\n\nSimply use the use the `cargo run` command to run the program. There is no additional configuration needed.\n\nThe server will run on 0.0.0.0:8000.\n\n\n## Frontend\n\nTo get the full game experience, you can also run the [front-end code](https://github.com/JimLynchCodes/Quackers-Frontend) for this (also a Rust project, made with Bevy).\n\n## Deploying\n\nAdd secrets in github actions environment secrets:\n\nBACKEND_WS_ENDPOINT =\n\nSERVER_IP_ADDRESS = \n\n\nthen make a new git tag that includes the phrase \"beta\" and push it.\neg:\n```bash\ngit tag v0.0.1-beta\ngit push --tags\n```\n\n\n# Manual Way (Not Recommended)\n\n## Compiling for Ubuntu\nThe regular cargo build won't deploy to ubuntu linx so we'll use _cross_ to compile a build that will work.\n\nInstall cross into cargo if you haven't already:\n```bash\ncargo install cross --git https://github.com/cross-rs/cross\n```\n\nAdd target for the linux distro you will be deploying to:\n```bash\nrustup target add x86_64-unknown-linux-gnu\n```\n\nCompile for ubuntu\n```bash\ncross build --target x86_64-unknown-linux-gnu --release\n```\n\n## SSH Into Server\n\n```\nssh root@your_ip\n```\n\n\n\n## Requests Accepted\n\nOnce connected, clients can send these types of messages \n\n_Note: Requests must come in to the server as properly formed JSON! And likewise, responses will be JSON..._\n\nThe structure of the request:\n\n{\n    actionType: String,\n    data:       Value\n}\n\n\n# 1) Quack\n\nAllows a user to send a message that he or she is quacking. \n\nRequest \n```\n{\n    requestType: \"quack\",\n    data: {}\n}\n```\n\nThe server will then blast a message to all connected users, letting them know which user is quacking.\n\nResponse\n```\n{\n    responseType: \"quack\",\n    data: {\n        userId: String\n    }\n}\n```\n\n{ \"action_type\": \"bar\", \"data\": \"hey\" }\n\n\n\n# 2) Move\n\nAllows a user to send a message that he or she is quacking. \n\nRequest \n```\n{\n    requestType: \"move\",\n    data: {\n        direction: {\n            x: u64,\n            y: u64\n        }\n    }\n}\n```\n\nThe server will then accept the direction a player wants to move, calculates the player's new position, and blast a message to all connected users, letting them the user's new position.\n\nResponse\n```\n{\n    responseType: \"move\",\n    data: {\n        userId: String,\n        position: {\n            x: u64,\n            y: u64\n        }\n    }\n}\n```\n\n\n# 3) Collecting Crackers\n\nThere is no request needed for this event. When each player moves the server will calculate if the player is touching a \"cracker\". If so:\n- player is awarded points\n- leaderboard is updated\n- a new \"cracker\" is spawned randomly on the map\n\nEveryone see that the user gained crackers:\n\nResponse\n```\n{\n    responseType: \"cracker\",\n    data: {\n        userId: String,\n        newScore: u64\n        old_position: {\n            x: u64,\n            y: u64\n        },\n        new_position: {\n            x: u64,\n            y: u64\n        }\n    }\n}\n```\n\n\n# Inspired by: Rust websocket server tutorial\n\nThis code was inspired by the article and example project that can be found here: [TMS Blog - Rust Warp WebSocket server](https://tms-dev-blog.com/build-basic-rust-websocket-server/)\n\nThanks tmsdev82!\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimlynchcodes%2Fquackers-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjimlynchcodes%2Fquackers-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimlynchcodes%2Fquackers-backend/lists"}