Skip to content

Inc44/HexaChess

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

386 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

HexaChess

Stars Forks Watchers Repo Size Language Count Top Language Issues Last Commit Release Sponsor

GliΕ„ski's hexagonal chess game implementation in Java.

HexaChess

⚠️ Disclaimers

  • HTTP/HTTPS: Due to the extreme difficulty of obtaining public CA certificates for local development servers, the HexaChess server currently uses HTTP. Use Cloudflare or similar services to enable an HTTPS proxy (e.g., via the SSL/TLS Full (Strict) encryption option). Otherwise, sensitive data such as passwords, tokens, and other information may be transmitted in plain text over the network and become vulnerable to interception by malicious actors.

πŸš€ Installation

From Source

git clone https://github.com/Inc44/HexaChess.git

Eclipse

Open Projects from File System...
Import source: `path/to/HexaChess`
Finish
Build Path > Configure Build Path... > Libraries > Modulepath
Add Library... > User Library > Next > User Libraries... > New...
User library name: `JavaFX21`
Add External JARs...
path/to/javafx-sdk-21/lib/*.jar
Apply and Close
Finish
Apply and Close
Run Configurations > Java Application > Main > Arguments
VM arguments: `--module-path "path/to/javafx-sdk-21/lib" --add-modules javafx.controls,javafx.fxml,javafx.graphics,javafx.media`

Terminal

Ensure these binaries are in your system's PATH:

  • Apache Maven - Version 3.9.11 tested
  • GraalVM CE Gluon - Version 23-dev+25.1 tested
  • JDK 21 - Version 21.0.9 tested (for Linux)
  • Visual Studio Community 2022 - Version 17.14.22 tested (for Windows) (optional, to build)

On Arch Linux:

sudo pacman -S maven jdk21-openjdk
sudo archlinux-java set java-21-openjdk
export GRAALVM_HOME="path/to/graalvm-java23-gluon"
mvn -v
java --version
$GRAALVM_HOME/bin/native-image --version

On Windows:

Visual Studio Installer

Language packs

  • English

Individual components

  • C++/CLI support for v143 build tools (Latest)
  • MSVC v143 - VS 2022 C++ x64/x86 build tools (Latest)
  • Windows Universal CRT SDK
  • Windows 11 SDK (10.0.26100.7175)
setx /M PATH "%PATH%;path\to\apache-maven\bin"
setx /M GRAALVM_HOME "path\to\graalvm-java23-gluon"
mvn -v
"%GRAALVM_HOME%"\bin\native-image --version
cd HexaChess
mvn -q clean gluonfx:run

πŸ—„οΈ Database Setup

On Arch Linux:

sudo pacman -S apache mariadb php php-apache phpmyadmin

PHP

sudo vim /etc/php/php.ini
extension=mysqli

phpMyAdmin

sudo vim /etc/httpd/conf/extra/phpmyadmin.conf
Alias /phpmyadmin "/usr/share/webapps/phpMyAdmin"
<Directory "/usr/share/webapps/phpMyAdmin">
	DirectoryIndex index.php
	AllowOverride All
	Options FollowSymlinks
	Require all granted
</Directory>

MariaDB

sudo systemctl stop mariadb
sudo mariadbd-safe --skip-grant-tables --skip-networking &
mariadb -u root
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password123';
FLUSH PRIVILEGES;
EXIT;
sudo kill $(pgrep mariadb)
sudo systemctl start mariadb

Apache

sudo vim /etc/httpd/conf/httpd.conf
#LoadModule mpm_event_module modules/mod_mpm_event.so
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
LoadModule php_module modules/libphp.so
AddHandler php-script .php
Include conf/extra/php_module.conf
Include conf/extra/phpmyadmin.conf
sudo systemctl restart httpd

On Windows:

XAMPP Control Panel

Start Apache and MySQL

  1. Open http://localhost/phpmyadmin
  2. Create database hexachess
  3. Import Looping/hexachess.sql

πŸ› οΈ Build from Source

Server

Linux

mvn -q clean gluonfx:build -Pserver

Client

Linux

mvn -q clean gluonfx:build

Windows

Open x64 Native Tools Command Prompt for VS 2022 instead of regular cmd

mvn -q clean gluonfx:build
mvn -q gluonfx:package & :: (optional, to produce .msi installer)

GluonFX doesn't link version information by default. Therefore, you need to manually link it:

rc /fosrc\windows\version.res src\windows\version.rc
cvtres /machine:x64 -out:src\windows\version.obj src\windows\version.res

Open "target\gluonfx\log\process-link-*.log"

Replace IconGroup.obj with version.obj, add quotes to paths containing spaces, and run the modified command

Example
link target\gluonfx\x86_64-windows\gvm\hexachess\launcher.obj target\gluonfx\x86_64-windows\gvm\tmp\SVM-*\im.bpu.hexachess.main.obj src\windows\version.obj j2pkcs11.lib java.lib net.lib nio.lib prefs.lib zip.lib sunmscapi.lib extnet.lib jvm.lib libchelper.lib advapi32.lib iphlpapi.lib secur32.lib userenv.lib version.lib ws2_32.lib winhttp.lib ncrypt.lib crypt32.lib mswsock.lib /NODEFAULTLIB:libcmt.lib /SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup comdlg32.lib dwmapi.lib gdi32.lib imm32.lib shell32.lib uiautomationcore.lib urlmon.lib winmm.lib glass.lib javafx_font.lib javafx_iio.lib prism_common.lib prism_d3d.lib /WHOLEARCHIVE:glass.lib /WHOLEARCHIVE:javafx_font.lib /WHOLEARCHIVE:javafx_iio.lib /WHOLEARCHIVE:prism_common.lib /WHOLEARCHIVE:prism_d3d.lib /OUT:target\gluonfx\x86_64-windows\hexachess.exe /LIBPATH:%USERPROFILE%\.gluon\substrate\javafxStaticSdk\21-ea+11.3\windows-x86_64\sdk\lib /LIBPATH:"%GRAALVM_HOME%"\lib\svm\clibraries\windows-amd64 /LIBPATH:"%GRAALVM_HOME%"\lib\static\windows-amd64

More details:

Android

mvn -q clean gluonfx:build gluonfx:package -Pandroid

🧾 Configuration

Set environment variable:

setx /M DB_URL your_database_url
setx /M DB_USER your_database_user
setx /M DB_PASS your_database_password
setx /M DEV_URL your_dev_api_url
setx /M PROD_URL your_prod_api_url
setx /M PORT your_server_port
setx /M KEY your_server_jwt_key

For Linux/macOS:

echo 'export DB_URL="your_database_url"' >> ~/.bashrc # or ~/.zshrc
echo 'export DB_USER="your_database_user"' >> ~/.bashrc # or ~/.zshrc
echo 'export DB_PASS="your_database_password"' >> ~/.bashrc # or ~/.zsh
echo 'export DEV_URL="your_dev_api_url"' >> ~/.bashrc # or ~/.zshrc
echo 'export PROD_URL="your_prod_api_url"' >> ~/.bashrc # or ~/.z
echo 'export PORT="your_server_port"' >> ~/.bashrc # or ~/.zshrc
echo 'export KEY="your_server_jwt_key"' >> ~/.bashrc # or ~/.zshrc

Or create a .env file or modify /etc/environment:

DB_URL=your_database_url
DB_USER=your_database_user
DB_PASS=your_database_password
DEV_URL=your_dev_api_url
PROD_URL=your_prod_api_url
PORT=your_server_port
KEY=your_server_jwt_key

Check by restarting the terminal and using:

echo %DB_URL%
echo %DB_USER%
echo %DB_PASS%
echo %DEV_URL%
echo %PROD_URL%
echo %PORT%
echo %KEY%

For Linux/macOS:

echo $DB_URL
echo $DB_USER
echo $DB_PASS
echo $DEV_URL
echo $PROD_URL
echo $PORT
echo $KEY

πŸ“– Usage Examples

Server

Open src/main/java/im/bpu/hexachess/server/Server.java and run.

Client

Open src/main/java/im/bpu/hexachess/Main.java and run.

πŸ› Bugs

  • Pressed challenge changes the background of the player item.

β›” Known Limitations

  • The existing version may be using material not covered during lessons (e.g., enum, AWT, Swing, URI, ImageIO, Thread, etc.).

🚧 TODO

Bug Fixes

  • Android Audio: Ensure audio works on Android.
  • Android Fonts: Ensure proper bold font and button icon rendering.
  • Android Icon: Fix the smaller icon in the launcher.
  • Windows Installer: Fix name, version, and add update functionality.
  • Upload Checks: Prevent malicious file URLs (e.g., avatar URLs).
  • Database Integration: Save played games, etc.
  • Multiplayer Mode: Fix failed initial join, defeat game over, disconnect not handled (infinite game).
  • Back Buttons: Ensure all back buttons work correctly (e.g., replace Cancel Button).
  • Tests: Pass all tests.
  • Performance: Use more multithreading/parallel execution.
  • Memory: Use more static and final.
  • Internationalization/Translation: Adapt UI for different languages (e.g., wrapText="true" or change size to fit).
  • Different Screen Sizes: Adapt UI for various screen dimensions.
  • Exceptions: Fix all exceptions (e.g., puzzles or multiplayer null piece, scene, etc.).

Organizational

  • Requirements: Follow the project requirements PDF.
  • Maven Profiles: Separate profiles for server and client builds.
  • Proper Executables: Separate server and client, packages, and resources.
  • Reflection: Use specific reflection groups for given platform.
  • Style Consistency: Make sure all styles are in style.css (e.g., width, height, etc.) instead of inline styles.
  • Theme Consistency: Make sure all colors are in light.css, dark.css, black.css instead of inline styles.
  • Size, Shape: Create CSS classes for font sizes, button sizes, rounded corners, etc.
  • Puzzles: Adapt PuzzleWindow.java and puzzlesWindow.fxml to follow existing code style and logic.
  • Help: Adapt HelpWindow.java and helpWindow.fxml to follow existing code style and logic.
  • Tests: Adapt Test.java to follow existing code style and logic.
  • Refactor: Reuse code from existing codebase instead of duplicating logic, create functions for items filling, frequent updates, etc.

New Features

  • Player Profile: Confirm change password, upload avatar.
  • Friends List: Add or remove friends and view online status.
  • Lobby: List online players for tournaments, players with challenges, matchmaking, and accepting or declining challenges.
  • PVP Mode: Offline player vs. player mode. Allow playing against self via /challenge.
  • Themes: Add more (e.g., Catppuccin).
  • Sound Effects: Add more (e.g., game start (challenge), game over (victory/defeat), and game events).
  • Animations: Smooth piece movement and captures.
  • Achievements: Add conditions.
  • Tournaments: Challenge players in a tournament format.
  • Leaderboards: Add more categories (e.g., fastest checkmate, games played).
  • Help: Add game rules and multiplayer explanation.
  • UI Test SQL: Create SQL to test achievements, puzzles, tournaments, and leaderboards UI.
  • Translations: Add more languages (e.g., Chinese, Italian, Japanese, Korean, Romanian, Spanish).
  • Password Recovery
  • Email Verification: Send verification email on registration to get isVerified mark.
  • Cache Deletion
  • API Caching
  • Synthesized/Chiptune Audio: Replace audio with generated sound.
  • Raw Config: Modify to not use io.github.cdimascio.dotenv.Dotenv.
  • Raw Server: Modify to not use com.sun.net.httpserver.
  • Enemy Movements: Highlight enemy possible moves (in red).
  • Game Settings: Implement configurable game options (e.g., white/black preferred color, aim assist).
  • Aim Assist: Highlight better moves with darker color shades.
  • LLM Chess Player: Add a large language model-based chess player for fun :) (and hallucinations (domain expansion, illegal moves, self-capture, etc.)).
  • Migration: Use Java 23 or 25.

πŸ™ Thanks

Creators of:

🀝 Contribution

Contributions, suggestions, and new ideas are heartily welcomed. If you're considering significant modifications, please initiate an issue for discussion before submitting a pull request.

πŸ“œ License

MIT

This project is licensed under the MIT License. See the LICENSE file for details.

πŸ’– Support

BuyMeACoffee Ko-Fi Patreon