How zonh-off/beetopiagame works
Project type and purpose
• This is a Unity-based 2D game (“BeetopiaGame”) built entirely in the Unity Editor.
• It uses Unity Scenes, GameObjects, MonoBehaviours, ScriptableObjects and a manager-based architecture to drive game logic, data loading, entity spawning, crafting and UI.
High-level file structure analysis
• Assets/Beetopia/Scenes: Unity scene definitions (Level0.unity).
• Assets/Beetopia/Scripts: C# code, subdivided into Core (entry point, managers, systems, interfaces), Entities (MonoBehaviours for bees, placed objects), ScriptableObjects (data definitions), Utils and View (UI code).
• Assets/Beetopia/ScriptableObjects: Data assets for entities, items, placeables, recipes.
• Assets/Beetopia/Prefabs & Art & Audio & Shaders: Visual, audio, prefab assets.
• Assets/Plugins: Third-party libraries (DOTween, Graphy, NaughtyAttributes, TextMeshPro).
• ProjectSettings & Packages: Unity configuration and package manifests.
Main components
a. Unity Engine + Editor (top-level container)
b. Entry Point
– EntryPoint.cs initializes core services.
c. Core Managers (singletons orchestrating subsystems)
– DataManager: loads ScriptableObjects into GameData/GameAssets
– GameManager: high-level state machine
– InputManager: receives player input
– EntityManager & UnitsManager: spawn and track bee units
– TaskManager & QuestManager: generate and track player objectives
– PlacementManager & ObjectPlaceSystem (with PlacingState/RemovingState)
– WorldExpansionManager: handles map growth
– SaveManager/FileManager: persistence
d. Systems
– UnitsSpawnSystem: entity instantiation
– SaveSystem: file I/O
e. Data Layer
– ScriptableObjects folder: entity definitions, item definitions, recipes, placeable object definitions
– GridDatabase: map data
f. Entities & Components
– BeeUnitBehaviour, BasePlacedObject, CraftingObject, StorageObject, CropObject, WaterWellObject
– Implement core interfaces: IInteractable, IHarvest, IItemStorage, IRecipeStorage, IPlacementState, ITask
g. UI Layer
– View prefabs (pfButtonWithIconUI, pfInventoryCanvas, pfTooltipCanvas, pfSelectRecipeWorldCanvas, etc.)
– View side-panel controllers (BeeListUI, StorageUI, ShopUI, WorldExpansionUI)
– WelcomeUI, Debug Text
h. Plugins & Tools
– DOTween: animations and tweens
– Graphy: in-game performance monitor
– NaughtyAttributes: editor enhancements
– TextMeshPro: rich text UI
Relationships and data flow
1. At scene load, EntryPoint instantiates DataManager → loads all ScriptableObjects into in-memory structures.
2. GameManager initializes all sub-managers in sequence (Input → Entity → Task → Quest → Placement → WorldExpansion).
3. InputManager reads from Unity’s Input System asset (PlayerInputActions) and dispatches to GameManager or directly to PlacementManager / EntityManager.
4. EntityManager & UnitsSpawnSystem use GameAssets data to spawn BeeUnitBehaviour instances on the grid from GridDatabase.
5. PlacementManager + ObjectPlaceSystem enforce placement rules and update the world state via IPlacementState implementations.
6. TaskManager generates tasks (CollectWorldItemTask, DeliverItemTask, etc.) that QuestManager wraps into quests.
7. UI Layer subscribes to managers’ events, reads current game state, and updates canvases (inventory, tooltips, side-panels).
8. SaveManager periodically (or on command) serializes GameData to disk via FileManager.
Architectural patterns and principles
• Data-driven design via ScriptableObjects
• Manager singleton facades for subsystems
• Component-based entities (MonoBehaviour + interfaces)
• State pattern in PlacementManager (PlacingState, RemovingState, PreviewSystem)
• Separation of concerns: Core vs. Entities vs. View vs. Data
Technologies & frameworks to call out
• Unity 2021+ with Universal RP
• C# 8.0 MonoBehaviours & ScriptableObjects
• Unity Input System (PlayerInputActions.inputactions)
• DOTween (animation/tween library)
• TextMeshPro (UI text rendering)
• Graphy (performance debug overlay)
• NaughtyAttributes (editor scripting)