-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from TDT4240-14/Add-heartbeat/circuitbreak-to-…
…lobby-and-setup Add heartbeat/circuitbreak to lobby and setup
- Loading branch information
Showing
8 changed files
with
975 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,35 +1,76 @@ | ||
| # regicidechess | ||
|
|
||
| A [libGDX](https://libgdx.com/) project generated with [gdx-liftoff](https://github.com/libgdx/gdx-liftoff). | ||
| # Regicide Chess | ||
|
|
||
| This project was generated with a template including simple application launchers and an `ApplicationAdapter` extension that draws libGDX logo. | ||
| Regicide Chess is a hybrid chess game for Android that combines classic chess rules with a regicide twist. Built with **LibGDX** and **Firebase**, it supports real-time multiplayer matches, letting players challenge friends or opponents online. | ||
|
|
||
| ## Platforms | ||
| ## Project Structure | ||
|
|
||
| - `core`: Main module with the application logic shared by all platforms. | ||
| - `lwjgl3`: Primary desktop platform using LWJGL3; was called 'desktop' in older docs. | ||
| - `android`: Android mobile platform. Needs Android SDK. | ||
| The project follows the standard LibGDX multi-module layout: | ||
|
|
||
| ## Gradle | ||
| ``` | ||
| RegicideChess/ | ||
| ├── android/ # Android-specific module | ||
| │ └── .../firebase/ | ||
| │ └── AndroidFirebase.java # Main Firebase interface | ||
| ├── core/ # Platform-independent game logic | ||
| │ ├── database/ # Firebase data handling | ||
| │ ├── input/ # Input processing | ||
| │ ├── model/ # Game models | ||
| │ ├── network/ # Networking utilities | ||
| │ ├── screens/ # Game screens | ||
| │ │ ├── Lobby/ # Lobby creation/joining | ||
| │ │ ├── Game/ # Main gameplay | ||
| │ │ ├── MainMenu/ # Main menu | ||
| │ │ └── Setup/ # Setup pieces | ||
| │ ├── states/ # Game state management | ||
| │ └── utils/ # Helper classes | ||
| ├── assets/ # Sprites, fonts | ||
| └── ... # Gradle build files, etc. | ||
| ``` | ||
|
|
||
| This project uses [Gradle](https://gradle.org/) to manage dependencies. | ||
| The Gradle wrapper was included, so you can run Gradle tasks using `gradlew.bat` or `./gradlew` commands. | ||
| Useful Gradle tasks and flags: | ||
| - **android/**: Contains Android-specific code, notably `AndroidFirebase.java` which acts as the central hub for all Firebase operations. | ||
| - **core/**: All shared game logic, UI screens, input handling, and networking abstractions. This module is independent of Android and can be reused on other platforms. | ||
| - **assets/**: Images (piece sprites) | ||
|
|
||
| - `--continue`: when using this flag, errors will not stop the tasks from running. | ||
| - `--daemon`: thanks to this flag, Gradle daemon will be used to run chosen tasks. | ||
| - `--offline`: when using this flag, cached dependency archives will be used. | ||
| - `--refresh-dependencies`: this flag forces validation of all dependencies. Useful for snapshot versions. | ||
| - `android:lint`: performs Android project validation. | ||
| - `build`: builds sources and archives of every project. | ||
| - `cleanEclipse`: removes Eclipse project data. | ||
| - `cleanIdea`: removes IntelliJ project data. | ||
| - `clean`: removes `build` folders, which store compiled classes and built archives. | ||
| - `eclipse`: generates Eclipse project data. | ||
| - `idea`: generates IntelliJ project data. | ||
| - `lwjgl3:jar`: builds application's runnable jar, which can be found at `lwjgl3/build/libs`. | ||
| - `lwjgl3:run`: starts the application. | ||
| - `test`: runs unit tests (if any). | ||
| ## Compilation and Execution | ||
|
|
||
| Note that most tasks that are not specific to a single project can be run with `name:` prefix, where the `name` should be replaced with the ID of a specific project. | ||
| For example, `core:clean` removes `build` folder only from the `core` project. | ||
| ### For End Users (Play Store / APK) | ||
|
|
||
| 1. Download the `RegicideChess.apk` from the [Releases Page](https://git.ntnu.no/TDT4240-14/TDT4240/-/releases) | ||
| 2. Copy it to your Android device and install it. You may need to enable **Install from unknown sources** in your device settings. | ||
| 3. Tap the app icon to launch. | ||
|
|
||
| ### For Developers (Build from Source) | ||
|
|
||
| #### Prerequisites | ||
| - [Android Studio](https://developer.android.com/studio) (with Android SDK and build tools) | ||
| - Java 11 or higher | ||
|
|
||
| #### Steps | ||
| 1. Clone the repository: | ||
| ```bash | ||
| git clone https://git.ntnu.no/TDT4240-14/TDT4240.git | ||
| ``` | ||
| 2. Open the project in **Android Studio**. | ||
| 3. Wait for Gradle sync to complete (it will automatically download all dependencies, including LibGDX and Firebase SDKs). | ||
| 4. Build the APK: | ||
| - Go to the top menu: `Build` → `Build Bundle(s) / APK(s)` → `Build APK(s)`. | ||
| 5. The debug APK will be generated at: | ||
| ``` | ||
| app/build/outputs/apk/debug/ | ||
| ``` | ||
|
|
||
| #### Running on an Emulator or Device | ||
| - Connect your Android device via USB or start an emulator. | ||
| - Click the **Run** button in Android Studio. | ||
|
|
||
| ## Testing Multiplayer with BlueStacks | ||
|
|
||
| Since multiplayer requires two devices, we recommend using [BlueStacks](https://www.bluestacks.com) (a free Android emulator for PC) to run multiple instances. | ||
|
|
||
| 1. Install BlueStacks and open the **Multi‑Instance Manager**. | ||
| 2. Create two separate instances (e.g., `Instance 1` and `Instance 2`). | ||
| 3. Launch both instances. | ||
| 4. Drag the `RegicideChess.apk` file into each BlueStacks window to install the game. | ||
| 5. On one instance, create a new lobby. On the other, join using the displayed **Game ID**. | ||
| 6. Play a full match – this simulates two real devices and helps catch multiplayer bugs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.