Skip to content

giovihey/UFG

Repository files navigation

UFG - Ultimate Fighting Game

A fighting game built with Kotlin/Compose Desktop, WebRTC peer-to-peer networking, and a Go signaling server.

Official Documentation

Project Structure

game/              Kotlin/Compose Desktop game client
channel/           C++ WebRTC wrapper (JNI bridge via libdatachannel)
signaling_server/  Go WebSocket signaling server
docs/              MkDocs documentation site

Prerequisites

Tool Version Purpose
JDK 17+ Game (Kotlin) + JNI headers for channel
CMake 3.16+ Build C++ channel
Go 1.22+ Signaling server
Docker any Run signaling server easily

macOS

brew install cmake openjdk@17 go docker

export JAVA_HOME=$(/usr/libexec/java_home -v 17)

# Build libdatachannel from source
git clone --recurse-submodules https://github.com/paullouisageneau/libdatachannel.git
cd libdatachannel
cmake -B build -DCMAKE_INSTALL_PREFIX=/usr/local -DOPENSSL_ROOT_DIR=$(brew --prefix openssl)
cmake --build build -j$(sysctl -n hw.ncpu)
sudo cmake --install build

Linux (Ubuntu/Debian)

sudo apt-get update
sudo apt-get install -y cmake g++ libssl-dev openjdk-17-jdk-headless golang docker.io docker-compose

# Build libdatachannel from source
git clone --recurse-submodules https://github.com/paullouisageneau/libdatachannel.git
cd libdatachannel
cmake -B build -DCMAKE_INSTALL_PREFIX=/usr/local
cmake --build build -j$(nproc)
sudo cmake --install build

Windows

Install Visual Studio Build Tools 2022, CMake, JDK 17, Go 1.22+, and Docker Desktop.

You will also need make — install it via choco install make or use the underlying commands directly.

# Build libdatachannel from source (Git Bash or Developer Command Prompt)
git clone --recurse-submodules https://github.com/paullouisageneau/libdatachannel.git
cd libdatachannel
cmake -B build -DCMAKE_INSTALL_PREFIX=C:/libdatachannel
cmake --build build --config Release
cmake --install build --config Release

Alternatively, use vcpkg (your cats here):

vcpkg install libdatachannel:x64-windows

Build and Run

# 1. Build the C++ WebRTC bridge
make channel

# 2. Start the signaling server
make signaling

# 3. Run the game
make game

Running two players locally

# Terminal 1 — signaling server
make signaling

# Terminal 2 — player 1 (host, initiates WebRTC connection)
make host

# Terminal 3 — player 2
make game

Makefile Targets

Command Description
make signaling Start signaling server (Docker)
make game Run the game client
make host Run the game as host
make channel Build the C++ WebRTC wrapper
make all Start signaling + game
make down Stop Docker containers
make clean Full cleanup

Verify Your Setup

java -version      # 17+
cmake --version    # 3.16+
go version         # 1.22+
docker --version   # any recent version