Experience Types
UE5 Experience System Version: 1.0Experience types are loaded from a data table automatically when the component begins play. This data table DT_Experience can be found in the Blueprints/Variables/DataTable folder. If you want to add, remove or make changes to data related to any experience this data table is where you should do it. The structure for this data table is called F_Experience and can be found in the Blueprints/Variables/Structures folder.
Each row in the data table has the following fields available to it:
The display name shown in the experience window, on the tooltip that appears when you hover over an experience bar, and on hud alerts like experience gains and level ups. I recommend keeping the title simple, one word titles work best.
The level curve is how you control the ramp up in experience. I have provided 3 different level curves for you, a linear curve which makes each level the same amount of experience, a smooth ramp up curve which gradually gets harder the higher the level, and a more exaggerated form of the ramp up for a much quicker early game level experience and a more drawn out experience near the level cap.
This value is added to your defaultStartingLevel to come up with your max level. The defaultStartingLevel variable can be found in the AC_ExperienceSystem component, its default value is 1.
This is the max total experience required to hit your max level.
This is the experience bar and text color for the experience.
If set to true this experience type will appear in the experience window. If set to false it and any child experiences (ones where parentExperience equal this experience) will not be shown in the experience window.
When set to true this will show experience changes for this experience type on the player’s screen. This will spawn a UI_ExperienceGainAlert inside of the UI_ExperienceGainAlertAnchor being set to the screen in the spawnHUD function on the AC_ExperienceSystem component. The color of this text is based on the color set in this data table for the Color field.
When set to Large it will show the level up and down alerts at the top of the screen like the demo world does for the player level ups. When set to Small it will show the smaller level up and down alerts that appear to the left of the character. When set to null no alert will be shown on screen for the level change.
Spawn this niagara system effect at the player’s location when they level up for this experience type. In our demo world we set the “level” experience type to use our colorful fireworks with our plus signs that fall like feathers. This Niagara System can be found in the Demo/FX/ folder if you would like to use it.
Play this sound cue at the player’s location when they level up. The level up sound you hear in the demo world can be found in the Demo/Sounds/ folder. I created this sound in GarageBand if you would like to make your own similar sounding ones.
Show this effect at the player’s location when they delevel in this experience type. At this time there is no de-leveling VFX included with this asset, you will need to make your own if you want to use this.
Play this sound cue at the player’s location when they de-level. The de-level sound you hear in the demo world can be found in the Demo/Sounds folder. I created this sound in GarageBand if you would like to make your own similar sounding ones.
This is only used by the Experience Window UI as a way to put this experience type under another as a radial bar instead of standard bar. Setting a parentExperience does not share experience gains with the parent, to do that you have to manually define that both experiences get awarded, using the AddExperienceBulk event. Read the chapter about adding player experience to learn more about this event.
At runtime to get any of this data for an experience type …
Call the getExperienceData function on the AC_ExperienceSystem to get data about any experience type. The return of this function will return all the variables above. You can get a reference to the AC_ExperienceSystem any time by getting the player controller and running the getComponentByClass function, then select AC_ExperienceSystem from the drop down.
To get data for all experiences …
Call the getExperienceDataAll function, this will return a map where the key is the experience type row id, and the value is a structure with all of the data for the experience type.
To get the player’s current experience …
This chapter is just about getting the data associated with an experience, to get the player’s current experience points or level review the chapter Get Current Level or Total Experience.
Creating Hidden Experience Types
Looking for a way to progress the player without them actually knowing about it or seeing the progress? Maybe you want to guarantee a reward to the player who may just not be that lucky. With this system it is possible to have experience types that are completely hidden from the player.
When creating your experience to the data table make sure you set showExpWindow and showExpChange to false. Also make sure to set levelChangeHUD to null, and finally make sure none of the VFX and SFX are set.
You can still add experience and check the level like you would with everything else, the only difference is the player will never know about it.
Setting these values to null will only account for the parts that are included in this asset. When you create your own logic you will need to account for experiences you wish to keep hidden. I created a helper function called isHiddenExperience? to assist you. You can find this function on the AC_ExperienceSystem. This helper function just checks to make sure that none of the mentioned variables are set. The return is true if the experience is hidden.