Skip to content

codeabuse/word-puzzle-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Word Puzzle Demo

Game screenshot

This demo provides an example of a game that uses Unity Gaming Services. In this game player reconstructs 4 words out of given letter clusters (2-4 letters long), words order on game board doesn't matter. Game puzzles (levels) are delivered via Remote Config.

Quick Start

Unity version 2022.3.11

After importing the project in Unity Editor, go to the UGS Dashboard (https://cloud.unity.com/), navigate to word-puzzle-demo project and add the following keys to the Remote Config (keys are available in Assets/WordPuzzle/Configuration/Runtime/ConfigKeys.cs):

  • puzzle_tutorial (JSON): contains single puzzle for the first app launch.

  • puzzle_sample (JSON): contains a set of puzzles of different lengths for the main game mode.

  • puzzle_sets (JSON): contains a set of words grouped by length (basically a dictionary for runtime puzzle generation (not implemented yet)).

    Important: double check that the imported project is connected to clound in Unity Hub

JSON Structures

  • Puzzle
    {
          "words": ["banana", "poison", "bunker", "melody"],
          "word_length": 6
    }
    

Puzzle can represent a single puzzle or just be a collection of words of the same length, which can be used to generate random puzzles in runtime.

  • Puzzle Set
    {
      "puzzles": [
      {
        "words": ["pepper", "casque", "engine", "flower"],
        "word_length": 6
      }, 
      {
        "words": ["monster", "gazette", "sweater", "pioneer"],
        "word_length": 7
      }]
    }
    

Project Architecture

Project does not implement any particular architectural approach (like MVVM) since its a simple demo. All classes are what they are and representing the model, the presentation and the controller altogether if required, but thanks to Single Responsibility Principle classes are very atomic and its easy to extract particular interfaces if needed. Zenject is used to wire up different components of the game and together with SRP provides enough flexibility for future development.

Packages:

Scenes:

  • Startup: app initialization occurs here through StartupHelper, which calls IStartupProcedure objects sequentially.
  • Menu: contains main menu.
  • Gameplay: main game scene.

Important Classes:

  • GameManager: controls the gameplay by retrieving settings and initializing gameplay loop. Injections: IPuzzleManager, IPopUpMenu.
  • GameBoard: creates game board and shows the end game screen when the puzzle is solved. Injections: IWordCutter, IPopUpMenu.
  • SettingsController: maintains Settings menu. Injections: IPuzzleManager.
  • ProjectInstaller: composition root of the project, binds ILoadProgressHandler and IPopUpMenu to their implementations.
  • GameplaySceneInstaller: composition root of the Gameplay scene, defines most of the project dependencies (prefab pools, signals etc).
  • RemoteConfigManager: retrieves the remote configuration for the game and creates PuzzleManager. Injections: ILoadProgressHandler.
  • WordCell, LetterCell, Letter, LettersCluster, ClustersDockArea: main gameplay elements.
  • SceneLoader: simplifies the scene loading configuration and completely
  • remove scenes manipulation from other classes. Implements IStartupProcedure interface.

Important Prefabs

  • Assets/WordPuzzle/Resources/ProjectContext.prefab - project context that is spawned once by Zenject and marked as DontDestroyOnLoad. Contains PopupMenu (end game/pause) and LoadingScreen as child objects.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published