Skip to content

F4de10/Treasure-Hunt-GIS-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Treasure Hunt Game

An interactive geographic information system (GIS) educational game built with JavaFX. Players use real GIS raster analysis operations to discover hidden treasures across multiple game levels featuring different geographical layers.

Project Overview

Treasure Hunt Game is an educational application that combines gaming with geographic information science. Players navigate through Browns Pond using various GIS operations to analyze vegetation, development, hydrology, and elevation data layers to locate hidden treasures. The game features three progressive levels, each requiring strategic application of local, focal, and zonal raster operations.

Key Features

  • Interactive Map Interface: Click-based navigation with real-time visual feedback on multiple geographical layers
  • Comprehensive GIS Operations:
    • Local operations (sum, difference, mean, product)
    • Focal operations (minimum, maximum, mean, variety) with configurable radius and shape
    • Zonal operations (minimum, maximum, mean, count)
  • Multiple Geographical Layers: Switch between vegetation, development, hydrology, and elevation data
  • Progressive Difficulty: Three distinct game levels with unique challenges and treasure locations
  • Hint System: Progressive hints to guide players through GIS problem-solving
  • Dynamic Legend: Context-sensitive legend updates based on the active layer
  • Gradient Visualization: Automatic color gradient rendering for computed raster values

Technology Stack

  • Language: Java 11+
  • UI Framework: JavaFX 23.0.2.1
  • Architecture: Model-View-Controller (MVC) pattern
  • Data Format: ASCII Grid (.asc) raster files
  • Graphics: Java AWT BufferedImage with JavaFX integration

Prerequisites

  1. Java Development Kit (JDK): Version 11 or later

    • Download from Oracle or use your system's package manager
  2. JavaFX SDK: Version 23.0.2.1 or compatible

    • Download from Gluon
    • Extract to a known location on your system

Quick Start

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/Project_AG2411.git
    cd Project_AG2411
  2. Download and extract the JavaFX SDK to your preferred location

  3. Run the application using the instructions below for your operating system

Running the Application

Windows

  1. Open Command Prompt (Windows + R, type cmd, press Enter)

  2. Navigate to the project directory:

    cd C:\path\to\Project_AG2411
  3. Run the application (replace the path with your JavaFX SDK location):

    java --module-path C:\path\to\javafx-sdk-23.0-2.1\lib --add-modules javafx.controls -jar TreasureHuntGame.jar

macOS/Linux

  1. Open Terminal

  2. Navigate to the project directory:

    cd /path/to/Project_AG2411
  3. Run the application (replace the path with your JavaFX SDK location):

    java --module-path /path/to/javafx-sdk-23.0-2.1/lib --add-modules javafx.controls -jar TreasureHuntGame.jar

Usage Guide

Game Flow

  1. Select a Game: Choose from three available games on the welcome screen
  2. Analyze Layers: Switch between different geographical layers using the layer selection buttons
  3. Apply Operations: Use GIS operations to analyze and transform the data
  4. Find the Treasure: Click on the map to search for treasure based on the clues provided
  5. Use Hints: Request hints if you get stuck (limited per game)

Available Operations

Local Operations

Perform cell-by-cell operations between two layers:

  • Sum: Add corresponding cell values from two layers
  • Difference: Subtract one layer from another
  • Mean: Calculate average of corresponding cells
  • Product: Multiply corresponding cell values

Focal Operations

Analyze neighborhoods around each cell:

  • Minimum: Find minimum value in neighborhood
  • Maximum: Find maximum value in neighborhood
  • Mean: Calculate average value in neighborhood
  • Variety: Count unique values in neighborhood

Configuration options:

  • Radius: 1-10 cells
  • Shape: Square or circular neighborhood

Zonal Operations

Compute statistics within zones defined by another layer:

  • Minimum: Minimum value within each zone
  • Maximum: Maximum value within each zone
  • Mean: Average value within each zone
  • Count: Number of cells within each zone

Project Architecture

Project_AG2411/
├── src/main/
│   ├── java/
│   │   ├── TreasureHuntGame.java  # Main application and UI controller
│   │   ├── Layer.java              # Raster layer data model and operations
│   │   ├── GetHint.java            # Hint system logic
│   │   └── Cell.java               # Coordinate data structure
│   └── resources/
│       ├── vegetation.asc          # Vegetation layer data
│       ├── development.asc         # Development layer data
│       ├── hydrology.asc           # Hydrology layer data
│       └── elevation.asc           # Elevation layer data
├── bin/                            # Compiled classes and resources
├── lib/                            # JavaFX libraries
├── TreasureHuntGame.jar           # Executable JAR file
└── README.md

Core Classes

  • TreasureHuntGame: JavaFX Application entry point, handles UI rendering, event management, and game state
  • Layer: Encapsulates raster data and implements all GIS operations (local, focal, zonal)
  • GetHint: Manages progressive hint system for each game level
  • Cell: Simple data structure representing x,y coordinates

Configuration

The application uses embedded resources and requires no external configuration files. Game parameters are defined in the TreasureHuntGame class:

  • Treasure coordinates and values (per game level)
  • Search radius: 5 pixels
  • Layer file paths: embedded in resources directory
  • Window dimensions: 1000x700 pixels (game view), 400x400 pixels (welcome screen)

Performance Optimizations

  • Image Caching: ImageView caching enabled for improved rendering performance
  • Efficient Neighborhood Calculation: Optimized algorithms for circular and square neighborhood detection
  • HashMap-based Zonal Operations: O(1) zone lookup for fast zonal statistics
  • Single-pass Operations: Most raster operations implemented in single iteration

Troubleshooting

Common Issues

Issue: java command not recognized

  • Solution: Add JDK's bin directory to your system PATH environment variable

Issue: JavaFX modules not found

  • Solution: Verify the --module-path points to the correct lib directory in your JavaFX SDK installation

Issue: Application window appears blank

  • Solution: Ensure JavaFX libraries are compatible with your JDK version and operating system

Contributors

License

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

Acknowledgments

This project was developed as part of the AG2411 course, demonstrating the practical application of GIS concepts in an interactive educational format.

About

Interactive GIS educational game built with JavaFX featuring raster analysis operations and progressive treasure hunt challenges

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors