Skip to content

cayscays/Flower-Box-Bounty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flower Box Bounty

Description

  • The project follows a 3‑tier architecture, keeping UI, core logic, and data access cleanly separated for maintainability and extensibility — so the database and UI can be swapped independently without refactoring core logic.
  • Flower Box Bounty is a farming game where players nurture plants that transform into fresh vegetables and fruits, which can then be crafted into items for gifting.

Table of Contents

Key Features

  • 🌱 Grow various plants into fresh produce in a flower box.
  • 🥫 Craft jams and pickles using harvested crops.
  • 🍅 Store and share produce, seeds, and canned goods with other players and NPCs, fostering a sense of community.

Technologies Used

  • Developed using .NET 7.0 and C#.
  • Integrated MongoDB and MongoDB.Driver for remote data storage and retrieval.
  • Utilized Windows Presentation Foundation (WPF) for creating an interactive user interface.

Design and Architecture

In this project, I have implemented the 3-tier architecture. The architecture's main components are as follows:

  • Presentation Layer: The graphic user interface.

  • Business Logic Layer: The core business logic and application functionality.

  • Data Access Layer: Controls the interactions with the MongoDB database, utilizing the MongoDB.Driver library to perform CRUD operations and data management.

In addition to the architectural design, I implemented the following design patterns:

  • Singleton: The CurrentUser class is implemented as a Singleton to ensure only a single instance exists. The locking mechanism is utilized to synchronize access to the creation of the CurrentUser instance, preventing multiple threads from creating multiple instances.

  • Builder: Players in the game can create preserved items using jars. These jars are stored in the database and possess attributes for the crops inside at any given moment. To achieve this, I have utilized the jars as ConcreteBuilder classes, rather than a constructor of the preserved items class. I've ensured that players can flexibly create preserved items, which align well with the pattern. Furthermore, this implementation is closed for modification yet open for extension, allowing the addition of more ConcreteBuilders for different types of preserved foods, enabling the creation of new varieties of preserved food in the game in the future.

Class Diagrams

This section contains visual representations of the project's architecture and design. Below are the class diagrams for each layer:

Presentation Layer

The following diagram offers an overview of the Presentation Layer, depicting the structure and relationships between View classes, ViewModel classes, and some relevant classes from the Logic Layer.

image

Data Access Layer

The following diagram displays static classes dedicated to conducting CRUD operations. Each class corresponds to a collection in the database.

The following diagram showcases classes representing structured data objects in the Data Access Layer. These classes define the structure and properties of the data stored in the database, ensuring compatibility and efficiency in data manipulation tasks between the layers.

image

Business Logic Layer

To ensure a well-organized structure, I've divided the Business Logic Layer into distinct modules, each module containing related components. See below for class diagrams illustrating selected modules:

  • Plant module:

  • User module:

  • Item module:

  • Preserve module:

  • Game state module:

  • Leaderboard module: The following class diagram presented here illustrates the connection between the Presentation Layer and Business Logic Layer for the leaderboard feature.

Additional diagrams: Npc module, Level module.


Thank you for reviewing Flower Box Bounty!

Created by cayscays.

About

Flower Box Bounty is a game I developed with C#, .NET, and MongoDB, featuring the 3-tier architecture and design patterns. The game allows players to nurture plants that transform into fresh vegetables and fruits, which can then be crafted into items for gifting.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages