A classic and dynamic Snake Game implementation in Java featuring data persistence and progressive difficulty.
Snake Game is a highly interactive desktop game developed strictly in Java. It features persistent high scores and settings, dynamic levels of difficulty, and a custom UI. The project focuses on object-oriented programming, local file management, and graphical user interfaces using Java Swing.
Gameplay.mp4
Developed by: Camilo Andres Arias Tenjo
- Dynamic Difficulty: Three tailored levels (Easy, Medium, Hard) that directly modify the snake's initial length, movement speed, and spawn rates for both food and obstacles.
- Progressive Speed: As the snake eats, its speed gradually increases frame-by-frame until reaching a maximum cap limit of 0.05s.
- Custom Score Strategy: Every time the snake eats a mouse (food), the score increases by exactly one unit, regardless of the active difficulty tier.
- Data Persistence: Locally saves the game configuration (
Files/Config.txt) and historical score data (Files/Data.JSON). - Information & History Dashboard: Easily accessible history and general information panels via intuitive buttons located at the top right of the main menu.
- Core Language: Java
- UI Framework: Java Swing / AWT
- Data Serialization: JSON (Using Google Gson -
gson-2.8.2.jar) - Build Tool / Environment: Eclipse Java Builder / Standard JDK
Make sure you have the following prerequisites installed on your system before proceeding:
- Java Development Kit (JDK): Version 1.8 (Java 8) is required and specifically configured for this project.
Follow these steps to run the project on your local machine:
- Clone or Download the repository to your workspace directory.
- Setup the Library: Ensure that the
Libraries/gson-2.8.2.jarfile is properly added to your Java Build Path / Classpath so JSON persistence can work. - Compile the source code: Use your preferred IDE (Eclipse, VS Code, IntelliJ) to build the sources in the
src/directory. - Run the Game: Execute the main class located inside the presenter application package:
co.edu.uptc.presenter.Presenter
- Initial Length: 5 blocks
- Base Movement: 1 block per 0.8s
- Spawn Times: Food every 20s | Obstacles every 8s
- Speed Progression: Increases by 0.02s per food consumed (Max limit: 0.05s)
- Initial Length: 4 blocks
- Base Movement: 1 block per 0.5s
- Spawn Times: Food every 10s | Obstacles every 6s
- Speed Progression: Increases by 0.025s per food consumed (Max limit: 0.05s)
- Initial Length: 3 blocks
- Base Movement: 1 block per 0.2s
- Spawn Times: Food every 4s | Obstacles every 2s
- Speed Progression: Increases by 0.03s per food consumed (Max limit: 0.05s)