How can I design and implement an asset database?

Hi,

In a few word, I would like to do stuff like FamilyInfo (UDK) but managed in the editor and not in C++.
I’m looking for best pratices feedback on this topic.

My goal: Be able to set a Blueprint that corresponds to a list of “playable” character that the player can choose as a default pawn.

GameMode is the class that should set/load the PawnDefaultClass
PlayerController should be able to manage an ID that the player choose. This Id will be pull by GameMode when looking for the default class to spawn for this Controller.

now where I’m not sure how to it.

1 - If I want to be able to blueprint (Archetype) the dictionary to maintain it in the editor so I must create a AActor base class. Right?
2 - In this class, I should use an array of FStringAssetReference to avoid that the asset are loaded when the BluePrint is loaded. Or Can I access the asset class without loading them by using an array of Character?
3 - I should create a Singleton of this class or inside “GameKing” like class.
4 - I should be able to retrieve the class from the FStringAssetReference

This is how I think to do it? Is it the right way?

More how do I obtain the PawnClass from FStringAssetReference? I can get the path string, but after, I don’t know how to move further. Should I use the FStreamableManager ?

Should I spawn my Dictionary Blueprint or can I access the Array by using static variable ? or by looking at the Default definition of this blueprint? How can I do that?

Thanks for your help.

Hi,

Thanks for the link.
Your tutorial is more than useful but not exactly what I was looking for at the end.
Your solution is for Modular Pawn setup & management.
My target is just a set of PawnSetup that I want to be able to switch during GameMode Spawn function.

In fact, I mixed up some notions and by reading your implementation and some other thread, I think my path will be to use an array of “UClass”.

By doing this, my database blueprint will holds Class references. Those will be my blueprint and then I will be able to spawn them as PawnDefaultClass of my GameMode.
I also read that I can BluePrint my GameMode so I won’t have any Hard reference to BP in C++.

If I properly understood the concept, the UClass references should not load asset in memory until I spawn them. If someone can confirm this, I will apreciate.

So whatever the number of Pawn setup I have, there won’t be any impact on memory because only 1 type of Pawn will be fully loaded.

If you have a TArray< TSubClassOf< UCharacter> > or TArray< UClass *> those blueprints will be loaded as soon as the containing object is loaded. If you use a TArray< FStringAssetReference > or TArray< TAssetSubclassOf< UCharacter > > they will not. So, you can use basically the same method as described in creasso’s tutorial, but with blueprint classes.

Ho I didn’t see that one coming. I really thought UClass will act differently than UCharacter.
Thanks for the clarification and I will base my solution on the tutorial provided by Creasso.

How can I sync GameMode GetDefaultPawnClass function with this? Any tips?
I will dig deeply in the code of GameMode, but in the current implementation when GetDefaultPawnClass is called, I can’t just call the controller to get the class to spawn (as it is not loaded and won’t be loaded async).

I have in mind to create a ReadyState on the controller that will be used to know if the Class has been loaded.

Thanks,

You should override AGameMode::SpawnDefaultPawnFor. You can make sure it’s set to a default pawn class (APawn is fine), but then in SpawnDefaultPawnFor you can spawn whichever class you actually want, that function has access to the controller.