Unreal Engine5中使用 Lyra框架

UE5系列文章目录

前言

Unreal Engine 5(UE5)提供了多种用于游戏开发的模板和框架,其中Lyra和AlS是两个不同的示例项目,它们分别代表了不同的开发方向和技术重点。
Lyra框架
Lyra是一个由Epic Games提供的示例项目,它旨在作为一个现代游戏的框架,展示了UE5的一些最新功能和技术,如Nanite几何体技术、Lumen全局光照系统等。Lyra的设计理念是模块化和可扩展性,它提供了一个基础的多人游戏架构,包括客户端/服务器网络模型、角色控制、HUD/UI元素、以及一些基础的玩家交互机制。Lyra对于想要学习如何构建一个从头到尾的完整游戏项目的人来说是一个很好的起点。

AlS框架
AlS(Advanced Locomotion System)并不是由Epic官方提供的框架,而是一个由社区开发者创建的高级移动系统。AlS主要关注的是角色的运动和动画,提供了一套复杂的动画混合树和行为逻辑,使得游戏角色能够以更加自然和逼真的方式移动。AlS支持多种地面类型、坡度、跳跃和滑行等功能,并且可以高度定制来适应不同的游戏需求。

一、Lyra和AIS框架的区别

区别与联系
目的:Lyra更侧重于作为一个完整的项目模板,包含从游戏逻辑到网络架构的一系列功能;而AlS则专注于角色动画和物理行为。
适用范围:Lyra适合那些希望快速启动一个新项目的开发者,而AlS适合专注于动画和物理模拟的专业人士或团队。
集成难度:Lyra作为官方示例,集成相对简单;AlS可能需要更多的调整才能适应特定项目的需求。
如何在蓝图中使用
使用Lyra框架
如果你正在使用Lyra作为你的基础项目,你可以直接在提供的蓝图类中工作,比如CharacterController蓝图或者任何其他预定义的蓝图。这些蓝图已经配置好了基本的游戏机制,例如移动、碰撞检测、UI显示等。你可以通过添加新的事件节点、条件分支等方式来扩展这些蓝图的功能。

使用AlS框架
对于AlS框架,你需要先将它导入到你的UE5项目中。通常,这涉及到将AlS的源代码文件夹复制到你的项目的插件或内容文件夹中。一旦导入,你可以通过创建一个新的蓝图类并继承自Character或者Pawn,然后在该蓝图中添加AlS提供的动画蓝图节点来实现复杂的移动逻辑。AlS通常会包含详细的文档来指导你如何设置和使用其功能。

请注意,使用这些框架或系统时,最好先熟悉它们提供的文档和教程,以确保你能充分利用所提供的特性并且正确地集成它们到你的项目中。

二、下载官方Lyra游戏示例

1.Lyra官方文档
Lyra示例
在这里插入图片描述
2.你可以从Epic Games启动程序下载Lyra Game Sample,方法是点击示例(Samples)选项卡并导航到Lyra Game Sample,或者点击虚幻商城(Marketplace)选项卡并在搜索字段中输入Lyra。
具体方式:Epic Games启动程序,选择Fab,然后点击Start exploring
在这里插入图片描述
3.进入网页后,在搜索栏中输入“Lyra”,回车
在这里插入图片描述
4.点击第一个Lyra
在这里插入图片描述
5.分别点击添加我的库,和下载,注意这里一定要选择添加到我的库,不然后面在我的库中就搜不到Lyra
在这里插入图片描述
6.勾选我已经阅读并同意 Fab 最终用户许可协议 即表示我同意被最终用户许可协议所约束*,然后点击接受
在这里插入图片描述
7.Epic Games启动程序选择“库”,然后点击“Fab Library”后面的刷新图标,在搜索中输入“lyra”,
注意:一定要点击刷新,一定要点击刷新,一定要点击刷新,重要的事情说三遍哈,否则可能搜不到lyra
在这里插入图片描述
8.工程下载完成后打来Lyra工程
在这里插入图片描述
在这里插入图片描述

三、Lyra在动画蓝图中的使用

Lyra框架中最重要的2个节点
(1)Event Blueprint Update Animation
(2)Property Access
在这里插入图片描述
在这里插入图片描述

1.新建动画图层接口:BHH_ABI_Base
2.新建动画蓝图:BHH_ABP_Base
3.新建动画蓝图:BHH_ABP_BaseLayerSetup
在这里插入图片描述
4.在动画蓝图中添加状态机:Locomotion
在这里插入图片描述
5.在Locomotion状态机中添加5个状态:Idle、 Start、MoveCycle、Stop、Trun180
在这里插入图片描述
6.动画图层接口:Layer_Idle
在这里插入图片描述
7.动画图层接口:Layer_Start
在这里插入图片描述
8.动画图层接口:Layer_Cycle
在这里插入图片描述
9.动画图层接口:Layer_Stop
在这里插入图片描述

### UE5 Lyra Framework Documentation and Tutorials #### Overview of the Lyra Framework The Lyra framework is designed to provide a robust foundation for game development within Unreal Engine 5. This includes comprehensive systems such as character configuration, gameplay abilities, and camera management. The modular design allows developers to easily extend or modify components without affecting other parts of the project[^1]. #### Character Configuration in Lyra Character setup involves defining attributes like health, movement speed, and ability slots. These configurations are managed through data assets that can be customized according to specific needs. For instance, when configuring characters, one must consider how these settings integrate with the Game Mode which handles loading levels and initializing player states[^2]. #### Gameplay Ability System (GAS) Integration Integrating GAS into characters requires setting up ability sets where each set contains multiple abilities. Abilities themselves may have unique requirements including cooldowns, costs, and effects on both actors involved directly during execution as well as indirectly via environmental changes. An example function demonstrating interaction between an ability ending its effect and clearing associated camera modes showcases this integration: ```cpp void ULyraGameplayAbility::ClearCameraMode() { ENSURE_ABILITY_IS_INSTANTIATED_OR_RETURN(ClearCameraMode); if (ActiveCameraMode) { if (ULyraHeroComponent* HeroComponent = GetHeroComponentFromActorInfo()) { HeroComponent->ClearAbilityCameraMode(CurrentSpecHandle); } ActiveCameraMode = nullptr; } } ``` This method ensures proper cleanup after using skills by resetting any special views applied while performing actions. #### Camera Management For managing cameras dynamically based on different situations within games built upon Lyra, there exist mechanisms allowing temporary modifications to viewpoint angles or distances from targets. Such adjustments enhance immersion but require careful handling so they do not interfere negatively with user experience once no longer needed[^3]. --related questions-- 1. How does the Lyra framework handle multiplayer synchronization? 2. What tools does Lyra offer for debugging issues related to character movements? 3. Can custom input bindings be created efficiently within the Lyra structure? 4. Is it possible to implement third-person perspective features similar to those found in popular titles using only what's provided out-of-the-box by Lyra?
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值