Infinity Fortress is a console-based turn-based game with gacha elements. Something dark is dwelling underneath.
This is a (definitely simple) turn-based battle game with fantasy elements. Players can pull (or gamble their gems) to get characters with a change to get (nothing or) a powerful chracter.
- Pull From Banners: Yes! You read that right! Gacha-style character pulls. Pray to RNGesus accordingly.
- Battle AI Enemies: Unleash your chaotic arsenal and absolutely delete anything that looks at you funny.
- Item System: Loot. All. The. Things. Gather mountains of items and equipment to beef up your crew.
- 81 Characters: Thatβs rightβ81 characters to either obliterate or collect.
- Approximately 150+ Items To Discover: A treasure trove of gear waiting to charge your battle potential.
- Keyboard Inputs Supported: Itβs console-based but hey, keyboards actually work. Totally Overkill!
- ASCII ART!!??: VISUALIZE YOUR CHARACTERS IN BEAUTIFUL TEXT GLORY!! YOUR EYES ARENβT READY!!!
- Features Audio and Music: Waitβwe have sound now? Are weβ¦ game developers??
This project follows core objectβoriented principles to keep the codebase modular, maintainable, and easy to extend. Key practices and examples:
- Encapsulation: Most fields are
privateorprotected; access is exposed through methods (getters/setters) and behavior-bearing methods rather than direct field access. This keeps internal state safe and makes refactoring easier.
Example:
// Private character list and can be obtained through a getter
public class Enemy {
private ArrayList<NCharacter> characters = new ArrayList<>(Arrays.asList(null, null, null, null, null));
public Enemy() {
NCharacterFactory factory = new NCharacterFactory();
characters.set(0, factory.createDwarfTank(NCharacterType.ENEMY));
characters.set(1, factory.createBeastkinRogue(NCharacterType.ENEMY));
characters.set(2, factory.createDragonbornSummoner(NCharacterType.ENEMY));
characters.set(3, factory.createDwarfWarrior(NCharacterType.ENEMY));
characters.set(4, factory.createOrcWarlock(NCharacterType.ENEMY));
}
// Getter
public ArrayList<NCharacter> getCharacters() {
return characters;
}
}- Abstraction: Interfaces and abstract classes are used to hide implementation details. For example,
InputHandlerandAudioHandlerseparate the game logic from input and audio implementations so different handlers can be utilized without changing game code.
Example:
// Details about Inputhandler is abstracted
private void handleNavigation(MutableInt choice, int maxChoice, ArrayList<NCharacter> targets) {
if (InputHandler.right.get()) {
if (targets.size() > 2 && choice.value == targets.size() - 1) {
choice.value = 2;
} else if (choice.value % 3 < 2 && choice.value + 1 <= maxChoice) {
choice.value++;
}
InputHandler.right.set(false);
}
if (InputHandler.left.get()) {
if (targets.size() > 2 && choice.value == 3) {
choice.value = 0;
} else if (choice.value % 3 > 0) {
choice.value--;
}
InputHandler.left.set(false);
}
if (InputHandler.down.get()) {
if (choice.value <= 2 && choice.value + 3 >= targets.size() - 1 && targets.size() > 3) {
choice.value = targets.size() - 1;
} else if (choice.value + 3 <= maxChoice) {
choice.value += 3;
}
InputHandler.down.set(false);
}
if (InputHandler.up.get()) {
if (choice.value >= 3) {
choice.value -= 3;
}
InputHandler.up.set(false);
}
}- Inheritance: Some interface and classes share common behavior while allowing specialization (e.g., character and item subclasses). However, the code mostly favors composition because it improves clarity and reduces coupling.
Example:
// Interface Inheritance
public interface Items extends Visitable {
public String getName();
public String getType();
public String getRole();
public int getValue();
public int getHealth();
public int getMana();
public int getDefense();
public int getStrength();
public int getCritChance();
public int getCritStrength();
public int getSpeed();
public int getLuck();
public String getDescription();
public String getFlavorText();
public ItemRarity getRarity();
}- Polymorphism: Actions, effects, roles, races and items implement common interfaces or extend base classes and override behavior, enabling flexible strategies and Visitor/Strategy-like patterns across the codebase.
Example:
class SingleAllyHandler extends TargetingHandlerBase {
public SingleAllyHandler(Player player, Enemy enemy) {
super(player, enemy);
}
@Override
public boolean handle(MainBattleUI battleUI, NCharacter curr, Action selectedAction) {
ArrayList<NCharacter> allies = getAliveAllies(curr);
if (allies.isEmpty()) {
Printbox.showMessage(battleUI, "No valid ally targets available!");
return false;
}
TargetingSystem targetingSystem = new TargetingSystem(selectedAction, curr);
NCharacter target = targetingSystem.start(battleUI, allies);
if (target != null && processMP(curr, selectedAction, battleUI)) {
selectedAction.execute(curr, target); //Polymorphism
Printbox.showMessage(battleUI, selectedAction.getBattleMessage());
return true;
}
return false;
}
}π src/
βββ π main/
βββ π java/
βββ π com/
βββ π infinityfortress/
βββ β App.java
βββ β Player.java
βββ β Enemy.java
βββ π actions/
β βββ β Action.java
β βββ β AttackAction.java
β βββ β ...
βββ π battlesystem/
β βββ β BattleSystem.java
β βββ β ActionSystem.java
βββ π characters/
βββ π effects/
βββ π items/
βββ π races/
βββ π roles/
βββ π ui/
βββ π utils/
π src/main/resources/ β runtime assets (audio/*.wav)
π static/ β screenshots and README images (e.g., `static/battle.png`)
- OS: Windows 7 or higher (32-bit or 64-bit)
- Processor: Any modern CPU (Pentium 4 or newer)
- Memory: 512 MB RAM
- Storage: 100 MB available space
- Input: Keyboard
Ensure you have the following installed on your system:
- Java Development Kit (JDK) 21 or higher (tested with Java 21 and 24)
- Apache Maven
- A terminal or command prompt
-
Clone the repository:
git clone https://github.com/Codyaxe/infinity_fortress.git
-
Navigate to the project directory:
cd infinity_fortress -
Build the project using Maven:
mvn clean install
-
Use a terminal and navigate to the
targetdirectory:cd target -
Run the game:
java -jar infinity-fortress-1.0-SNAPSHOT.jar
Or run directly from the project root:
java -jar target/infinity-fortress-1.0-SNAPSHOT.jar
Or double click the run.bat file in the root folder
run.bat
The drunk devs that made this repo possible is brought to you by:
-
@Codyaxe: System and Utility Programmer
-
@Trill1um: UI and System Programmer
-
@HoYeJi: Game Balance and Designer
This project was created as part of an Object-Oriented Programming course. Special thanks to our OOP instructor for guidance during development.
