Keybind System
Keybind System
Section titled “Keybind System”Planning Phase
Section titled “Planning Phase”Before implementing complex keybind systems, plan the complete input layout to avoid conflicts and ensure logical organization.
Keybind Layout Planning
Section titled “Keybind Layout Planning”Mobility Controls
Section titled “Mobility Controls”- Shift: Dodge roll and air dash (context-sensitive)
- Left Control: Walk/run toggle
- C: Sprint (with cooldown)
- Space: Jump and double jump
Combat Controls
Section titled “Combat Controls”- Left Click: Primary attack
- Right Click: Block or secondary attack
- Q: Ultimate attack ability
- E: Strong attack ability
- X: Stealth toggle
Interaction Controls
Section titled “Interaction Controls”- F: General interaction key
Ability Bar Layout
Section titled “Ability Bar Layout”Design ability bar to match physical keyboard layout for intuitive use:
- Logical Positioning: Mouse buttons on right side of screen, keyboard keys on left
- Spatial Consistency: Left click and right click positioned left and right respectively
- Key Order: E and Q in correct keyboard order, C and X positioned appropriately
Enhanced Input System Implementation
Section titled “Enhanced Input System Implementation”Input Action Creation
Section titled “Input Action Creation”Create input actions for each ability:
Input Action Files
Section titled “Input Action Files”- IA_Ability_01: Left click primary attack
- IA_Ability_02: Right click secondary attack/block
- IA_Ability_03: E key strong attack
- IA_Ability_04: Q key ultimate attack
- IA_Ability_05: C key sprint
- IA_Ability_06: X key stealth
Input Mapping Context
Section titled “Input Mapping Context”Configure IMC_Default with all ability mappings:
- Map each Input Action to appropriate physical input
- Ensure no conflicting key assignments
- Test each input responds correctly
Interface System
Section titled “Interface System”Create interface functions for clean ability communication:
Player Character Interface Functions
Section titled “Player Character Interface Functions”- Interface_Use_Ability_001 through Interface_Use_Ability_006
- Each interface function corresponds to specific ability slot
- Allows UI and character code to communicate consistently
Ability Bar Widget Implementation
Section titled “Ability Bar Widget Implementation”// Ability Bar Button EventsOnButton_LeftClick_Released() {PlayerCharacter.Interface_Use_Ability_001();}
OnButton_RightClick_Released() {PlayerCharacter.Interface_Use_Ability_002();}
// Continue for all 6 abilities...
Event Graph Organization
Section titled “Event Graph Organization”Multiple Event Graphs
Section titled “Multiple Event Graphs”Organize code using separate event graphs for better management:
- Event Graph_Abilities: All ability-related code
- Base Event Graph: Core character functionality
- Event Graph_Movement: Movement-specific code (if needed)
This organization prevents single graphs from becoming overwhelming.
Ability Code Structure
Section titled “Ability Code Structure”Enhanced Input Events
Section titled “Enhanced Input Events”Replace temporary keybinds with proper Enhanced Input events:
- Ability 001: Enhanced Input Action event for left click
- Ability 002: Enhanced Input Action event for right click
- Continue through all abilities
Animation Stance Integration
Section titled “Animation Stance Integration”Use animation stance switching to provide different abilities per weapon:
// Ability Implementation ExampleOnAbility001_Started() {switch(AnimationStance) {case Unarmed: PlayMontage(MagicAttack01); break;case Shield: PlayMontage(ShieldAttack01); break;case TwoHanded: PlayMontage(TwoHandedAttack01); break;case Rifle: PlayMontage(RifleShot); break;case Bow: PlayMontage(BowAttack01); break;case Stealth: PlayMontage(StealthAttack01); break;}}
Combat State Integration
Section titled “Combat State Integration”Ensure abilities properly trigger combat state:
- Add combat state activation to attack abilities (001, 002, 003, 004)
- Exclude utility abilities (sprint, stealth) from combat state
- Maintain 5-second combat duration after ability use
User Interface Integration
Section titled “User Interface Integration”Ability Bar Visual Design
Section titled “Ability Bar Visual Design”Create intuitive ability bar layout:
- Size: 800 width to accommodate 6 abilities
- Button Positioning: Centered layout with proper spacing
- Visual Hierarchy: Primary abilities (left/right click) prominently positioned
- Scaling: Smaller scale (0.25) for less critical abilities like stealth
Button Functionality
Section titled “Button Functionality”Each ability button requires:
- Visual Feedback: Hover and press states
- Interface Communication: Calls appropriate Interface_Use_Ability function
- Cooldown Display: Visual indication when abilities are unavailable
- Resource Cost Display: Show mana/stamina requirements
Input Action Configuration
Section titled “Input Action Configuration”Enhanced Input Settings
Section titled “Enhanced Input Settings”Configure each Input Action with proper settings:
- Trigger Conditions: Use “Started” trigger for immediate response
- Consumption: Set to consume input to prevent conflicts
- Modifiers: Apply any needed input modifiers
Input Mapping Context
Section titled “Input Mapping Context”Update IMC_Default context:
- Add mappings for all 6 ability actions
- Configure proper key bindings for each action
- Test all mappings respond correctly in-game
The keybind system provides the foundation for responsive, intuitive controls that scale across all game modes and ability types.