Skip to content

Warning

Page TBD.

Basic Architecture Principles

  • Event-Driven Architecture: Leverage Events to decouple components. Use events to communicate between systems and components, enhancing modularity and reducing dependencies.
  • Validation: For player-related functionalities where host validation is required, structure the event requests such that they are sent to the host for approval before proceeding. Examples include interacting with characters or placing items, as demonstrated in our InteractWithCharacterRequest and PlaceInstanceObjectRequest: if a Player attempts to place an object in the world, the PlaceInstanceObjectRequest is thrown and received by the network component. After the network component has transmitted this and received a response, the network component will throw an PlaceInstanceObject event.
  • Scriptable Objects: Use ScriptableObjects for managing game data to ensure flexibility and ease of updates.

Asset and Scene Management

  • Scene Segmentation: Break scenes into smaller chunks under Scenes for better collaboration.
  • Prefab Usage: Use Prefabs for creating reusable components and minimize scene conflicts.

Version Control

  • Meta Files: Always include .meta files in your Version Control System (VCS) to ensure consistency.
  • Avoid Empty Folders: Use a .keep file to commit necessary empty folder structures.

External assets

  • Third-Party Assets: Store third-party assets like Plugins/Borodar separately and track any modifications.
  • External code: Using opensource code snippets is fine

Performance and Optimization

  • Update Optimization: Avoid heavy operations in Update(), stick to coroutines or event-driven designs where possible; grid based movement in an instance is more comparable to a game of chess than a first person shooter.
  • Memory Management: Manage memory efficiently, especially in high-frequency methods, to minimize garbage collection impact.

Common Patterns

  • Observer: Use for event-driven behaviors allowing scripts to respond to game events.
  • Singleton: Employ for components like Audio Managers where only one instance should exist.
  • Inheritance: Use to share common functionalities among different types, like Player, Enemy, and NPC inheriting from a Character class, the latter containing movement logic.
  • States/State Machines: Use to manage different behaviors (under the same input conditions).
  • Mediator: Direct script interactions within a system through a central mediator script.
  • Script Composition: Favor composition over inheritance to add capabilities to objects using separate script components.

Happy coding!