Mount System Details - NEW {{ currentPage ? currentPage.title : "" }}

Overview

The ACF Mount System provides a flexible and robust way to implement mounting and dismounting mechanics in Unreal Engine games. It allows characters to interact with mountable entities, take control of them, and seamlessly switch between mounted and on-foot gameplay. This system supports both AI and player-controlled mounts, as well as complex interactions like custom mount points and rider animations.


Core Features

  1. Mounting and Dismounting:

    • Supports multiple mount points.

    • Handles possession logic for rider and mount.

    • Allows dismounting at predefined or dynamic points.

  2. Replication:

    • Fully replicated for multiplayer environments.

    • Syncs rider and mount states across the network.

  3. Customizable Interactions:

    • Custom mount points using UACFMountPointComponent.

    • Rider actions triggered while mounted.

    • Modular integration with animation systems.

  4. AI and Player Integration:

    • Compatible with both AI and player characters.

    • Includes logic for AI-controlled mounts.


Key Classes and Components

1. UACFMountableComponent

The primary component for defining mountable entities.

  • Responsibilities:

    • Manages mount points and their locations.

    • Handles the mounted state and rider assignment.

    • Provides functionality for triggering rider actions.

  • Key Properties:

    • bIsMounted: Tracks if the entity is currently mounted.

    • rider: Reference to the current rider.

    • mountMeshOverride: Optional override for the mount's skeletal or static mesh.

    • DefaultDismountPoint: Tag for the default dismount point.

  • Key Methods:

  • TriggerActionOnRider(FGameplayTag ActionState): Executes an action on the rider.

2. UACFRiderComponent

Manages the rider's interaction with mountable entities.

  • Responsibilities:

    • Handles mounting and dismounting logic for the rider.

    • Manages possession transitions between rider and mount.

    • Controls attachment and detachment to/from the mount.

  • Key Properties:

    • bIsRiding: Tracks if the character is currently mounted.

    • Mount: Reference to the current mount.

    • groupOwner: Optional reference to an AI group for AI riders.

  • Key Methods:

    • StartMount(UACFMountableComponent* mount): Initiates the mount process.

    • StartDismount(const FName& dismountPoint): Initiates the dismount process.

4. UACFRiderAnimInstance

Extends the character animation instance to support rider-specific animations.

  • Responsibilities:

    • Syncs rider animations with mount states.

    • Updates animation variables like mount speed and turn rate.

  • Key Methods:

    • NativeBeginPlay(): Initializes references to rider components.

    • NativeThreadSafeUpdateAnimation(float DeltaTime): Updates animation parameters based on mount state.


Workflow

Mounting Process

  1. The rider triggers StartMount on the UACFRiderComponent.

  2. The mount is validated via UACFMountableComponent::CanBeMounted.

  3. The rider attaches to the mount point, and the mount state is updated.

  4. Possession switches to the mount if needed.

Dismounting Process

  1. The rider triggers StartDismount on the UACFRiderComponent.

  2. The rider detaches from the mount point.

  3. The rider's state and collisions are reset.

  4. Possession switches back to the rider if needed.


Replication

  • bIsMounted and rider are replicated

  • Methods like OnRep_IsMounted and OnRep_Mount handle state synchronization on clients.

  • The system ensures smooth mounting and dismounting transitions in multiplayer games.


Customization and Extensibility

  1. Custom Mount Points:

    • Add multiple UACFMountPointComponent instances to a mountable entity.

    • Define unique tags for each mount point.

  2. Rider Actions:

    • Use TriggerActionOnRider to execute gameplay-specific actions while mounted.

  3. Animation Integration:

    • Extend UACFRiderAnimInstance to implement custom rider animations.

  4. Possession Logic:

    • Override HandlePossession in UACFRiderComponent for custom possession workflows.


Conclusion

The ACF Mount System provides a comprehensive framework for implementing mount and dismount mechanics. Its modularity and extensibility make it suitable for a wide range of use cases, from player-controlled mounts to AI companions and dynamic gameplay interactions.

{{{ content }}}