Skip to content

0x1eo/FootballSim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Football Simulator (FootballSim)

A comprehensive Java-based football league management and simulation game that allows players to manage football clubs, simulate matches, and track season statistics.

๐Ÿ“‹ Project Information

  • Author: Leandro de Almeida Glรณrias Afonso
  • Student Number: 8220302
  • Class: LSIRC T1
  • Language: Java 21
  • Build Tool: Maven

๐ŸŽฎ Features

Core Functionality

  • Club Management: Manage football clubs with detailed player rosters
  • Match Simulation: Realistic football match simulation with events, goals, and statistics
  • Season Management: Complete season simulation with schedules and standings
  • Player Statistics: Track individual player performance and goal statistics
  • Formation System: Multiple tactical formations (4-4-2, 4-3-3, 5-3-2, 3-5-2)
  • Interactive UI: Console-based user interface for game interaction

Technical Features

  • Data Import/Export: JSON-based data management for clubs, players, and game state
  • HTML Generation: Automated HTML report generation for seasons, matches, and clubs
  • Event System: Comprehensive match event tracking (goals, fouls, cards, etc.)
  • Flexible Architecture: Modular design with clear separation of concerns

๐Ÿ—๏ธ Project Structure

src/main/java/pt/estg/lsirc/footballsim/
โ”œโ”€โ”€ Main.java                           # Application entry point
โ”œโ”€โ”€ game/                               # Game orchestration
โ”‚   โ”œโ”€โ”€ FootballManagerGame.java        # Main game controller
โ”‚   โ”œโ”€โ”€ UIManager.java                  # User interface management
โ”‚   โ””โ”€โ”€ PlayerGoalStat.java            # Player statistics tracking
โ”œโ”€โ”€ impl/                               # Core implementations
โ”‚   โ”œโ”€โ”€ data/                          # Data handling
โ”‚   โ”‚   โ”œโ”€โ”€ JsonDataImporter.java      # JSON data loading
โ”‚   โ”‚   โ””โ”€โ”€ ExporterHelper.java        # Data export utilities
โ”‚   โ”œโ”€โ”€ event/                         # Match events
โ”‚   โ”‚   โ”œโ”€โ”€ EventImpl.java             # Base event implementation
โ”‚   โ”‚   โ”œโ”€โ”€ GoalEventImpl.java         # Goal-specific events
โ”‚   โ”‚   โ”œโ”€โ”€ EventManagerImpl.java      # Event management
โ”‚   โ”‚   โ””โ”€โ”€ EventType.java             # Event type definitions
โ”‚   โ”œโ”€โ”€ league/                        # League management
โ”‚   โ”‚   โ”œโ”€โ”€ LeagueImpl.java            # League implementation
โ”‚   โ”‚   โ”œโ”€โ”€ SeasonImpl.java            # Season management
โ”‚   โ”‚   โ”œโ”€โ”€ ScheduleImpl.java          # Match scheduling
โ”‚   โ”‚   โ””โ”€โ”€ StandingImpl.java          # League standings
โ”‚   โ”œโ”€โ”€ match/                         # Match simulation
โ”‚   โ”‚   โ””โ”€โ”€ MatchImpl.java             # Match implementation
โ”‚   โ”œโ”€โ”€ player/                        # Player management
โ”‚   โ”‚   โ”œโ”€โ”€ PlayerImpl.java            # Player implementation
โ”‚   โ”‚   โ”œโ”€โ”€ PlayerPositionImpl.java    # Position management
โ”‚   โ”‚   โ””โ”€โ”€ PlayerPositionType.java    # Position types
โ”‚   โ”œโ”€โ”€ simulation/                    # Game simulation
โ”‚   โ”‚   โ””โ”€โ”€ DefaultMatchSimulatorStrategy.java
โ”‚   โ””โ”€โ”€ team/                          # Team management
โ”‚       โ”œโ”€โ”€ ClubImpl.java              # Club implementation
โ”‚       โ”œโ”€โ”€ TeamImpl.java              # Team implementation
โ”‚       โ”œโ”€โ”€ FormationImpl.java         # Formation system
โ”‚       โ””โ”€โ”€ FormationType.java         # Formation types
โ””โ”€โ”€ util/                              # Utility classes
    โ””โ”€โ”€ ArrayUtils.java                # Array manipulation helpers

๐Ÿš€ Getting Started

Prerequisites

  • Java 21 or higher
  • Maven 3.6 or higher

Installation

  1. Clone the repository

    git clone <repository-url>
    cd PP_8220302
  2. Quick Start (Recommended)

    # For Linux/macOS
    ./run.sh
    
    # For Windows
    run.bat
    
    # Using Make (if available)
    make run
  3. Manual Build and Run

    # Build the project
    mvn clean compile
    
    # Run the application
    mvn exec:java
    
    # Or run the main class directly
    java -cp target/classes pt.estg.lsirc.footballsim.Main
  4. Create Distributable JAR

    mvn package
    java -jar target/footballsim.jar

Maven Commands

  • Compile: mvn compile
  • Run: mvn exec:java
  • Generate JavaDoc: mvn javadoc:javadoc
  • Clean: mvn clean
  • Package: mvn package

๐Ÿ“Š Game Data

The game includes sample data for Portuguese football clubs:

Clubs

  • Sport Lisboa e Benfica (SLB) - Founded 1904, Estรกdio da Luz
  • Futebol Clube do Porto (FCP) - Founded 1893, Estรกdio do Dragรฃo

Data Files

  • src/main/resources/files/clubs.json - Club definitions
  • src/main/resources/files/players/Benfica.json - Benfica player roster
  • src/main/resources/files/players/Porto.json - Porto player roster

๐ŸŽฏ How to Play

  1. Start the Game: Run the main class to begin
  2. Club Selection: The system automatically assigns you a club to manage
  3. Season Management: Navigate through menu options to:
    • View your squad and player details
    • Check the season schedule
    • Prepare for upcoming matches
    • Simulate match rounds
    • View league standings and statistics
  4. Match Simulation: Watch realistic match simulations with detailed events
  5. Statistics: Track player goals, team performance, and league standings

๐Ÿ›๏ธ Architecture

The project follows a layered architecture pattern:

  • Game Layer: High-level game orchestration and UI
  • Implementation Layer: Core business logic implementations
  • Utility Layer: Helper classes and utilities
  • Contracts Layer: External API contracts (from apicontracts dependency)

Key Design Patterns

  • Strategy Pattern: Match simulation strategies
  • Factory Pattern: Object creation and initialization
  • Observer Pattern: Event management system
  • MVC Pattern: Clear separation of model, view, and controller

๐Ÿ“š Dependencies

  • JSON Processing: org.json:json:20250517
  • Jackson Core: com.fasterxml.jackson.core:jackson-*:2.15.2
  • API Contracts: com.ppstudios.footballmanager.api.contracts:apicontracts:1.0-SNAPSHOT

๐Ÿ“– Documentation

Comprehensive JavaDoc documentation is available in the javadoc/ directory. Open javadoc/index.html in a web browser to browse the full API documentation.

๐Ÿ”ง Configuration

The application uses several configuration files:

  • Maven Configuration: pom.xml
  • Club Data: src/main/resources/files/clubs.json
  • Player Data: src/main/resources/files/players/*.json

๐ŸŽจ HTML Generation

The game can generate HTML reports for:

  • Season summaries and standings
  • Individual match reports
  • Club profiles and statistics
  • League overviews

Generated HTML files appear in the project root directory.

๐Ÿšจ Error Handling

The application includes comprehensive error handling for:

  • Data loading failures
  • Invalid game states
  • File I/O operations
  • Match simulation errors

Critical errors will cause graceful application shutdown with informative error messages.

About

Football Simulator created for Programming Paradigms

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages