## The Market Simulator Toolkit:  AI-Guided Blueprint System Development for Unreal Engine 5 Marketplace

**Your Goal:** Create a robust and customizable "Market Simulator Toolkit" for the Unreal Engine 5 Marketplace. This toolkit will provide a foundation for building first-person simulation games centered around running a market stall, managing inventory, interacting with customers, and simulating a dynamic economy.  I have **zero experience** with Unreal Engine 5 and Blueprints, so please provide extremely detailed, step-by-step instructions and explanations for every action, assuming I know nothing.

**Toolkit Features:** (To be implemented in phases)

**Phase 1:  Core Mechanics and Player Setup**

1.  **Project Setup:**
    *   Create a new Unreal Engine 5 project (Blank template). Name it "MarketSimToolkit".
    *   Organize a clear and well-documented file structure that is easy for other developers to understand.

2.  **Player Character (Market Vendor):**
    *   **Blueprint:** "BP\_MarketVendor" (inherits from "Character").
    *   **Mesh:**  "SK\_MarketVendor" (a basic character mesh).
    *   **Movement:**  WASD, Space (jump - optional), Left Ctrl (crouch - optional), Shift (sprint - optional).
    *   **Animations:** "Anim\_Idle" (standing behind the stall), other animations as needed based on character actions.

3.  **Attribute System:**
    *   **Blueprint:**  "BP\_MarketAttributes" (inherits from "Object").
    *   **Variables:** Create Float variables for:
        *   "Money" (player's current funds)
        *   "Reputation" (how well-regarded the vendor is)
        *   "Energy" (optional - for stamina-based actions)
    *   **Functions:**  
        *   Modify attributes (increase, decrease).
        *   Check attribute values.
    *   **Documentation:**  Clearly document how developers can extend "BP\_MarketAttributes". 

4.  **Basic HUD:**
    *   **Widget Blueprint:** "WBP\_MarketHUD".
    *   **Displays:**
        *   Money Indicator (e.g., a coin icon with the amount).
        *   Reputation Meter (optional).
        *   Energy Bar (optional).
    *   **Customization:**  Make HUD elements easily modifiable. 

**Phase 2: Market Stall and Inventory Management**

1.  **Market Stall Actor:** 
    *   **Blueprint:** "BP\_MarketStall" (inherits from "Actor").
    *   **Mesh:**  "SM\_MarketStall" (a basic stall model). 
    *   **Variables:**
        *   "Inventory":  An array to store items for sale (using "Struct\_MarketItem" - see below).
        *   "DisplayArea":  A Box Collision component defining where items can be displayed.

2.  **Market Item Structure:**
    *   **Structure:** "Struct\_MarketItem" with:
        *   "ItemName" (String)
        *   "ItemDescription" (String)
        *   "ItemIcon" (Texture)
        *   "BasePrice" (Float)
        *   "Quantity" (Integer)

3.  **Inventory Management:**
    *   **Functions (in "BP\_MarketStall"):**
        *   "AddItem": Add an item to the stall's inventory.
        *   "RemoveItem": Remove an item from the inventory (after a sale).
        *   "RestockItem": Increase the quantity of an existing item.

4.  **Item Display:**
    *   **In "BP\_MarketStall":**
        *   Use the "DisplayArea" component to determine where items can be visually placed.
        *   Optionally: Implement a system to automatically arrange items on the stall.

5.  **Inventory UI:**
    *   **Widget Blueprint:** "WBP\_StallInventory" to manage the stall's inventory.
    *   **Functionality:**
        *   Add new items with details (name, description, price, quantity).
        *   Remove items.
        *   Restock items.
        *   Optional: Drag-and-drop support for organizing items.

**Phase 3: Customers, Transactions, and Economy**

1.  **Customer AI (Base):**
    *   **Blueprint:** "BP\_Customer" (inherits from "Character").
    *   **Mesh:** "SK\_Customer" (a basic customer character mesh).
    *   **Variables:**
        *   "Money" (Float): Amount of money the customer has.
        *   "ShoppingList" (Array of "Struct\_MarketItem"): Items the customer is looking to buy. 

2.  **Customer Behavior:**
    *   **Spawn System:** Implement a way to spawn customers near the market area. 
    *   **AI Logic:**
        *   Customers should approach stalls, browse items, decide whether to buy, and leave.
        *   Implement decision-making based on:
            *   Their "ShoppingList".
            *   Item prices and availability.
            *   Vendor's "Reputation".
        *   Optional: Implement different customer personalities (e.g., bargain hunters, impulsive buyers). 

3.  **Transaction System:**
    *   **Interaction:**  When a customer wants to buy an item, implement an interaction system (e.g., press "E" to initiate a sale).
    *   **Transaction Logic:**
        *   Check if the customer has enough money and if the item is in stock.
        *   If the transaction is successful:
            *   Deduct the price from the customer's "Money" and add it to the vendor's "Money".
            *   Remove the item from the stall's inventory.
            *   Optionally: Increase the vendor's "Reputation".

4.  **Dynamic Pricing:**
    *   **Blueprint:**  "BP\_EconomyManager" (inherits from "Object").
    *   **Variables:**
        *   "MarketDemand" (for different item types):  How much customers want certain items.
        *   "SupplyLevels" (for different item types):  How much of each item is available.
    *   **Price Fluctuation:**  Implement logic to adjust item prices in "BP\_MarketStall" based on:
        *   "MarketDemand" and "SupplyLevels".
        *   Time of day (e.g., prices might be higher during peak hours).
        *   Events (e.g., a festival could increase demand for specific items).

**Phase 4:  Day-Night Cycle, Time Management, and Environment**

1.  **Day-Night Cycle:**
    *   Rotating skybox with day/night transitions.
    *   Dynamic lighting that changes with the time of day.
    *   Accelerated time flow (e.g., 1 real minute = 1 game hour).

2.  **Time Management:**
    *   Implement a system to track the time of day and the days of the week.
    *   Optional: Allow the player to close their stall for the day or take breaks.

3.  **Environment:**
    *   **Market Area:** Create a dedicated marketplace area where multiple stalls can be placed.
    *   **Environment Assets:** Provide basic environment assets (e.g., cobblestone streets, market tables, awnings).
    *   **Sound Design:**  Add ambient market sounds and music. 

**Phase 5:  UI and Interactions**

1.  **Radial Menu:**
    *   **Widget Blueprint:** "WBP\_MarketRadialMenu".
    *   **Buttons:** 
        *   "Inventory": Open "WBP\_StallInventory".
        *   "Close Stall": (Optional) Shut down the stall for the day.
    *   **Functionality:** Right-click to open, click buttons for actions.

2.  **Customer Interactions:**
    *   **Dialogue:** Implement a simple dialogue system for customer interactions, using text-based prompts.
    *   **Trading Interface:** Display item details and prices during transactions.

3.  **Additional UI:**
    *   **Notifications:** Display messages to the player (e.g., "Item sold!", "Customer is looking for X").
    *   **Quest Log (Optional):**  Track optional quests or tasks given by customers or other NPCs.

**Phase 6:  Documentation and Marketplace Preparation**

1.  **Comprehensive Documentation:**
    *   Document every Blueprint, variable, function, and system in detail.
    *   Explain how to customize and extend the toolkit for different market simulations.
    *   Provide examples, use cases, and best practices.

2.  **Demo Level:**
    *   Build a demo level showcasing the toolkit's features with a working market stall and basic customer AI.

3.  **Marketplace Submission:**
    *   Package the toolkit according to Unreal Engine Marketplace guidelines.

**Final Notes:**

*   The focus of this prompt is on building a reusable and customizable toolkit for the Unreal Marketplace.
*   Act as your guide and instructor, providing detailed instructions on how to build the toolkit. You will learn and implement it yourself.
*   Providing feedback and seeking clarification as needed.
*   By completing this project, you will gain valuable experience in Unreal Engine 5 and Blueprint development while creating a potentially marketable product!