¿Por qué Unreal Engine 5?

Unreal Engine 5 representa un salto generacional en el desarrollo de videojuegos, introduciendo tecnologías revolucionarias que antes estaban reservadas para producciones AAA multimillonarias. Ahora, cualquier desarrollador independiente puede crear experiencias visuales de calidad cinematográfica:

  • Nanite: Geometría virtualizada que permite millones de polígonos en tiempo real
  • Lumen: Iluminación global dinámica sin necesidad de baking
  • Niagara: Sistema de partículas de nueva generación
  • Chaos Physics: Simulación física avanzada y destructible
  • MetaHuman Creator: Personajes fotorrealistas en minutos
  • World Partition: Mundos abiertos masivos sin límites
  • Blueprints Visual Scripting: Programación sin código
  • C++ moderno: Performance y flexibilidad máxima

Configuración del Entorno UE5

Instalación y Configuración Inicial

UE5 requiere un setup específico para aprovechar al máximo sus capacidades de nueva generación:

Epic Games Launcher y UE5

  1. Descarga Epic Games Launcher desde el sitio oficial
  2. Instala Unreal Engine 5.3+ (versión más estable)
  3. Instala Visual Studio 2022 con workload "Game development with C++"
  4. Configura DirectX 12 y drivers de GPU actualizados
  5. Mínimo 16GB RAM, recomendado 32GB para proyectos grandes
📋 Configuración Inicial del Proyecto UE5 ▼ Expandir
// Configuración recomendada para nuevo proyecto UE5:
// Template: Third Person (para comenzar)
// Target Platform: Desktop
// Quality Preset: Maximum (si tu hardware lo permite)
// Raytracing: Enabled (solo si tienes GPU compatible)
// Starter Content: Enabled (para aprender)

// En Project Settings > Engine > Rendering:
// - Default RHI: DirectX 12
// - Global Illumination: Lumen
// - Reflections: Lumen
// - Shadow Map Method: Virtual Shadow Maps
// - Anti-Aliasing Method: TSR (Temporal Super Resolution)

// En Project Settings > Engine > Physics:
// - Physics Solver: Chaos Physics Solver
// - Chaos - Use Unified Heightfields: True

Estructura del Proyecto UE5

Organiza tu proyecto desde el inicio para workflows profesionales:

📁 Estructura de Carpetas Recomendada ▼ Expandir
Content/
├── Art/
│   ├── Characters/
│   ├── Environment/
│   ├── Props/
│   ├── Materials/
│   ├── Textures/
│   └── Animations/
├── Audio/
│   ├── Music/
│   ├── SFX/
│   └── Voice/
├── Blueprints/
│   ├── Characters/
│   ├── Gameplay/
│   ├── UI/
│   └── Managers/
├── Maps/
│   ├── Levels/
│   ├── Sublevels/
│   └── Templates/
├── VFX/
│   ├── Niagara/
│   ├── Materials/
│   └── Textures/
└── Data/
    ├── DataTables/
    ├── Curves/
    └── Assets/

Fundamentos de Blueprints

Sistema de Blueprints Visual Scripting

Qué hace: Permite crear lógica de juego compleja usando un sistema visual de nodos, sin necesidad de escribir código. Ideal para designers y programadores que prefieren workflow visual.

Blueprint del Personaje (Character Blueprint)

🎮 Movimiento de Personaje en Blueprints ▼ Expandir
// Flujo de nodos para movimiento básico:

Input Action IA_Move → Enhanced Input Action Value
                   ↓
              Get Action Value (Vector2D)
                   ↓
              Add Movement Input
              (World Direction: Get Actor Forward Vector)
              (Scale Value: X del Vector2D)

Input Action IA_Look → Enhanced Input Action Value  
                   ↓
              Get Action Value (Vector2D)
                   ↓
              Add Controller Yaw Input (X del Vector2D)
              Add Controller Pitch Input (Y del Vector2D)

Input Action IA_Jump → Enhanced Input Action Value
                   ↓ 
              Pressed → Jump (Character Movement)
              Released → Stop Jumping

// Variables importantes:
// - Movement Component: Character Movement Component
// - Max Walk Speed: 600.0
// - Jump Z Velocity: 420.0
// - Air Control: 0.35
// - Ground Friction: 8.0

Sistema de Estados y Animaciones

🏃 Animation Blueprint - Estado de Movimiento ▼ Expandir
// En el Animation Blueprint (Event Graph):

Event Blueprint Update Animation
         ↓
Try Get Pawn Owner → Cast to ThirdPersonCharacter
         ↓
Get Velocity → Vector Length → Set Speed (float variable)
         ↓
Get Movement Component → Is Falling → Set Is In Air (bool variable)
         ↓
Get Movement Component → Get Current Acceleration → Vector Length
         ↓
Greater (> 0.0) → Set Should Enter Idle (bool variable)

// State Machine (Locomotion):
// Estados: Idle, Walk/Run, Jump Start, Jump Loop, Jump Land
// Transiciones:
// Idle → Walk/Run: Speed > 3.0
// Walk/Run → Idle: Speed <= 3.0 AND Should Enter Idle
// Any State → Jump Start: Is In Air = True AND Not Was In Air
// Jump Start → Jump Loop: Time Remaining (ratio) < 0.1
// Jump Loop → Jump Land: Is In Air = False
// Jump Land → Idle/Walk: Animation finished

Gameplay Framework en Blueprints

Qué hace: Implementa los sistemas core del juego usando Game Mode, Game State, Player State y Player Controller para arquitectura escalable.

🎯 Game Mode Blueprint - Sistema de Puntuación ▼ Expandir
// Variables del Game Mode:
// - Current Score (Integer)
// - Max Score (Integer) = 1000
// - Game Timer (Float) = 300.0
// - Is Game Active (Boolean) = True

// Event Begin Play:
Event Begin Play
     ↓
Set Timer by Function Name
(Function Name: "UpdateGameTimer", Time: 1.0, Looping: True)

// Función Custom: Add Score
Function Add Score (Points: Integer)
     ↓
Current Score + Points → Set Current Score
     ↓
Branch: Current Score >= Max Score
True → Call Function: End Game (Victory)
False → Update UI Score Display

// Función Custom: Update Game Timer  
Function Update Game Timer
     ↓
Game Timer - 1.0 → Set Game Timer
     ↓
Branch: Game Timer <= 0.0
True → Call Function: End Game (Time Up)
False → Update UI Timer Display

// Función Custom: End Game
Function End Game (Reason: Enum)
     ↓
Set Is Game Active = False
     ↓
Clear Timer by Function Name: "UpdateGameTimer"
     ↓
Switch on Enum (Reason):
- Victory → Show Victory Screen
- Time Up → Show Game Over Screen
- Player Death → Show Death Screen

Programación en C++ con UE5

Clases Base de UE5

Qué hace: Implementa lógica de juego en C++ para máximo performance, especialmente útil para sistemas complejos, IA avanzada y optimizaciones críticas.

⚡ Character Class en C++ - Movimiento Avanzado ▼ Expandir
// GameCharacter.h
#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "InputActionValue.h"
#include "Components/TimelineComponent.h"
#include "GameCharacter.generated.h"

class UInputMappingContext;
class UInputAction;
class UCameraComponent;
class USpringArmComponent;

UCLASS()
class MYGAME_API AGameCharacter : public ACharacter
{
    GENERATED_BODY()

public:
    AGameCharacter();

protected:
    virtual void BeginPlay() override;
    virtual void SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) override;
    virtual void Tick(float DeltaTime) override;

    // Enhanced Input
    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input")
    UInputMappingContext* DefaultMappingContext;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input")
    UInputAction* JumpAction;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input")
    UInputAction* MoveAction;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input")
    UInputAction* LookAction;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input")
    UInputAction* SprintAction;

    // Components
    UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Camera")
    UCameraComponent* Camera;

    UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Camera")
    USpringArmComponent* SpringArm;

    // Movement Properties
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Movement")
    float WalkSpeed = 400.0f;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Movement")
    float SprintSpeed = 800.0f;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Movement")
    float SprintStaminaCost = 20.0f;

    // Health System
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Health")
    float MaxHealth = 100.0f;

    UPROPERTY(BlueprintReadOnly, Category = "Health")
    float CurrentHealth;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Health")
    float MaxStamina = 100.0f;

    UPROPERTY(BlueprintReadOnly, Category = "Health")
    float CurrentStamina;

private:
    // Input Functions
    void Move(const FInputActionValue& Value);
    void Look(const FInputActionValue& Value);
    void StartSprint();
    void StopSprint();

    // Sprint System
    bool bIsSprinting = false;
    void UpdateSprint(float DeltaTime);

    // Health Functions
    UFUNCTION(BlueprintCallable, Category = "Health")
    void TakeDamage(float DamageAmount);

    UFUNCTION(BlueprintCallable, Category = "Health")
    void Heal(float HealAmount);

    UFUNCTION(BlueprintImplementableEvent, Category = "Health")
    void OnHealthChanged(float NewHealth, float MaxHealth);

    UFUNCTION(BlueprintImplementableEvent, Category = "Health")
    void OnStaminaChanged(float NewStamina, float MaxStamina);
};
⚡ Character Class en C++ - Implementación ▼ Expandir
// GameCharacter.cpp
#include "GameCharacter.h"
#include "Camera/CameraComponent.h"
#include "GameFramework/SpringArmComponent.h"
#include "GameFramework/CharacterMovementComponent.h"
#include "EnhancedInputComponent.h"
#include "EnhancedInputSubsystems.h"
#include "Engine/Engine.h"

AGameCharacter::AGameCharacter()
{
    PrimaryActorTick.bCanEverTick = true;

    // Create Camera Components
    SpringArm = CreateDefaultSubobject(TEXT("SpringArm"));
    SpringArm->SetupAttachment(RootComponent);
    SpringArm->TargetArmLength = 300.0f;
    SpringArm->bUsePawnControlRotation = true;

    Camera = CreateDefaultSubobject(TEXT("Camera"));
    Camera->SetupAttachment(SpringArm);

    // Character Movement Setup
    GetCharacterMovement()->bOrientRotationToMovement = true;
    GetCharacterMovement()->RotationRate = FRotator(0.0f, 540.0f, 0.0f);
    GetCharacterMovement()->MaxWalkSpeed = WalkSpeed;

    // Initialize Health and Stamina
    CurrentHealth = MaxHealth;
    CurrentStamina = MaxStamina;
}

void AGameCharacter::BeginPlay()
{
    Super::BeginPlay();
    
    // Setup Enhanced Input
    if (APlayerController* PlayerController = Cast(Controller))
    {
        if (UEnhancedInputLocalPlayerSubsystem* Subsystem = 
            ULocalPlayer::GetSubsystem(PlayerController->GetLocalPlayer()))
        {
            Subsystem->AddMappingContext(DefaultMappingContext, 0);
        }
    }
}

void AGameCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
    Super::SetupPlayerInputComponent(PlayerInputComponent);

    if (UEnhancedInputComponent* EnhancedInputComponent = CastChecked(PlayerInputComponent))
    {
        EnhancedInputComponent->BindAction(MoveAction, ETriggerEvent::Triggered, this, &AGameCharacter::Move);
        EnhancedInputComponent->BindAction(LookAction, ETriggerEvent::Triggered, this, &AGameCharacter::Look);
        EnhancedInputComponent->BindAction(JumpAction, ETriggerEvent::Triggered, this, &ACharacter::Jump);
        EnhancedInputComponent->BindAction(JumpAction, ETriggerEvent::Completed, this, &ACharacter::StopJumping);
        EnhancedInputComponent->BindAction(SprintAction, ETriggerEvent::Triggered, this, &AGameCharacter::StartSprint);
        EnhancedInputComponent->BindAction(SprintAction, ETriggerEvent::Completed, this, &AGameCharacter::StopSprint);
    }
}

void AGameCharacter::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);
    UpdateSprint(DeltaTime);
}

void AGameCharacter::Move(const FInputActionValue& Value)
{
    const FVector2D MovementVector = Value.Get();

    if (Controller != nullptr)
    {
        // Forward/Backward movement
        const FRotator Rotation = Controller->GetControlRotation();
        const FRotator YawRotation(0, Rotation.Yaw, 0);
        const FVector ForwardDirection = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X);
        AddMovementInput(ForwardDirection, MovementVector.Y);

        // Left/Right movement
        const FVector RightDirection = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::Y);
        AddMovementInput(RightDirection, MovementVector.X);
    }
}

void AGameCharacter::Look(const FInputActionValue& Value)
{
    const FVector2D LookAxisVector = Value.Get();

    if (Controller != nullptr)
    {
        AddControllerYawInput(LookAxisVector.X);
        AddControllerPitchInput(LookAxisVector.Y);
    }
}

void AGameCharacter::StartSprint()
{
    if (CurrentStamina > 0.0f)
    {
        bIsSprinting = true;
        GetCharacterMovement()->MaxWalkSpeed = SprintSpeed;
    }
}

void AGameCharacter::StopSprint()
{
    bIsSprinting = false;
    GetCharacterMovement()->MaxWalkSpeed = WalkSpeed;
}

void AGameCharacter::UpdateSprint(float DeltaTime)
{
    if (bIsSprinting && GetVelocity().Size() > 0.0f)
    {
        CurrentStamina = FMath::Max(0.0f, CurrentStamina - (SprintStaminaCost * DeltaTime));
        OnStaminaChanged(CurrentStamina, MaxStamina);
        
        if (CurrentStamina <= 0.0f)
        {
            StopSprint();
        }
    }
    else if (!bIsSprinting && CurrentStamina < MaxStamina)
    {
        CurrentStamina = FMath::Min(MaxStamina, CurrentStamina + (SprintStaminaCost * 0.5f * DeltaTime));
        OnStaminaChanged(CurrentStamina, MaxStamina);
    }
}

void AGameCharacter::TakeDamage(float DamageAmount)
{
    CurrentHealth = FMath::Max(0.0f, CurrentHealth - DamageAmount);
    OnHealthChanged(CurrentHealth, MaxHealth);
    
    if (CurrentHealth <= 0.0f)
    {
        // Handle death
        UE_LOG(LogTemp, Warning, TEXT("Character died!"));
    }
}

void AGameCharacter::Heal(float HealAmount)
{
    CurrentHealth = FMath::Min(MaxHealth, CurrentHealth + HealAmount);
    OnHealthChanged(CurrentHealth, MaxHealth);
}

Sistema de IA Avanzada

Qué hace: Implementa inteligencia artificial usando Behavior Trees, Blackboards y Perception System para crear enemigos y NPCs inteligentes.

🤖 AI Controller en C++ - Sistema de Percepción ▼ Expandir
// EnemyAIController.h
#pragma once

#include "CoreMinimal.h"
#include "AIController.h"
#include "Perception/AIPerceptionComponent.h"
#include "Perception/AISenseConfig_Sight.h"
#include "Perception/AISenseConfig_Hearing.h"
#include "EnemyAIController.generated.h"

class UBehaviorTreeComponent;
class UBlackboardComponent;

UCLASS()
class MYGAME_API AEnemyAIController : public AAIController
{
    GENERATED_BODY()

public:
    AEnemyAIController();

protected:
    virtual void BeginPlay() override;
    virtual void OnPossess(APawn* InPawn) override;

    // AI Components
    UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "AI")
    UBehaviorTreeComponent* BehaviorTreeComponent;

    UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "AI")
    UBlackboardComponent* BlackboardComponent;

    UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "AI")
    UAIPerceptionComponent* AIPerceptionComponent;

    // AI Assets
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AI")
    UBehaviorTree* BehaviorTree;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AI")
    UBlackboardData* BlackboardAsset;

    // Perception Configuration
    UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "AI")
    UAISenseConfig_Sight* SightConfig;

    UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "AI")
    UAISenseConfig_Hearing* HearingConfig;

    // Perception Settings
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Perception")
    float SightRadius = 1500.0f;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Perception")
    float LoseSightRadius = 1600.0f;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Perception")
    float FieldOfView = 90.0f;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Perception")
    float HearingRange = 1200.0f;

private:
    // Perception Callbacks
    UFUNCTION()
    void OnPerceptionUpdated(const TArray& UpdatedActors);

    UFUNCTION()
    void OnTargetPerceptionUpdated(AActor* Actor, FAIStimulus Stimulus);

    // Helper Functions
    void SetupPerception();
    void UpdateBlackboard(AActor* Actor, bool bCanSee, bool bCanHear);

public:
    // Blackboard Keys
    static const FName TargetActorKey;
    static const FName LastKnownLocationKey;
    static const FName CanSeeTargetKey;
    static const FName IsInvestigatingKey;
    static const FName PatrolPointKey;
};

Tecnologías de Nueva Generación

Nanite - Geometría Virtualizada

Concepto: Nanite permite usar modelos 3D con millones de polígonos sin impacto significativo en performance, democratizando assets de calidad AAA.

Qué hace: Renderiza automáticamente el nivel de detalle apropiado según distancia y tamaño en pantalla, eliminando la necesidad de LODs manuales.

💎 Configuración de Nanite para Assets ▼ Expandir
// Configuración de Static Mesh para Nanite:

1. Import Settings:
   - Generate Lightmap UVs: False (Nanite no usa lightmaps)
   - Use Mikk T Space: True
   - Compute Weighted Normals: True
   - Build Nanite: True (CLAVE)

2. LOD Settings:
   - Number of LODs: 0 (Nanite genera automáticamente)
   - Auto Compute LOD Distances: False
   - LOD 0 Settings:
     - Reduction Settings: None needed
     - Build Settings: Use Mikk T Space: True

3. Nanite Settings:
   - Enable Nanite Support: True
   - Position Precision: Auto
   - Percent Triangles: 100 (usar todo el detalle)
   - Max Edge Length: 64

4. Material Considerations:
   - No World Position Offset (no compatible con Nanite)
   - No Masked materials (usar Opaque)
   - Pixel Depth Offset: No compatible
   - Two Sided: Funciona pero con costo

// Console Commands para Debug Nanite:
// r.Nanite.ShowStats 1
// r.Nanite.Visualize.Overview 1
// r.Nanite.Visualize.Triangles 1

Lumen - Iluminación Global Dinámica

Concepto: Lumen proporciona iluminación global completamente dinámica en tiempo real, sin necesidad de baking lightmaps.

Qué hace: Calcula reflexiones, indirect lighting y oclusión ambiental dinámicamente, permitiendo cambios de iluminación en tiempo real.

💡 Configuración Avanzada de Lumen ▼ Expandir
// Project Settings > Engine > Rendering:
// Global Illumination:
//   - Method: Lumen
//   - Quality: Epic (o High para mejor performance)
//   - Hardware Ray Tracing: True (si compatible)

// Reflections:
//   - Method: Lumen
//   - Quality: Epic
//   - Hardware Ray Tracing Reflections: True

// Configuración de Post Process Volume:
// Lumen Global Illumination:
//   - Intensity: 1.0
//   - Quality: 1.0 (Epic)
//   - Screen Traces: True
//   - Hardware Ray Tracing: True

// Lumen Reflections:
//   - Quality: 1.0 (Epic)
//   - Hardware Ray Tracing: True
//   - Max Reflection Bounces: 1

// Para Materials que funcionan bien con Lumen:
// - Base Color: Valores realistas (no muy brillantes)
// - Metallic: 0.0 para dieléctricos, 1.0 para metales
// - Roughness: Variación importante para realismo
// - Emissive: Funciona excelente con Lumen

// Console Commands para Debug Lumen:
// r.Lumen.Visualize.Overview 1
// r.Lumen.DiffuseIndirect.Allow 1
// r.Lumen.Reflections.Allow 1
// r.ScreenSpaceReflections 0 (para usar solo Lumen)

Chaos Physics - Simulación Avanzada

Qué hace: Proporciona simulación física de última generación con destrucción, fracturas, cloth simulation y rigid body dynamics mejorados.

💥 Chaos Destruction System ▼ Expandir
// Chaos Destruction en C++
#include "GeometryCollection/GeometryCollectionComponent.h"
#include "Field/FieldSystemComponent.h"

// En tu Actor.h:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Destruction")
UGeometryCollectionComponent* GeometryCollection;

UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Destruction")
UFieldSystemComponent* FieldSystem;

// Configuración de Destrucción:
void ADestructibleActor::BeginPlay()
{
    Super::BeginPlay();
    
    if (GeometryCollection)
    {
        // Configurar propiedades de destrucción
        GeometryCollection->SetNotifyBreaks(true);
        GeometryCollection->SetDamageThreshold({50.0f}); // Damage needed to break
        GeometryCollection->SetSizeSpecificData({{
            EGeometryCollectionSizeSpecificData::MaxSize, 100.0f,
            EGeometryCollectionSizeSpecificData::CollisionType, ECollisionTypeEnum::Chaos_Surface_Volumetric
        }});
        
        // Bind to break events
        GeometryCollection->OnChaosBreakEvent.AddDynamic(this, &ADestructibleActor::OnBreak);
    }
}

UFUNCTION()
void ADestructibleActor::OnBreak(const FChaosBreakEvent& BreakEvent)
{
    // Handle destruction logic
    UE_LOG(LogTemp, Warning, TEXT("Object broken! Velocity: %s"), *BreakEvent.Velocity.ToString());
    
    // Spawn particle effects, sounds, etc.
    SpawnBreakEffects(BreakEvent.Location);
}

// Aplicar fuerza de explosión:
void ADestructibleActor::ApplyExplosiveForce(FVector Location, float Radius, float Strength)
{
    if (FieldSystem && GeometryCollection)
    {
        // Create radial force field
        URadialFalloff* RadialFalloff = NewObject(this);
        RadialFalloff->SetRadialFalloff(Radius, 0.0f, 1.0f, 0.0f, Location, EFieldFalloffType::Field_FallOff_Inverse);
        
        URadialVector* RadialVector = NewObject(this);
        RadialVector->SetRadialVector(Strength, Location);
        
        // Apply the force
        FieldSystem->ApplyPhysicsField(true, EFieldPhysicsType::Field_ExternalClusterStrain, 
                                     nullptr, RadialFalloff);
        FieldSystem->ApplyPhysicsField(true, EFieldPhysicsType::Field_LinearVelocity, 
                                     nullptr, RadialVector);
    }
}

Sistemas de Juego Avanzados

World Partition - Mundos Abiertos

Concepto: World Partition permite crear mundos abiertos masivos dividiendo automáticamente el mundo en células que se cargan dinámicamente.

Qué hace: Gestiona automáticamente el streaming de contenido basado en la posición del jugador, permitiendo mundos virtualmente ilimitados.

🌍 Configuración de World Partition ▼ Expandir
// Configurar World Partition en un Level:

1. World Settings > World Partition:
   - Enable Streaming: True
   - Grid Name: MainPartition
   - Cell Size: 25600 (256m x 256m cells)
   - Loading Range: 51200 (2 cells radius)
   - Runtime Hash: Spatial Hash

2. Actor Settings para World Partition:
   - Landscape: Always Loaded = False, Spatial Loaded = True
   - Static Meshes: Spatial Loaded = True
   - Lights: Distance-based loading
   - Audio: Spatial Loaded = True

3. Data Layers para organización:
   - Gameplay Layer: Objetivos, NPCs críticos
   - Environment Layer: Decoración, props
   - Audio Layer: Ambient sounds, music triggers
   - Lighting Layer: Atmospheric lights

4. Level Instances para reutilización:
   - Create Level Instance from selection
   - Package external actors
   - Use for repetitive structures (buildings, rooms)

// Console Commands:
// wp.Runtime.ToggleDrawStreaming 1
// wp.Runtime.ToggleDrawRuntimeHash2D 1
// wp.Editor.ShowStreamingCells 1

MetaHuman Creator Integration

Qué hace: Integra personajes fotorrealistas creados en MetaHuman Creator directamente en UE5 con facial animation y rig completo.

👤 MetaHuman Integration Workflow ▼ Expandir
// Workflow completo MetaHuman:

1. MetaHuman Creator (metahuman.unrealengine.com):
   - Create character with desired features
   - Export to Unreal Engine project
   - Download via Quixel Bridge

2. Import to UE5:
   - Automatic import via Bridge plugin
   - Includes: Mesh, Materials, Skeleton, Animation BP
   - LOD system optimized for real-time

3. Animation Retargeting:
   - Use IK Retargeter for custom animations
   - Source: Generic UE5 Skeleton
   - Target: MetaHuman Skeleton
   - Auto-map bone chains

4. Facial Animation:
   - Use LiveLink Face app (iOS) for real-time capture
   - Connect iPhone to UE5 via WiFi
   - Record facial animations directly in editor

5. Blueprint Integration:
// Character Blueprint setup:
Components:
- MetaHuman Mesh Component
- Audio Component for voice
- Live Link Component for facial capture

Variables:
- Facial Expression Intensity (Float)
- Current Emotion State (Enum)
- Voice Audio Cue (Sound Base)

Functions:
- Play Facial Animation (Animation Name)
- Set Emotion Blend (Happy, Sad, Angry weights)
- Sync Lip Sync with Audio

// Performance Optimization:
// LOD Settings for MetaHuman:
// LOD 0: Full detail (close-up shots)
// LOD 1: Reduced detail (medium distance)  
// LOD 2: Simplified (background characters)
// LOD 3: Impostor (very far distance)

Optimización y Performance UE5

Profiling y Performance Analysis

Qué hace: Utiliza las herramientas integradas de UE5 para identificar y resolver cuellos de botella de performance en CPU, GPU y memoria.

📊 Tools de Profiling UE5 ▼ Expandir
// Console Commands para Profiling:

// Stat Commands (Performance Overview):
stat fps            // Frame rate y frame time
stat unit           // CPU/GPU breakdown detallado
stat game           // Game thread statistics
stat rhi            // RHI thread performance
stat gpu            // GPU timing detallado
stat memory         // Memory usage breakdown
stat streaming      // Asset streaming performance

// Rendering Statistics:
stat scenerendering // Scene rendering stats
stat shadowrendering // Shadow casting performance
stat foliage        // Instanced foliage performance
stat nanite         // Nanite virtualized geometry
stat lumen          // Lumen global illumination

// Specific System Profiling:
stat particles      // Niagara particle systems
stat audio          // Audio system performance
stat physics        // Chaos physics simulation
stat animation      // Character animation systems

// GPU Profiling:
profilegpu          // Detailed GPU profiler
r.ProfileGPU.ShowUI 1 // Show GPU profiler UI

// Memory Profiling:
memreport           // Detailed memory breakdown
obj list class=StaticMeshComponent // List all instances
stat levels         // Level streaming memory

// Blueprint Profiling:
stat blueprintvm    // Blueprint virtual machine
kismet slowcommands // Slow Blueprint functions

// Performance Testing Commands:
t.MaxFPS 60         // Cap frame rate for testing
r.VSync 0           // Disable VSync for accurate timing
r.ScreenPercentage 50 // Reduce resolution for performance test

Scalability y Quality Settings

Qué hace: Configura settings adaptativos que ajustan automáticamente la calidad visual según el hardware del usuario.

⚙️ Scalability Configuration ▼ Expandir
// Scalability Settings en C++
#include "Engine/Engine.h"
#include "GameFramework/GameUserSettings.h"

// Auto-detect optimal settings
void AMyGameMode::SetOptimalGraphicsSettings()
{
    UGameUserSettings* UserSettings = UGameUserSettings::GetGameUserSettings();
    
    if (UserSettings)
    {
        // Run hardware benchmark
        UserSettings->RunHardwareBenchmark(5); // 5 second benchmark
        
        // Apply recommended settings
        UserSettings->ApplyHardwareBenchmarkResults();
        
        // Custom adjustments based on hardware
        float CPUBenchmark = UserSettings->GetRecommendedResolutionScale();
        float GPUBenchmark = UserSettings->GetRecommendedResolutionScale();
        
        if (GPUBenchmark < 0.7f) // Low-end GPU
        {
            // Reduce expensive features
            UserSettings->SetGlobalIlluminationQuality(1); // Low Lumen quality
            UserSettings->SetReflectionQuality(1);
            UserSettings->SetShadowQuality(2);
            UserSettings->SetPostProcessingQuality(2);
            UserSettings->SetTextureQuality(2);
            UserSettings->SetEffectsQuality(1);
            
            // Disable expensive features
            UserSettings->SetScreenPercentage(75.0f);
        }
        else if (GPUBenchmark < 0.9f) // Mid-range GPU
        {
            UserSettings->SetGlobalIlluminationQuality(2);
            UserSettings->SetReflectionQuality(2);
            UserSettings->SetShadowQuality(3);
            UserSettings->SetPostProcessingQuality(3);
            UserSettings->SetTextureQuality(3);
            UserSettings->SetEffectsQuality(2);
            
            UserSettings->SetScreenPercentage(85.0f);
        }
        else // High-end GPU
        {
            // Max quality
            UserSettings->SetGlobalIlluminationQuality(3);
            UserSettings->SetReflectionQuality(3);
            UserSettings->SetShadowQuality(3);
            UserSettings->SetPostProcessingQuality(3);
            UserSettings->SetTextureQuality(3);
            UserSettings->SetEffectsQuality(3);
            
            UserSettings->SetScreenPercentage(100.0f);
        }
        
        // Apply settings
        UserSettings->ApplySettings(true);
    }
}

// Dynamic quality adjustment during gameplay
void AMyGameMode::AdjustQualityBasedOnPerformance()
{
    float CurrentFPS = 1.0f / UGameplayStatics::GetWorldDeltaSeconds(this);
    float TargetFPS = 60.0f;
    
    UGameUserSettings* UserSettings = UGameUserSettings::GetGameUserSettings();
    
    if (CurrentFPS < TargetFPS * 0.8f) // If FPS drops below 80% of target
    {
        // Reduce quality gradually
        int32 CurrentQuality = UserSettings->GetEffectsQuality();
        if (CurrentQuality > 0)
        {
            UserSettings->SetEffectsQuality(CurrentQuality - 1);
            UserSettings->ApplySettings(false); // Don't save to config
        }
    }
    else if (CurrentFPS > TargetFPS * 1.1f) // If FPS is consistently high
    {
        // Increase quality gradually
        int32 CurrentQuality = UserSettings->GetEffectsQuality();
        if (CurrentQuality < 3)
        {
            UserSettings->SetEffectsQuality(CurrentQuality + 1);
            UserSettings->ApplySettings(false);
        }
    }
}

Publicación y Distribution

Packaging para Diferentes Plataformas

Qué hace: Configura el empaquetado optimizado para PC, consolas, móviles y otras plataformas con settings específicos para cada target.

📦 Platform-Specific Packaging ▼ Expandir
// Windows Packaging Configuration:
Project Settings > Platforms > Windows:
- Target RHI: DirectX 12 (for Nanite/Lumen)
- Shader Format: PCD3D_SM6
- Texture Format: DXT
- Audio Format: OGG Vorbis
- Compression Settings: Compress Package
- Include Prerequisites: True
- Sign Executables: Optional

Build Configuration:
- Shipping: Maximum optimization, no debug info
- Development: Balanced, some debug info
- Debug: Full debug, no optimization

// Console Packaging (PlayStation/Xbox):
Platform SDKs Required:
- Install platform-specific SDK
- Setup development certificates
- Configure signing keys

Memory Optimization:
- Texture Streaming Pool: Platform-specific
- Audio Compression: Platform native
- Shader Compilation: Platform-optimized

// Mobile Packaging (Android/iOS):
Android Settings:
- Minimum SDK: API 21 (Android 5.0)
- Target SDK: Latest stable
- Package for: ARM64
- Support Vulkan: True (for modern devices)
- Package Name: com.yourcompany.yourgame

iOS Settings:
- Minimum iOS Version: 13.0
- Device Family: iPhone + iPad
- Metal Shader Standard: Metal 2.1
- Bundle Identifier: com.yourcompany.yourgame
- Provisioning Profile: Development/Distribution

Optimization for Mobile:
- Texture Quality: Reduced for mobile
- Effects Quality: Lower settings
- Disable Nanite/Lumen: Not supported on mobile
- Use Forward Shading: Better for mobile GPU
- Reduce Poly Count: Use aggressive LODs

¡Eso es todo!

¡Felicidades! Has completado la guía más completa de Unreal Engine 5 en español. Ahora dominas desde los fundamentos hasta las tecnologías más avanzadas de la próxima generación de videojuegos.

Recuerda estos puntos clave:

  • Empieza con Blueprints: Excelente para prototipar y aprender los sistemas de UE5
  • Migra a C++ gradualmente: Para sistemas complejos y optimización crítica
  • Aprovecha Nanite y Lumen: Están optimizados y listos para producción
  • Usa World Partition: Esencial para cualquier mundo abierto o nivel grande
  • Profilea constantemente: Las herramientas de UE5 son excelentes para optimización
  • Piensa en escalabilidad: Diseña para múltiples niveles de hardware desde el inicio

Unreal Engine 5 te da el poder de crear experiencias visuales que antes estaban reservadas para estudios AAA con presupuestos millonarios. Con Nanite, Lumen, Chaos Physics y todas las herramientas que has aprendido, ¡no hay límites para tu creatividad! ¡Nos vemos en tu próximo blockbuster! 🎬🎮✨

← Volver a Artículos