This is my quick implementation of a character selection interface using Paragon heroes. More options to be added soon.
Hey there @L.F.A,
Hope youāre doing well!
Great work so far! The audio ui interactions are 10/10. Havenāt gotten a chance to play around with lyra to much so not sure which parts are made by you but I definitely think this looks wonderful.
Really hope to see more of your work soon
Hi there, likewise, I hope you are doing well, too.
Thank you for your feedback. Lyra is fantastic, very modular, and I have very cool mods coming soon.
Best regards
Hi, there. Could you please do me a great favor? I wanted to hear from Epic team what is the best workflow for creating and saving custom settings in Lyra with Blueprints, such as character selection youāve seen in that video.
The reason for my request is that looks like saving selection options in the game instance/game mode/ player controller, as pointed out by Epic years ago (AI: State of Mind | Live from HQ), is not working in Lyra with Blueprints. Perhaps C++ modification is required. I would appreciate any directions or documentation.
Here is my workflow with basic save/load logic done with blueprints only. It works if tested locally, but it is not working in a packaged game and two computers. The selection made by the host player always overwrites the clientsā selection, as if all clients read the game instance from the host player, regardless the fact that the save game logic is working correctly locally.
Iāve just created a question in this forum with this topic.
Thank you.
Iāll definitely message some of the more knowledgable Unreal admins and see if I can get you the answers you need.
Much appreciated. Thanks.
Would love to know this also. Hopefully someone figures it out.
Hey guys!
While we wait for the coolest of the Unreal people to get back to me on this, I did find this documentation that might help slightly. Let me know if it resolves your problem!
Hi, thanks you for this update. I believe that doc considers changing the C++ code. Iāll read it through and let you know if that helps. I appreciate your help.
Best regards.
Would also love to know this workflow, thanks for the documentation, though as it is C++ based is there any examples or tutorials that you can point to on how to add custom settings? I believe the documentation is pointing in the right direction as it does cover how settings apply to local players and I think what is happening is once the packaged game starts the host player has authority and client players save slot is not passed by the server. Iām not C++ fluent and would love to see someone figure this out in blueprints.
Iāll update here if I find anything. I tried to use ColorBlind settings as example, but I couldnāt succeed on this. I created 2 C++ classes based on UIExtension and GameSettings, however the documentation regarding how to write the additional code to both .cpp and .h files is not clear enough to me.
Have you had any luck with this? Iām struggling to see how we are meant to be getting GameSettings which exist only on each clientās LyraLocalPlayer to the server. (At least thatās my understanding).
I used to simply pass through character selection as an arg with each player as they connected to the server, but was hoping GameSettings would provide a better solution.
Hi there, not yet. I havenāt had a change to go deeper on this topic. But Iāve learned that Game Settings is actually a plugin itself, so Iāll check it out in VS2022 later this week. Iāll post here if I find anything useful.
C++ is an āuncharted territoryā to me, but I did a quick search and here what Iāve found so far. It is not final, though.
-
In a new project, disable the MDL plugin (Omniverse) and restart. In your project content browser, show C++ classes, find LyraGameSettingRegistry, right click, and create a subclass of it, set as public and rename it as LyraGameSettingRegistry_Profile, āProfileā as an example.
-
In VS 2022, build UE5 and then your game for the first time. The step 1 will create two files: LyraGameSettingRegistry_Profile.cpp and LyraGameSettingRegistry_Profile.h. To find existing settings, search for āLyraGameSettingRegistryā in the solution explorer (check āsearch within external itemsā). Youāll find Gameplay (Languages), Mouse&Keyboard, PerfStats, Gamepad, Audio, and Video. Choose an existing setting, for instance, LyraGameSettingRegistry_Audio.cpp and copy part of the code, changing the existing data. In my example, I changed āVolumeā and āOverall audioā (scalar settings) to āCharacterā and āSelectionā. I couldnāt figure out the proper content for the .cpp file for my particular use case.
-
Edit LyraGameSettingRegistry.cpp and LyraGameSettingRegistry.h to add this new setting āProfileā to the existing lists, observing the proper syntax.
-
Open W_LyraSettingScreen and add a Profile Collection to the sequence node
-
Copy W_ColorBlindMode to a new folder Profile under Extensions folder, rename it to W_Settings_Profile, and change its icons. Add this new widget to GameSettingRegistryVisuals (Data Asset). Add a new map element āProfileā and assign the new widget to the extension array
At this point, I couldnāt exam a proper reference for completely filling the *.cpp and the LyraGameSettingRegistry_Profile.h file for my particular case. I believe Video - Color Blind Mode is the closest setting to my use case, because it consists in a list of options to choose from a UI. I could build a list of character meshes (or actor blueprints) to be chosen from there.
Also, further analysis is needed, and many steps are missing here, because I got several errors in VS about missing references. That said, it was impossible to build the solution afterwards.
I am hoping someone is going to take it from here, itās beyond my knowledge. It would be great if the devs could point us the right direction.
Hi, there, did you find someone who can help me with this matter? I would appreciate any inputs from the senior devs.
Best regards
Try this
LyraSettingsLocal.h
// Character selection
public:
UFUNCTION(BlueprintCallable)
int32 GetUserCharacter();
UFUNCTION(BlueprintCallable)
void SetUserCharacter(int32 NewUserCharacter);
private:
UPROPERTY(Config)
int32 UserCharacter;
LyraSettingsLocal.cpp
int32 ULyraSettingsLocal::GetUserCharacter()
{
return UserCharacter;
}
void ULyraSettingsLocal::SetUserCharacter(int32 InUserCharacter)
{
UserCharacter = InUserCharacter;
}
LyraGameInstance.h
#include "Settings/LyraSettingsLocal.h"
public:
ULyraSettingsLocal* UserSettings;
UFUNCTION(BlueprintCallable)
ULyraSettingsLocal * GetUserSettings();
LyraGameInstance.cpp
#include "Settings/LyraSettingsLocal.h"
void ULyraGameInstance::Init()
{
Super::Init();
UserSettings = ULyraSettingsLocal::Get();
}
ULyraSettingsLocal* ULyraGameInstance::GetUserSettings()
{
return UserSettings;
}
In the blueprint use āGet Game Instanceā cast to LyraGameInstance then āGet User Settingsā then āGet/Set User Characterā
I also used nodes āIs Locally controlledā and āIs Player Controlledā to stop the user select affecting the NPCs. Also only choose āClient Componentā in the components list of the Lyra Experience Definition.
Result is here
I really appreciate that, thank you sharing this code and the link for the game on steam. Iāll test it out and let you know.
Thank you so much for the help.
Is this code already implemented in your game? I tested on Steam and it didnāt change the character.
It was until I updated Lyra framework and wiped out the reference to my custom version of B_PickRandomCharacter. Thanks for letting me know. Building a new version to upload now. Very much still in Betaā¦
Itās a journey, indeed. Let me know if you need any help with testing. Good luck in your project.