JG-Framework is a Java-based engine for creating text-based games playable in the console.
This framework provides a structure for building adventure games with features like:
- Levels and Rooms: Define game maps with interconnected rooms using
Game.Rooms.RoomandGame.Rooms.Floor. - Enemies: Create different types of enemies (
Game.Enemies.Enemy) and bosses (Game.Enemies.Boss) with distinct behaviors (Game.Enemies.AttackBehaviour). - Dialogue System: Implement interactive dialogues using
Game.Dialogue.Dialogue. - Audio Management: Includes support for background music (
Game.Gameplay.audio.MusicManager) and sound effects (Game.Gameplay.audio.SoundManager). - Player Controls and States: Manage player actions and status through
Game.Gameplay.Controls.PlayerControllerandGame.Gameplay.Controls.PlayerStates. - Cutscenes: Display narrative cutscenes (
Game.Gameplay.Cutscenes.Cutscene). - Utility Tools: A
Game.Toolsclass provides helper functions for console clearing, user input, and more.
- Java Development Kit (JDK) installed.
The main entry point for the game is the main method in the Game.Main.Main class.
To compile and run the game:
- Navigate to the root directory of the project in your terminal.
- Compile the Java files. For example, if your compiled files go into a
bindirectory:(You might need to adjust the classpath depending on your setup and how you compile.)javac -d bin Game/Main/Main.java Game/Tools.java Game/Dialogue/Dialogue.java ... (and all other .java files)
- Run the game:
java -cp bin Game.Main.Main
The project is organized into several main packages:
Game/Main/: Contains core game loop classes likeMain,Title,WinScreen, andLoseScreen.Game/Levels/: Defines game levels (Level1,Level2, etc.) and their structure (Hierarchy).Game/Rooms/: Manages room creation (Room), layout (Floor), and special rooms likeStairs.Game/Enemies/: Handles enemy logic, including baseEnemy,Bosstypes, and theirAttackBehaviour.Game/Dialogue/: Provides theDialoguesystem for displaying text.Game/Gameplay/: Contains sub-packages for:audio/: Sound and music management (Audio,MusicManager,SoundManager).Controls/: Player input handling (PlayerController) and state (PlayerStates).Cutscenes/: Logic for displaying cutscenes (Cutscene).
Game/: Utility classes likeToolsandCredits.External/prototyping/: Contains experimental code likeDialogueing.
Game/Main/Main.java: The main entry point of the application.Game/Levels/Hierarchy.java: Defines the structure and content of game levels.Game/Gameplay/Controls/PlayerController.java: Handles player movement and interaction within the game world.Game/Enemies/Enemy.java: Base class for enemies.Game/Rooms/Room.java: Defines individual rooms and their exits.Game/Tools.java: Provides various utility functions.