Crafting System
Crafting System
Section titled “Crafting System”Crafting Data Structure
Section titled “Crafting Data Structure”Recipe and Trade Skill Framework
Section titled “Recipe and Trade Skill Framework”Create structured data system for crafting recipes and skill categories:
Struct_Recipe Components
Section titled “Struct_Recipe Components”- Name Text: Recipe display name
- Ingredients Array: Data table references for required items
- Ingredient_Quantity Array: Integer amounts for each ingredient
- Results Array: Data table references for created items
- Results_Quantity Array: Integer amounts for each result
Struct_Trade_Skill Components
Section titled “Struct_Trade_Skill Components”- Recipes Data Table: Collection of available recipes for this trade skill
- Skill Categories: Cooking, blacksmithing, woodworking, potion crafting, etc.
Data Table Organization
Section titled “Data Table Organization”Organize crafting data into logical database structure:
// Crafting Database StructureDatabase/├── Loot/│ ├── DT_Loot_Carrot│ ├── DT_Loot_Potato│ └── DT_Loot_Soup├── Recipe/│ └── DT_Recipe_Soup└── TradeSkill/└── DT_TradeSkill_Cooking
Recipe Example Setup
Section titled “Recipe Example Setup”Configure example soup recipe:
- Ingredients: Carrot and potato data tables
- Quantities: 1 carrot, 1 potato required
- Results: Soup data table
- Result Quantity: 1 soup created
Crafting UI Implementation
Section titled “Crafting UI Implementation”W_Crafting Widget Structure
Section titled “W_Crafting Widget Structure”Create comprehensive crafting interface:
Widget Layout
Section titled “Widget Layout”- Size: 800x400 for substantial crafting workspace
- Recipe Panel: 400x400 scrollable recipe list
- Ingredients Panel: 400x200 required materials display
- Results Panel: 400x150 crafted item preview
Visual Organization
Section titled “Visual Organization”- Background Images: Color-coded panels for visual clarity
- Scroll Boxes: Handle large recipe collections
- Button Integration: Confirm and close buttons for user control
Recipe Selection System
Section titled “Recipe Selection System”Enable recipe browsing and selection:
// Recipe Selection ImplementationOnRecipeButtonClick(SelectedRecipe) {current_recipe = SelectedRecipe;
// Clear previous displaysVerticalBox_Ingredients.ClearChildren();VerticalBox_Results.ClearChildren();
// Populate ingredient requirementsForEach(ingredient in recipe_ingredients) {ingredient_widget = CreateWidget(W_Inventory_Item, ingredient_data);VerticalBox_Ingredients.AddChild(ingredient_widget);}
// Show crafting resultsForEach(result in recipe_results) {result_widget = CreateWidget(W_Inventory_Item, result_data);VerticalBox_Results.AddChild(result_widget);}}
Crafting Station Integration
Section titled “Crafting Station Integration”Actor_Crafting_Station
Section titled “Actor_Crafting_Station”Create world-based crafting locations:
Station Components
Section titled “Station Components”Based on loot actor framework:
- Static Mesh: Crafting station appearance (anvil, cooking pot, workbench)
- Interaction System: F key to access crafting interface
- Trade Skill Assignment: Each station supports specific trade skill
Station Interaction
Section titled “Station Interaction”// Crafting Station ActivationOnInteract(PlayerCharacter) {PlayerCharacter.Interface_Load_Crafting_Station(TradeSkill_DataTable);// Opens crafting UI with station-specific recipes}
Crafting Station Variants
Section titled “Crafting Station Variants”Create specialized crafting locations:
- Cooking Station: Use cooking pot mesh with cooking trade skill
- Blacksmith Station: Anvil mesh with weapon/armor recipes
- Alchemy Station: Laboratory setup with potion recipes
- Woodworking: Carpentry table with building material recipes
Crafting Process Implementation
Section titled “Crafting Process Implementation”Recipe Validation and Execution
Section titled “Recipe Validation and Execution”Implement complete crafting workflow:
// Crafting Execution ProcessOnConfirmCraftingButtonClick() {if (selected_recipe.IsValid()) {// Validate player has required ingredientsif (F_Check_Inventory(recipe_ingredients, required_quantities)) {// Remove ingredients from inventoryInterface_Inventory_Remove(recipe_ingredients, required_quantities);
// Add crafted results to inventoryForEach(result in recipe_results) {Interface_Inventory_Add(result, result_quantity);}
// Provide crafting success feedbackSpawnCraftingSuccessEffects();}// F_Check_Inventory handles error messages for missing items}}
Crafting Integration
Section titled “Crafting Integration”- Inventory Validation: Use existing F_Check_Inventory function
- Resource Consumption: Use Interface_Inventory_Remove function
- Result Addition: Use Interface_Inventory_Add for crafted items
- UI Updates: Inventory widget automatically updates after changes
UI Polish and Integration
Section titled “UI Polish and Integration”Widget Positioning
Section titled “Widget Positioning”- Root Widget Integration: Add to main UI system
- Anchor: Middle center positioning
- Size to Content: Proper widget sizing
- Default Hidden: Open only when accessing crafting stations
User Experience Flow
Section titled “User Experience Flow”- Station Interaction: F key at crafting stations opens interface
- Recipe Browsing: Scroll through available recipes
- Ingredient Preview: See requirements before attempting craft
- Crafting Execution: Confirm button attempts crafting with validation
- Error Handling: Clear feedback when ingredients insufficient
Consumable Housing System
Section titled “Consumable Housing System”Housing Item Integration
Section titled “Housing Item Integration”Extend loot system for building mechanics:
Consumable Loot Properties
Section titled “Consumable Loot Properties”- Consumable Boolean: Mark items as usable from inventory
- Housing Items: Blocks, decorative objects, functional structures
Housing Placement System
Section titled “Housing Placement System”// Housing Item UsageOnInventoryItemConsume(LootItem) {if (F_Check_Inventory([LootItem], [1])) {housing_actor = SpawnActor(Actor_Housing);housing_actor.SetAppearance(LootItem.Appearance_3D);
StartMousePlacementMode(housing_actor);}}
Mouse Placement Controls
Section titled “Mouse Placement Controls”- Mouse Position: Convert screen position to world coordinates
- Grid Snapping: Snap placement to grid for clean building
- Left Click: Confirm placement and remove item from inventory
- Right Click: Cancel placement and destroy preview object
The crafting system provides deep progression mechanics while maintaining intuitive interfaces and clear feedback about resource requirements and availability.