{"id":24589106,"url":"https://github.com/big-shahmir/multiplyaer_game","last_synced_at":"2025-10-04T14:56:48.969Z","repository":{"id":270078163,"uuid":"909275851","full_name":"Big-ShahMir/Multiplyaer_Game","owner":"Big-ShahMir","description":"A text-based multiplayer game server implemented in C using Unix sockets.","archived":false,"fork":false,"pushed_at":"2024-12-28T08:17:25.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-17T22:07:55.805Z","etag":null,"topics":["c","ports","server"],"latest_commit_sha":null,"homepage":"","language":"C","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/Big-ShahMir.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-12-28T08:01:06.000Z","updated_at":"2024-12-28T08:18:13.000Z","dependencies_parsed_at":"2024-12-28T09:17:48.624Z","dependency_job_id":"b1413c56-a9f2-47cf-93af-c60bdcfc04ac","html_url":"https://github.com/Big-ShahMir/Multiplyaer_Game","commit_stats":null,"previous_names":["big-shahmir/multiplyaer_game"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Big-ShahMir/Multiplyaer_Game","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Big-ShahMir%2FMultiplyaer_Game","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Big-ShahMir%2FMultiplyaer_Game/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Big-ShahMir%2FMultiplyaer_Game/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Big-ShahMir%2FMultiplyaer_Game/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Big-ShahMir","download_url":"https://codeload.github.com/Big-ShahMir/Multiplyaer_Game/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Big-ShahMir%2FMultiplyaer_Game/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278328167,"owners_count":25968900,"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","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["c","ports","server"],"created_at":"2025-01-24T08:13:44.555Z","updated_at":"2025-10-04T14:56:48.953Z","avatar_url":"https://github.com/Big-ShahMir.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Battle Game Server\n\n## Overview\n\nThe **Battle Game Server** is a text-based multiplayer game server implemented in C using Unix sockets. It allows players to engage in a turn-based battle modeled after a Pokemon-style combat system. The server facilitates dynamic matchmaking, real-time gameplay, and in-game communication. This project demonstrates the use of Unix sockets, process control, and non-blocking I/O.\n\n---\n\n## Features\n\n### Core Features\n- **Dynamic Matchmaking**: Matches players automatically based on availability.\n- **Turn-Based Combat**:\n  - Players can attack (`a`) or use powermoves (`p`).\n  - Regular attacks are guaranteed but weak, while powermoves are stronger but have a 50% chance to miss.\n- **Real-Time Messaging**: Players can chat during their turn without using their action.\n- **Leaderboard**: Tracks and displays the top three players based on wins.\n\n### Gameplay Mechanics\n- Each player starts with:\n  - **Hitpoints (HP)**: Randomly assigned between 20-30.\n  - **Powermoves**: Randomly assigned between 1-3.\n- Damage ranges:\n  - Regular attacks: 2-6 HP.\n  - Powermoves: 6-18 HP (if they hit).\n- Players take turns until one loses all hitpoints.\n\n### Fault Tolerance\n- Handles client disconnections gracefully by declaring the opponent the winner.\n- Supports multiple simultaneous matches.\n\n\n## Getting Started\n### Prerequisites\n- GCC or any compatible C compiler.\n- Linux or macOS environment (not tested on Windows).\n- Basic understanding of Unix sockets.\n\n### Building the Program\nTo compile the project, use the provided `Makefile`:\n```bash\nmake PORT=\u003cyour-port-number\u003e\n```\n*Replace \u003cyour-port-number\u003e with your designated port (e.g., 53456)*\n\n### Running the Program\nStart the server with:\n```bash\n./battle\n```\n\n### Clients can connect using:\n```bash\nstty -icanon; nc \u003cserver-ip\u003e \u003cport\u003e\n```\n*Replace \u003cserver-ip\u003e with the server's IP and \u003cport\u003e with the port number used during compilation.*\n\n## How to Play\n*Please note that only users with valid UOFT credentials may be able to login to the server and play the game.*\n\n1. Connect to the Server:\n- Run ./battle on the server.\n- Use stty -icanon; nc \u003cserver-ip\u003e \u003cport\u003e to connect as a client.\n\n2. Gameplay Commands:\n- a: Perform a regular attack (2-6 HP damage).\n- p: Use a powermove (6-18 HP damage, 50% hit chance).\n- s: Send a message to your opponent during your turn.\n\n3. Matchmaking:\n- Players are automatically matched when an opponent is available.\n- Matches are random and independent.\n\n4. Winning:\n- Reduce your opponent's HP to 0 to win.\n- The leaderboard tracks the top players based on wins.\n\n## Example Output:\n```plaintext\nWelcome to the Battle Game Server!\nWaiting for an opponent...\n\nYou engage Jack!\nYour hitpoints: 25\nYour powermoves: 2\n\nOptions:\n(s) Speak\n(a) Regular attack\n(p) Powermove\n\n\u003e a\nYou hit Jack for 4 damage!\n```\n\n## Key Functions\n\n1. **Dynamic Matchmaking**  \n   - Matches players based on availability and ensures players who recently fought do not get rematched immediately.\n   - Handles multiple concurrent matches independently.\n\n2. **Real-Time Gameplay**  \n   - Processes player inputs during their turn, allowing for regular attacks (`a`), powermoves (`p`), and in-game messaging (`s`).\n   - Updates and broadcasts the game state to both players after every action.\n\n3. **Signal Handling**  \n   - Manages client disconnections gracefully by notifying the opponent of their win and resetting the server state for new matches.\n   - Ensures all resources (sockets and processes) are cleaned up properly.\n\n4. **Leaderboard Management**  \n   - Maintains and updates a session-based leaderboard, tracking the number of wins for each player.\n   - Displays the top three players dynamically after each match.\n\n## License \nThis project is licensed for educational purposes. Please contact me for other use cases.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbig-shahmir%2Fmultiplyaer_game","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbig-shahmir%2Fmultiplyaer_game","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbig-shahmir%2Fmultiplyaer_game/lists"}