Skip to content

64 make a seperate screen for joining a lobby using a code #65

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
311577e
Initial creation of the LibGDX project
Mar 16, 2026
a5547d2
feat: added firebase
Mar 16, 2026
03205ff
feat: added firebase API for both desktop and Android
Mar 16, 2026
a5e411b
Implement a main menu screen
benjamls Mar 18, 2026
9324441
Implement a lobby screen
benjamls Mar 18, 2026
8617492
Implement a setup screen
benjamls Mar 18, 2026
146b7fa
Implement a game screen
benjamls Mar 18, 2026
f5f9dbe
Implement a input handler
benjamls Mar 18, 2026
c489a9d
Implement a resource manager
benjamls Mar 18, 2026
5706634
Update imports
benjamls Mar 18, 2026
0dbc345
Update Main to run the game
benjamls Mar 18, 2026
eaa3fdd
Update lobby to be able to start game with only one player
benjamls Mar 18, 2026
421a941
Add abstract GameState base class for GoF State pattern
benjamls Mar 20, 2026
35d609a
Add MainMenuState to manage main menu lifecycle
benjamls Mar 20, 2026
3ed3dd2
Add SetupState with piece placement, budget, and home zone logic
benjamls Mar 20, 2026
d2808a6
Add LobbyState with lobby creation and game ID generation
benjamls Mar 20, 2026
9f381a1
Add InMatchState with move execution and turn management
benjamls Mar 20, 2026
a9234ac
Add Board model with piece placement, movement, and query methods
benjamls Mar 20, 2026
8162120
Add Lobby model with game ID generation and expiry handling
benjamls Mar 20, 2026
d83ed3f
Add Move model to represent a single board move
benjamls Mar 20, 2026
d1f4264
Add MoveHistory with append-only move log and turn switching
benjamls Mar 20, 2026
5af2981
Add Player model with budget tracking and ready state
benjamls Mar 20, 2026
9eb24c5
Add abstract ChessPiece base class with slide and step movement helpers
benjamls Mar 20, 2026
eac3359
Add Bishop piece with diagonal movement
benjamls Mar 20, 2026
2e2138f
Add King piece with one-step movement in all directions
benjamls Mar 20, 2026
8ae5863
Add Knight piece with L-shaped movement
benjamls Mar 20, 2026
ff05f6a
Add Pawn piece with forward movement and diagonal captures
benjamls Mar 20, 2026
03e06d6
Add Queen piece with combined rook and bishop movement
benjamls Mar 20, 2026
ff3fb6d
Add Rook piece with horizontal and vertical movement
benjamls Mar 20, 2026
ebdce5d
Improve mainMenuScreen layering
benjamls Mar 20, 2026
467ef71
Improve lobbyScreen layering
benjamls Mar 20, 2026
59dcc6f
Improve setupScreen layering
benjamls Mar 20, 2026
74bb75c
Improve gameScreen layering
benjamls Mar 20, 2026
4505e25
Implement sprites for chesspieces
benjamls Mar 20, 2026
7be995a
Merge pull request #46 from raavocat/GameState-Layer
benjamls Mar 21, 2026
29afd29
feat(AndroidFirebase): Complete Firebase multiplayer implementation
benjamls Mar 23, 2026
90475b1
feat(AndroidLauncher): Initialize Firebase bridge on app launch
benjamls Mar 23, 2026
f86d6b5
feat(DatabaseManager): Add singleton manager for Firebase API access
benjamls Mar 23, 2026
4820338
feat(FirebaseAPI): Define complete Firebase interface for multiplayer
benjamls Mar 23, 2026
b1d5e99
Update GameScreen to implement firebase and multiplayer support
benjamls Mar 23, 2026
6ddcfb9
Update LobbyScreen to implement firebase and multiplayer support
benjamls Mar 23, 2026
e2b0318
Update SetupScreen to implement firebase and multiplayer support
benjamls Mar 23, 2026
590d6b5
Update LobbyState to implement firebase and multiplayer support
benjamls Mar 23, 2026
e80ee8c
Add Heartbeat and fix game logic
benjamls Mar 23, 2026
ac24380
feat: Implement pawn promotion and 2 tile move
benjamls Mar 24, 2026
51d142d
Improve modularity for gamescreen
benjamls Mar 24, 2026
26118d5
Improve modularity for setupscreen
benjamls Mar 24, 2026
2d691f4
Improve modularity for lobbyscreen
benjamls Mar 24, 2026
2542fa5
Improve modularity for mainMenuScreen
benjamls Mar 24, 2026
f4094c6
Merge pull request #47 from TDT4240-14/Database-Layer
benjamls Mar 24, 2026
760ae59
fix: orientation now portait
Mar 26, 2026
07d9cc6
Fix: Make sliders for balance and board size dissapear after lobby cr…
benjamls Mar 26, 2026
9e7992c
Implement feature to unconfirm setup and prevent setup when confirmed
benjamls Mar 28, 2026
96800a0
Merge pull request #50 from TDT4240-14/BugFix
benjamls Mar 30, 2026
7d71a4b
fix: add listener lifecycle management and confirmSetup error handlin…
Apr 6, 2026
defafb4
feat: implement circuit breaker with closed/open/half-open states (#51)
Apr 6, 2026
2c3a751
refactor: enforce GUI→Logic→Database layer separation (#55)
Apr 6, 2026
6f7771f
Merge pull request #61 from TDT4240-14/refactor/layer-separation
jonasew Apr 8, 2026
aca5c04
Merge pull request #59 from TDT4240-14/fix/firebase-lifecycle-errors
jonasew Apr 8, 2026
96edb8d
Merge branch 'development' into feature/circuit-breaker
jonasew Apr 8, 2026
b21877f
Merge pull request #60 from TDT4240-14/feature/circuit-breaker
jonasew Apr 8, 2026
90797d4
Improve heartbeat/circuitbreak and networkhandlers
benjamls Apr 9, 2026
98ba2e8
Fix bug that allowed forfeit after a win/loss screen bugging the game
benjamls Apr 9, 2026
7e8a22d
Add castling
benjamls Apr 9, 2026
bf1d85b
Add en pessant
benjamls Apr 9, 2026
1d16c67
Split AndroidFirebase into several files for better modularity
benjamls Apr 9, 2026
dabb05e
Implement a game icon
benjamls Apr 9, 2026
a9a3144
Merge pull request #62 from TDT4240-14/Improve-circuitbreak
benjamls Apr 10, 2026
9d4a672
Add heartbeat/circuitbreak to setup
benjamls Apr 10, 2026
b0e67eb
Fix win/loss messages displaying correct message
benjamls Apr 10, 2026
17bafca
Fixed bug where unconfirming setup messed up firebase connection
benjamls Apr 10, 2026
e3e753a
Add README.md
benjamls Apr 12, 2026
2177d4b
Merge pull request #63 from TDT4240-14/Add-heartbeat/circuitbreak-to-…
benjamls Apr 12, 2026
c6db25f
Added a seperate screen for joining a lobby
Apr 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# https://editorconfig.org
root = true

[*]
indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{java,scala,groovy,kt,kts}]
indent_size = 4

[*.gradle]
indent_size = 2

[*.md]
trim_trailing_whitespace = false
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text=auto eol=lf
*.bat text=auto eol=crlf
167 changes: 167 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
## Gradle:
.gradle/
gradle-app.setting
/build/
/android/build/
/core/build/
/lwjgl2/build/
/lwjgl3/build/
/html/build/
/teavm/build/
/ios/build/
/ios-moe/build/
/headless/build/
/server/build/
/shared/build/

## Java:
*.class
*.war
*.ear
hs_err_pid*
.attach_pid*

## Android:
/android/libs/armeabi-v7a/
/android/libs/arm64-v8a/
/android/libs/x86/
/android/libs/x86_64/
/android/gen/
/android/out/
local.properties
com_crashlytics_export_strings.xml

## Robovm:
/ios/robovm-build/

## iOS:
/ios/xcode/*.xcodeproj/*
!/ios/xcode/*.xcodeproj/xcshareddata
!/ios/xcode/*.xcodeproj/project.pbxproj
/ios/xcode/native/
/ios/IOSLauncher.app
/ios/IOSLauncher.app.dSYM

## GWT:
/html/war/
/html/gwt-unitCache/
.apt_generated/
/html/war/WEB-INF/deploy/
/html/war/WEB-INF/classes/
.gwt/
gwt-unitCache/
www-test/
.gwt-tmp/

## TeaVM:
# Not sure yet...

## IntelliJ, Android Studio:
.idea/
*.ipr
*.iws
*.iml

## Eclipse:
.classpath
.project
.metadata/
/android/bin/
/core/bin/
/lwjgl2/bin/
/lwjgl3/bin/
/html/bin/
/teavm/bin/
/ios/bin/
/ios-moe/bin/
/headless/bin/
/server/bin/
/shared/bin/
*.tmp
*.bak
*.swp
*~.nib
.settings/
.loadpath
.externalToolBuilders/
*.launch


## NetBeans:

/nbproject/private/
/android/nbproject/private/
/core/nbproject/private/
/lwjgl2/nbproject/private/
/lwjgl3/nbproject/private/
/html/nbproject/private/
/teavm/nbproject/private/
/ios/nbproject/private/
/ios-moe/nbproject/private/
/headless/nbproject/private/
/server/nbproject/private/
/shared/nbproject/private/

/nbbuild/
/android/nbbuild/
/core/nbbuild/
/lwjgl2/nbbuild/
/lwjgl3/nbbuild/
/html/nbbuild/
/teavm/nbbuild/
/ios/nbbuild/
/ios-moe/nbbuild/
/headless/nbbuild/
/server/nbbuild/
/shared/nbbuild/

/dist/
/android/dist/
/core/dist/
/lwjgl2/dist/
/lwjgl3/dist/
/html/dist/
/teavm/dist/
/ios/dist/
/ios-moe/dist/
/headless/dist/
/server/dist/
/shared/dist/

/nbdist/
/android/nbdist/
/core/nbdist/
/lwjgl2/nbdist/
/lwjgl3/nbdist/
/html/nbdist/
/teavm/nbdist/
/ios/nbdist/
/ios-moe/nbdist/
/headless/nbdist/
/server/nbdist/
/shared/nbdist/

nbactions.xml
nb-configuration.xml

## OS-Specific:
.DS_Store
Thumbs.db

## Miscellaneous:
*~
*.*#
*#*#
/.kotlin/
/assets/assets.txt

## Special cases:

## There is a resource-config.json file generated by nativeimage.gradle if you use Graal Native Image.
## Some usage may need extra resource configuration in a different file with the same name.
## You could also add that configuration to the text in nativeimage.gradle .
## You should delete or comment out the next line if you have configuration in a different resource-config.json .
**/resource-config.json

google-services.json
service-account.json
77 changes: 75 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,76 @@
# TDT4240

Test of development branch
# Regicide Chess

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.

## Project Structure

The project follows the standard LibGDX multi-module layout:

```
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.
```

- **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)

## Compilation and Execution

### 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.
27 changes: 27 additions & 0 deletions android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
<application
android:allowBackup="true"
android:fullBackupContent="true"
android:icon="@drawable/ic_launcher"
android:isGame="true"
android:appCategory="game"
android:label="@string/app_name"
tools:ignore="UnusedAttribute"
android:theme="@style/GdxTheme">
<activity
android:name="com.group14.regicidechess.android.AndroidLauncher"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:configChanges="keyboard|keyboardHidden|navigation|orientation|screenSize|screenLayout"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>

</manifest>
Loading