Using The Asset Manager For My Multiplayer In Game Store System #UE5 #Overview

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
yo what is good them guys it's your boy kane yes sir i'm back with another video this is going to be one of those overview videos where i show you how i set up my inventory system that is working with the asset manager this is not going to be step by step i won't be doing a series on this it'll take too long i am currently in school and i'm working on my own personal project right now so like my time to do tutorials is very low but i will let you know how and where i got this information from so this all starts with the asset manager and i can't explain the asset manager as much as i need to in this video that requires a whole series on its own but this asset manager all it does is holds some static f primary asset types i tell the asset manager hey this asset type is of this name here so when you see this name combine or connect it to this asset type here and uh you also need data assets so the system that i kind of ripped this inventory system from the multiplayer inventory from is this free multiplayer inventory that i got off of the internet here i actually found a video by a guy named dev addict he shows you how to set this up and rip it and put it into your project or project that he was creating but this is an inventory that is multiplayer compatible but it uses the old system of setting up things like data tables and stuff like that so the problem with this and i'm not down to you if you use data tables but the problem with this is if you're working in a team which i hopefully plan to do in the future when my game gets a little bit bigger is this is a singleton object for your inventory so that means if someone checks this item out or checks this class out or this data table out you won't be able to add items to this inventory to test your new created item in the inventory so it really could slow down things it gets cumbersome you have to come in here and add a row set up all the information here and it i don't know it just it doesn't fit the workflow the thing about the asset manager it is very sexy you can load certain bundles at certain times that way your load times are not crazy and and it's just the future of a game with a lot of assets so it also has this struct here and this is what this data table is consists of consisted of of this of a bunch of these structs and my system uses data assets for half of this information so i had to find a way to both use data assets which is what the asset manager uses and use structs which is what this system is using to save and to load and to replicate items in the inventory and the way i did that by going to my project is i created a custom struct and i will be converting this to c plus plus once i get some time i just been testing it to make sure everything's work working looking for bugs so if i go to my blueprints inventory system i have a custom structure called f item and this structures holds the item data which is the data asset it holds the item count which i need to set and subtract from uh at runtime and this item is locked which allows me to set a item locked in the inventory uh so that you have to buy it to unlock it because once again i am creating a store like a in-game store not like an online store like an in-game store where you use in-game currency that you earn through the matches to unlock more weapons instead of using uh instead instead of like doing pay-to-win type stuff it's a play to win so the thing about data assets is that a lot of the information on data assets are read only you you're not supposed to set data on the uh that asset you're not supposed to set a boolean you're not supposed to set a integer so things that need to be set i have included them in the struct and that way i could write to the struct changes values and then save that struct again and and put it back into the uh to the inventory so that's all the inventory is it's just an array of structs so if i press play here uh while i do all this tar doing all this talking i haven't showed you guys anything if i press c here um it'll show you the entire inventory for the game this is my store quote-unquote and this is all the items i have i have these four weapons and i have these currencies this one in the final packaging of the game these won't actually be in the inventory they'll just be showing on your ui somewhere but the asset manager is what is feeding the information to this inventory system here so if i go shift f1 i go into my items folder here and this weapons folder these four weapons are the same thing here these four weapons these four weapons are these four weapons and these four weapons are these four weapons you get what i'm talking about uh so let me go back in here and let me um let me close this and oh i opened up a new one let me close this and exit out of here to show you that this works with the asset manager all i'm going to do is just create a new type here create a new data asset and we're going to name this sniper and let's just set some defaults here let's set the item that we want to give the player to this rifle actor and let's set the name to sniper let's set it to unlocked not stackable and let's change this picture here to this sniper rifle picture here if we save that and we press play here my inventory will talk to the asset manager and get the newly added uh information so if i press my inventory button here you'll see that this item is it has now been added and it is unlocked in my inventory so if i go to my player's inventory which is what you will have in game it'll you'll have your weapons and your heels and stuff like that i can right click on this and equip this and you'll see that i get this weapon added to my player and i can use it and everything works as expected and the way that this is all working is the asset manager is talking to my inventory component and it's telling the inventory component hey i got some new assets if those assets aren't already in your inventory system go ahead and add those to your uh inventory system and the way that that happens is inside my game instance we we want to first load the game when we load the game all we do is you know i'll do this async in the future but uh we want to check a slot and then we want to load that slot and we want to cast it to the actual save game object so that we can get the saved data from there and use that to to run a for loop and to get all of the items that already exist in this saved inventory because this struck here is saved whenever the inventory changes so whenever the inventory changes this gets updated so we want to break that and check this item data and if it's valid we want to add it to the existing inventory items the reason i'm doing that is say you got dlc right say you got dlc and you got 50 new items that are in your dlc now when you start the game this init function will run right here this will run as soon as you start your game so the reason i'm loading the game first is because i want to make sure we don't add two of the same items inside of the inventory that'll mean we'll have all these double duplicate items in the inventory so first thing i want to do is see hey what items do we already have in the inventory and add those to a an array here and then when i initialize my store items i want to check for the types that we want to have in the store which is right now currency and the weapon and i want to go ahead and say for all those types get all the id get all the primary ids from those and pass those ids to our uh asynchronous loader on the asset manager and those ids are tied to some f streamable not f streamable but some f soft object paths so we get those paths from those ids and then we load those paths and i'm sorry once those paths are loaded we parse through them and we have to cast them to an actual object because this is just a just a string here we have to cast them to an actual type and then what we want to do is check the type that is loaded from the inventory and see if it already exists inside of this array if it does we don't do anything but if it doesn't meaning i just add those 50 new items we got new items we want to add those to the store items and this is what we're trying to get to we're passing data to the store items but the reason this exists is because we don't want to double add items to the store items so now we go to our inventory component in our inventory component it whenever an object that has our inventory component is parsed up or is uh activated or spawned into the level this will get ran and we set up our defaults and we check on the server everything is ran on the server we get our game instance and we get that item and we get that array of items that was filled in our game instance when we started the game so now we want to run a for each loop on all those items and check and see if the the actual item base class is valid if that's valid we want to add it to our store items and then we take those store items and these store items this is all this is how the asset manager works the asset managers feel it just fills this array for us this just gets filled by the asset manager and that is that helps keep everything to where we can just add an item and it updates add an item and it updates the inventory so now once we get this this array field we want to parse through that array as well and we want to add these items to our inventory but since this is just since this information that's just coming in is just a data asset because if i go here all this is a data asset we have to tell we have to convert it to a struct which is what our inventory is actually holding and saving so this is a custom function i had to create and this is not doing anything spectacular it's creating uh we create a a temporary struct then we set the members of that struct now this struct all it holds is a data asset item count and whether or not the item is locked so this struct is similar to the the other system where the array of structs is the inventory so we create a new struct to add to the inventory so we create a temporary one and we set the members and remember this struct holds a data asset so we set the data asset of this struct to the data asset that's coming in through this conversion and we also get the default value of whether or not this asset is locked and set that struct value to that value as well and then we output this struct here and once that is outputted we add the item to our inventory on the server and all this does is takes the item it checks and sees if it's already in the inventory and if it's stackable we add another one to the stack if it's not stackable we add it to a slot and after this is done we go ahead and save the game and this will save the this will save in that slot and that is how and that is the same slot that our load game is reading here as well so it's a big circle everything kind of accounts for itself so this system is pretty it's pretty neat i'm not gonna lie to you so um yeah i i started with the action rpg but it you it couldn't replicate the way that it was passing data around uh i i will say that this system does need i do need to get better at ui and stuff like that but that's not important right now because you know i'm not no one is actually playing this and dealing with the ui uh so you can see this is the stores inventory and this is my players inventory uh right now i'm not actually doing the logic where i unlock an item and it adds it to my players inventory because i don't want to do that when you unlock an item i just want it to be unlocked in your inventory and say the match is about to start will have like a stage inside of the actual match where you get to pick up and equip items and those items will get added to that inventory and if someone kills you that inventory will get spawned on the ground that is why i have two separate inventories um but that it needs to be developed a lot more uh but for now we just you know making sure that i could spawn items from this inventory my players inventory into my actual hands here and use them so yeah this system is pretty deep uh i know i didn't really explain as well as i would have liked to there's a lot of moving parts with this system you have to use your noggin to to try to put these systems together because i combined the multiplayer ready version of this project here this inventory component project i combined it with the logic of the action rpg which is using the asset manager to to update an inventory so i had to kind of merge those two things together i probably will do a uh a longer tutorial series on something like this if you guys want that but right now i'm really just trying to get it to work i want everything to work exactly how i want it to work and then i'll think about sharing it with the with the public but yeah that's really all i got for you guys man uh if you appreciate this video if you got some ideas on how to improve this system leave them in the comments if this helped you improve your system or if you're working on a system like that and help you put fire under your ass or whatever it got you started let me know that as well i always like to know that i'm helping uh my voice just cracked jesus i'm hitting puberty guys it's over for me but yeah that's all i got for you guys i'll see you in the next video peace
Info
Channel: Dev Gods
Views: 152
Rating: undefined out of 5
Keywords: blender, rigify, houdini, c4d, maya, rigging, animation, game development, 3ds max, character rigging, first person, first person animation, weapons, fps, shooter, moba, bape, dreads, drip, fashion, unreal engine 4, UE4, UE5, Auto rig pro, CC3, Character Creator, ryzen 3950x, rtx 3060, rtx 3070, rtx 3080, rtx 3090, Enhanced Input, Playstation 5, Xbox, Windows, Lumen, Nanite, Epic Games, bitcoin, nft, stocks, money, investments, programming, recoil, gun laws, Shootings, Unity, Mobile games, android, ios
Id: 04FzERDoBDs
Channel Id: undefined
Length: 16min 27sec (987 seconds)
Published: Wed Sep 22 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.