{"id":14983578,"url":"https://github.com/mojtabaj/dragons-dice-duel","last_synced_at":"2025-08-01T21:10:27.235Z","repository":{"id":248751147,"uuid":"829551596","full_name":"mojtabaJ/dragons-dice-duel","owner":"mojtabaJ","description":"Dragons' Dice Duel - A simple game using gRPC with java","archived":false,"fork":false,"pushed_at":"2024-07-20T15:16:27.000Z","size":3976,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-16T12:15:16.711Z","etag":null,"topics":["example-project","game","grpc","grpc-java","java"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mojtabaJ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-07-16T16:55:41.000Z","updated_at":"2024-07-20T15:16:30.000Z","dependencies_parsed_at":"2024-09-24T15:24:38.388Z","dependency_job_id":"10676d85-34ba-45e1-914d-18c944ff0578","html_url":"https://github.com/mojtabaJ/dragons-dice-duel","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"7eca29ed2f1d4ac8a5ed755fdd8c219ac7b213ff"},"previous_names":["mojtabaj/dragons-dice-duel"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mojtabaJ/dragons-dice-duel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mojtabaJ%2Fdragons-dice-duel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mojtabaJ%2Fdragons-dice-duel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mojtabaJ%2Fdragons-dice-duel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mojtabaJ%2Fdragons-dice-duel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mojtabaJ","download_url":"https://codeload.github.com/mojtabaJ/dragons-dice-duel/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mojtabaJ%2Fdragons-dice-duel/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268297390,"owners_count":24228124,"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-08-01T02:00:08.611Z","response_time":67,"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":["example-project","game","grpc","grpc-java","java"],"created_at":"2024-09-24T14:07:27.732Z","updated_at":"2025-08-01T21:10:27.209Z","avatar_url":"https://github.com/mojtabaJ.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n\u003cdiv align=\"center\"\u003e\n        \u003ch1\u003eDragons' Dice Duel\u003c/h1\u003e\n        \u003ch3\u003eA Simple Turn-Based Game Using gRPC with Java\u003c/h3\u003e\n\n![House of the Dragon - Greens vs Blacks](dragons-dice-duel.jpg)\n\u003c/div\u003e\n\n# Dragons' Dice Duel: The Dance of the Dragons\n\nDragons' Dice Duel is a simple turn-based game implementation inspired by the tumultuous conflict known as the Dance of the Dragons from the [House of the Dragon](https://www.hbo.com/house-of-the-dragon) series. This project serves as a practical example of using gRPC (Google Remote Procedure Call) in Java, demonstrating how to handle communication between game clients and the server.\n\n## Scenario: The Dance of the Dragons\n\nIn the turbulent times of the Dance of the Dragons, House Targaryen is torn asunder by bitter familial feuds and political intrigue. The realm stands divided between two powerful factions:\n- **[The Greens](https://awoiaf.westeros.org/index.php/Greens)**: Loyal to Aegon II Targaryen's claim to the throne.\n- **[The Blacks](https://awoiaf.westeros.org/index.php/Blacks)**: Supporting Rhaenyra Targaryen's right to rule.\n\nPlayers take on the roles of these factions in a dice-rolling game, where each roll represents a strategic maneuver or diplomatic victory aimed at gaining support from influential lords and allies across Westeros.\n\n## Gameplay Mechanics\n\n- **Turn-based Play**: Players take turns rolling a die using gRPC to communicate with the game server.\n- **Point System**: Rolling a 6 earns the player 1 point and an extra turn, symbolizing successful alliances or strategic victories.\n- **Winning Condition**: The first player to reach [131](https://awoiaf.westeros.org/index.php/131_AC) points wins the game, securing their faction's claim to the Iron Throne.\n\n### Technologies Used\n\n- **gRPC**: Facilitates efficient communication between the game server and clients.\n- **Java**: Language used for both client and server logic.\n\n### Prerequisites\n- Java 21 or higher\n- Maven or Gradle for dependency management\n- gRPC and Protobuf tools installed\n\n\n## Getting Started\n\nTo get started with **Dragons' Dice Duel**, follow these steps to set up and run the server and client. This guide assumes you have Java 11 or higher, Maven or Gradle for dependency management, and the gRPC and Protobuf tools installed.\n\n### 1\\. Clone the Repository\nFirst, clone the repository to your local machine:\n```bash\ngit clone \u003crepository-url\u003e cd dragons-dice-duel\n```\n\n### 2\\. Build the Project\nEnsure you have Maven installed. Then, build the project using the following command:\n```bash\nmvn clean install\n```\n\n### 3\\. Running the Server\nThe server listens for incoming gRPC requests and handles game logic. To start the server:\n```bash\nmvn exec:java -Dexec.mainClass=\"io.github.mojtabaj.data.DragonsDiceDuelServer\"\n```\nBy default, the server will run on port **6565**. Ensure no other application is using this port.\n\n### 4\\. Running the Client\n\nThe client interacts with the server, sending game requests and receiving responses. To run the client:\n\n1.  **Ensure the Server is Running**: The client needs to connect to an actively running server.\n2.  **Execute the Client**:\n```bash\nmvn exec:java -Dexec.mainClass=\"io.github.mojtabaj.data.DragonsDiceDuelClient\"\n```\nThe client will connect to the server, send join requests, and simulate dice rolls.\n\n\n### 5\\. Modifying Client Configuration\n\nIf you need to change the server address or port, update the `DragonsDiceDuelClient` class. Modify the `ManagedChannelBuilder` configuration to match your server settings:\n```java\nManagedChannel channel = ManagedChannelBuilder\n        .forAddress(\"localhost\", 6565)\n        .usePlaintext()\n        .build();\n```\nReplace `\"localhost\"` and `6565` with the appropriate server address and port if necessary.\n\n\n## gRPC Protocol\n### Protobuf Definitions\n\nThe `.proto` file defines the data structures and service contract used in this project.\n\n*   **`Faction`**: Enum representing the two factions in the game.\n*   **`PlayerData`**: Message containing details about a player.\n*   **`GameData`**: Message containing game state information and the winner.\n*   **`DiceData`**: Message representing a dice roll and the player who rolled it.\n*   **`GameRequest`**: Message used to send requests to the server (join game or roll dice).\n*   **`GameResponse`**: Message used to send responses from the server (player joined, turn info, dice roll result, game result).\n\n### gRPC Services\n\n*   **`DragonsDiceDuel` Service**:\n    *   **`PlayGame`**: A bidirectional streaming RPC that allows clients to send `GameRequest` messages and receive `GameResponse` messages.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmojtabaj%2Fdragons-dice-duel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmojtabaj%2Fdragons-dice-duel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmojtabaj%2Fdragons-dice-duel/lists"}