Skip to content

AlesandroDenisov/SaveLoadService

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SaveLoadService

Overview

This project showcases the implementation of a flexible and scalable Save/Load system. It supports saving player progress to PlayerPrefs and Yandex Games cloud storage. It also showcases the use of design patterns such as State Machine and Abstract Factory.


Key Highlights

  • Asynchronous loading support for Yandex Games cloud saving
  • Modular and scalable architecture for easy maintenance and expansion
  • Codebase using design patterns and clean code principles

Project Structure

SaveLoadService/
β”‚
β”œβ”€β”€ Data/
β”‚   β”œβ”€β”€ PlayerProgress.cs    # Stores key gameplay data
β”‚   └── SavesYG.cs           # Extends Yandex Games Plugin save system to support custom data
β”‚
β”œβ”€β”€ Factory/
β”‚   β”œβ”€β”€ IGameFactory.cs
β”‚   β”œβ”€β”€ GameFactory.cs       # Handles object creation
β”‚   β”œβ”€β”€ IStateFactory.cs
β”‚   └── StateFactory.cs      # Creates and manages game states
β”‚
β”œβ”€β”€ GameStateMachine/
β”‚   β”œβ”€β”€ IStateMachine.cs
β”‚   └── GameStateMachine.cs  # Manages transitions between game states
β”‚
β”œβ”€β”€ GameStates/
β”‚   β”œβ”€β”€ IState.cs            # Defines basic states that can run initialization logic, accept a payload on entry, and perform cleanup or transitions on exit
β”‚   β”œβ”€β”€ LoadProgressState.cs # A game state responsible for loading or initializing player progress and transitioning to the next state upon completion
β”‚   └── MockNextState.cs     # Any next state
β”‚
β”œβ”€β”€ SaveComponent/
β”‚   └── SaveTrigger.cs       # MonoBehavior component for saving player progress when the player enters the collider area on a scene
β”‚
β”œβ”€β”€ Services/
β”‚   β”œβ”€β”€ IService.cs                       # A base marker interface used to identify service classes
β”‚   β”œβ”€β”€ PersistentProgress/
β”‚   β”‚   β”œβ”€β”€ ISavedProgressReader.cs       # An interface for loading player progress data from a given PlayerProgress instance with read-only access
β”‚   β”‚   β”œβ”€β”€ ISavedProgressWriter.cs       # An interface for updating and reading player progress data from a given PlayerProgress instance
β”‚   β”‚   β”œβ”€β”€ IPersistentProgressService.cs # An interface for providing access to the current player progress for reading and updating across the game
β”‚   β”‚   └── PersistentProgressService.cs  # Provide a reference to the player progress
β”‚   β”œβ”€β”€ SaveLoad/            
β”‚   β”‚   β”œβ”€β”€ ISaveLoadService.cs           # Defines basic operations for saving, loading, and resetting player progress
β”‚   β”‚   β”œβ”€β”€ SaveLoadService.cs            # Handles saving, loading, and resetting player progress using PlayerPrefs and synchronizes progress data across game components
β”‚   β”‚   β”œβ”€β”€ IAsyncSaveLoadService.cs      # Defines an interface for asynchronous loading and saving of player progress, and load completion callback
└── └── └── YGAsyncSaveLoadService.cs     # Provides an asynchronous implementation of player progress saving and loading for the Yandex Games platform, integrating with YG SDK

Systems and Features

  1. SaveLoadService:

    • SaveLoadService
    • YGAsyncSaveLoadService
  2. PersistentProgressService:

    • Centralized access to player progress data
  3. Factory:

    • GameFactory handles object creation in the game scene
    • StateFactory handles states of the game
  4. GameStateMachine:

    • GameStateMachine manages game states
  5. Data:

    • PlayerProgress stores user data relevant to gameplay progression.
    • SavesYG extends the Yandex Games Plugin save system to support custom data

Patterns Used

  • State Machine:

    • GameStateMachine
  • Abstract Factory:

    • GameFactory
    • StateFactory
  • Dependency Injection:

    • Inject dependencies via a constructor (or a special Construct() method for MonoBehaviour classes)

Commit Descriptions

Name Description
init Start a project/task
build Project build or changes in external dependencies
sec Security and vulnerability fixes
ci CI configuration and script updates
docs Documentation updates
feat Adding new functionality
fix Bug fixes
perf Changes aimed at improving performance
refactor Code refactoring without fixing bugs or adding new features
revert Reverting previous commits
style Code style fixes (tabs, indents, dots, commas, etc.)
test Adding tests
chore Changes to the build process or auxiliary tools and libraries

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages