{"id":35101410,"url":"https://github.com/bbartling/pong","last_synced_at":"2026-03-27T03:09:12.412Z","repository":{"id":324110098,"uuid":"1096011271","full_name":"bbartling/pong","owner":"bbartling","description":"A Unity concept for learning 2-player game development: build a custom server on the internet that allows two Unity clients to play a game of Pong, using WebSockets to communicate data back and forth.","archived":false,"fork":false,"pushed_at":"2025-11-13T20:39:12.000Z","size":35902,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"develop","last_synced_at":"2025-11-13T22:23:07.437Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"ASP.NET","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/bbartling.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-13T20:23:55.000Z","updated_at":"2025-11-13T20:39:18.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/bbartling/pong","commit_stats":null,"previous_names":["bbartling/pong"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/bbartling/pong","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbartling%2Fpong","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbartling%2Fpong/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbartling%2Fpong/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbartling%2Fpong/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bbartling","download_url":"https://codeload.github.com/bbartling/pong/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbartling%2Fpong/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31013959,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-27T02:58:54.984Z","status":"ssl_error","status_checked_at":"2026-03-27T02:58:46.993Z","response_time":164,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2025-12-27T16:59:55.633Z","updated_at":"2026-03-27T03:09:12.406Z","avatar_url":"https://github.com/bbartling.png","language":"ASP.NET","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pong\nA Unity concept for learning 2-player game development: build a custom server on the internet that allows two Unity clients to play a game of Pong, using WebSockets to communicate data back and forth.\n\nUnity handles all gameplay simulation locally, including ball physics, paddle movement, collisions, scoring, and round resets. Scripts like `BallController.cs`, `PaddleController.cs`, `GameManager.cs`, and `GoalTrigger.cs` run entirely inside the Unity engine, meaning the game does not rely on the server for any physics or logic. One player is designated as the **Host**, and that machine becomes the authoritative source of truth for the match—it controls ball movement, simulates the left paddle, and tracks the current score. The other player, the **Client**, controls only the right paddle. The Host sends its full game state (ball position, paddle position, and score) over WebSockets, and the Client simply renders whatever the Host transmits, keeping the two players visually synchronized while ensuring that all physics remain consistent and authoritative.\n\n\n---\n\n\u003cdetails\u003e\n\u003csummary\u003e📊 Unity Package Manager Notes\u003c/summary\u003e\n\n### Install Websockets support\nhttps://github.com/endel/NativeWebSocket\n\nIn package manager from git URL:\n* https://github.com/endel/NativeWebSocket.git#upm\n\n\n### Install UniTask\nhttps://github.com/Cysharp/UniTask?tab=readme-ov-file#upm-package\n\nIn package manager from git URL:\n* https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask\n\n\n\u003c/details\u003e\n\n---\n\n\n\u003cdetails\u003e\n\u003csummary\u003e🐍 Python Websocket Server Notes\u003c/summary\u003e\n\n* https://github.com/bbartling/bensUnityWebSocketServer\n\n### Deployed on Render web app service\n* Wake up web service if it is sleeping by going to URL: https://bensunitywebsocketserver.onrender.com/\n\n### In Unity Windows build enter in the URL for the Websocket server\n* wss://bensunitywebsocketserver.onrender.com\n\n![Setup Snippet](https://raw.githubusercontent.com/bbartling/pong/develop/setup_snip.png)\n\nInstead of sending physics calculations to crunch in Python, the game only sends this data below WebSockets Transfer State 30 Times Per Second:\n\n### **What Host sends → Client**\n\n(Every ~33 ms)\n\n```json\n{\n  \"type\": \"host_state\",\n  \"ball_pos\": [x, y],\n  \"left_paddle_y\": y,\n  \"left_score\": 0,\n  \"right_score\": 0\n}\n```\n\n(Defined in `HostStateMessage` )\n\n### **What Client sends → Host**\n\n```json\n{\n  \"type\": \"client_state\",\n  \"right_paddle_y\": y\n}\n```\n\n\u003c/details\u003e\n\n---\n\n![Game Snippet](https://github.com/bbartling/pong/blob/develop/game_snip.png)\n\n---\n\n## 📜 License\n\nEverything here is **MIT Licensed** — free, open source, and made for the BAS community.  \nUse it, remix it, or improve it — just share it forward so others can benefit too. 🥰🌍\n\n\n【MIT License】\n\nCopyright 2025 Ben Bartling\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbartling%2Fpong","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbbartling%2Fpong","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbartling%2Fpong/lists"}