Skip to content

iuliapetrisor/GwentStone-Engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PETRISOR IULIA-ALEXIA - 322CD

OOP HOMEWORK - GwentStone

Introduction

This project is an attemp to develop a simplified, yet functional, digital card game inspired by popular titles such as Gwent and Hearthstone. The game is played by two players on a 4×5 table and at the start of the game every player is presented a set of multiple decks, each containing a unique composition of cards. Each player then has to choose bewtween their available decks the best configuration for themselves. The players are also offered at the start of each game one random hero card. The game is turn-based and each player can perform a set of actions during their turn. The game ends when one of the players' hero dies.

Project Structure

gameData package

  • Card.java: Parent class for all card types.
  • Berserker.java, Disciple.java, Goliath.java, Miraj.java, Sentinel.java, TheCursedOne.java, TheRipper.java, Warden.java: Different types of minion cards with specific abilities and placements on the game table, extending the Card class.
  • Hero.java: Parent class for all hero types.
  • GeneralKocioraw.java, LordRoyce.java, EmpressThorina.java, KingMudface.java: Special hero card classes with unique abilities, extending the Hero class.
  • Deck.java: Class that represents a deck of cards.
  • Hand.java: Class that represents a player's hand of cards.
  • Table.java: Class that represents the game table where cards are placed during gameplay.
  • GameDataParser.java: Class that handles the parsing of game data from input sources to initialize the game state.

gameExecution package

  • Command.java: Interface for all commands that can be executed during the game.
  • CardUsesAbility.java, CardUsesAttack.java, GetCardAtPosition.java, GetCardsInHand.java, GetCardsOnTable.java, GetPlayerHero.java, GetFrozenCardsOnTable.java, GetPlayerDeck.java, GetPlayerMana.java, PlaceCard.java, UseAttackHero.java, UseHeroAbility.java: Different types of commands that can be executed during the game, each implementing the Command interface.
  • Match.java: Class that represents a game match between two players, executing the entire game logic.

main package

  • Main.java: Entry point of the application, used to run the game.
  • Test.java: Class used to test the game implementation.

Key Challenges Faced During Implementation:

  • Handling Game State: Managing the game state while adhering to object-oriented programming principles proved particularly challenging. The OOP design required the creation of different classes for commands, cards, and heroes, each interacting intricately. It was particularly difficult to ensure that the game state was updated correctly after each command execution. Ensuring data consistency and integrity across these classes was difficult, especially when actions occurred asynchronously or simultaneously.
  • One persistent issue that I could not resolve was an "index 0 out of bounds exception" encountered when attempting to iterate
  • the game logic across multiple games. Despite reinitializing game data and clearing previous states at the start of each game,
  • this error persisted, indicating a deeper flaw in state management that I have yet to rectify.
  • Iterating the game logic across multiple games: The game logic was designed to iterate across multiple games, with each game being initialized from the same input data, only changing the player decks, heroes, and shuffle seed. However, the game logic failed to execute correctly across multiple games. Every time I tried to restart the game by reinitializing the Match class with the appropriate GameInput (I did so by using a for loop that went from 0 to exactly the size of the the games array read from the input), I always ran into a IndexOutOfBounds exception. This was frustrating because I made sure to reset the game data correctly at the beginning of each game and to clear it afterward. Despite these efforts, the error persisted, highlighting a tricky issue in how the game state was managed across consecutive games that I have yet to identify.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published