Basics
Warning
Page TBD.
Focus on the following when modifying- or creating features:
- Modular design: Organize code into distinct modules, with modular functionalities encapsulated within.
- Each module should be as independent as possible.
- Decouple components using events, e.g., OnStartedMovingTowardsPlayer.
- Use sub-folders if more separation is needed. E.g., Scripts/Entity, Scripts/Events, Scripts/Gameinput/Player.
Reusability: Avoid rewriting code. Keep commonly used methods in the global/util folder.
- For example: a script for GUID generation; or a struct used by several modules.
- Prefixes: Prefix script & classs names with their module/category for clarity, e.g., InventoryManager, InstanceBuildModeController.
- 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.
- Networking: Keep network framework separated from /Scripts. See network section for more info.
- Namespaces: Only use namespaces when absolutely necessary.
- Reasoning: to avoid each class having to import 5 external modules.