Skip to content

amirilf/soccer-stars

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Soccer Stars

A soccer game built with JavaFX and a combination of client-server & p2p networking.
Players compete in fast-paced matches where they control disc-shaped pieces to shoot a ball into the opponent's goal.

Lobby Request Gameplay

System Overview

┌─────────────┐         ┌─────────────┐
│   Client 1  │         │   Client 2  │
│             │         │             │
│  JavaFX UI  │         │  JavaFX UI  │
│ Game Engine │         │ Game Engine │
│  P2P (UDP)  │         │  P2P (UDP)  │
└──────┬──────┘         └──────┬──────┘
       │                       │
       │    TCP (Signaling)    │
       └───────────┬───────────┘
                   │
            ┌──────▼──────┐
            │   Server    │
            │             │
            │    Auth     │
            │ Matchmaking │
            │  SQLite DB  │
            └─────────────┘

Project Structure

soccer-stars/
├── src/main/
│   ├── java/ir/amirilf/soccerstars/
│   │   ├── client/              # Client-side code
│   │   │   ├── controller/      # JavaFX controllers
│   │   │   ├── game/            # Game engine & physics
│   │   │   ├── network/         # Network managers
│   │   │   └── exceptions/      # Client exceptions
│   │   ├── server/              # Server-side code
│   │   │   ├── network/         # Connection & session handling
│   │   │   ├── db/              # Database layer
│   │   │   ├── model/           # Data models
│   │   │   └── exceptions/      # Server exceptions
│   │   └── common/              # Shared code
│   │       ├── dto/             # Data transfer objects
│   │       ├── Config.java      # Configuration constants
│   │       └── Protocol.java    # Protocol definitions
│   └── resources/
│       ├── fxml/client/         # UI layouts
│       └── logback.xml          # Logging config
├── pom.xml                      # Maven configuration
├── run.sh                       # Launch script
└── soccer-stars.db              # SQLite database

Running the Application

Prerequisites

  • Java 21 or higher
  • Maven 3.6+

Build

rm soccer-stars.db
./mvnw clean compile
./mvnw exec:java -Dexec.mainClass="ir.amirilf.soccerstars.Main" -Dexec.args="server"
./mvnw exec:java -Dexec.mainClass="ir.amirilf.soccerstars.Main" -Dexec.args="client"

Using the Shell Script

rm soccer-stars.db
./run.sh com
./run.sh server
./run.sh client