Learn more about the structure that each puzzle must stick to, as well as how to get started and what folder structure the framework has.
Before anything else, it is critical to understand how the puzzles will be structured in your project.
There are 3 types of elements in every puzzle:
- Puzzle Handler -- responsible for handling situations when the puzzle has been solved or failed. In other words, defines what actions will be taken on these critical events (e.g., solved puzzle -> open gates for the player).
- Puzzle Logic -- responsible for defining what kind of logic the puzzle is following; what player must accomplish in order to solve the puzzle, and what player's actions will lead to the failed condition (e.g., task: activate all triggers).
- Puzzle Trigger -- objects that the player will interact with in order to proceed with the puzzle (e.g., press a certain keyboard key in a dedicated zone). It should not contain any logic for puzzle solving. It can, however, contain the information for the Puzzle Logic, where it will be analyzed and the decision will then be given on whether or not this trigger helps to solve the puzzle.
Note that activating the trigger does not necessarily mean a successful move.
For example, the logic may require only a certain order in which the triggers are to be activated. In any case, the trigger will notify the logic entity of its activation, but only the logic will decide the validity of the step.
As what up to the in-scene setup, it is required to have the same game object in the scene for both Puzzle Handler and Logic. The triggers will be then stored as children to it. It will ensure clean and intuitive structure in the project hierarchy.
The framework provides a set of default components, so it is possible to create common, but yet costomizable, puzzles (almost) without any need to code.
It is also possible to extend the core classes in order to accomplish more complex and thoughtful puzzle experiences.
After you have imported the package into the project, the "PuzzleSystem" folder will appear in your hierarchy.
Inside you can find:
- Demo -- the levels for demonstration purposes including all needed components and assets for their functioning.
- Handlers -- basic handler component.
- Logics -- a set of various commonly used puzzle logics.
- Triggers -- a set of various commonly used triggers.
- Extras -- a set of additional assets for commonly used puzzles; less customizable, more specific solutions.
- Editor -- the folder that contains scripts that define the editor utility. You won't need these scripts in use of the system. The utility itself is accessible through the upper menu (Tools -> Puzzle System).