Recommendations

Recommendations & Best Practices

This section provides general recommendations and best practices to keep your codebase healthy and readable for your team. They are all optional, but if followed can improve code readability and cleanliness.

  • Keep your room classes as small as possible, delegating game-specific functionality to other composable structures.
  • Keep your synchronizeable data structures as small as possible
    • Ideally, each class extending Schema should only have field definitions.
    • Do not implement heavy game logic inside Schema structures. Some logic is fine, specially if they’re self-contained within the scope of the structure itself, mutating only its own properties.
  • Rooms should have as little code as possible, and forward actions to other structures
  • Your game logic may be handled by specialized structures, such as external functions, the Command Pattern →, or an Entity-Component System →.
Last updated on