[Conception] Better solution between DataTable , Data Only Bp and DataAsset

Hello Community,

I got a question about game conception.

Lets explain my problem.

I find 2 ways to store datas and all got good + and -.

First there is DataTable and second there is data BP I mean by DataBP, BP who inherit from another BP without adding any functionnality just changing properties. I find DataBP very intresting by the fact they are simple to modify and can be directly referenced into other bp by the broswer.

Do you see any reason to use DataTable across DataBP?

Thanks for any experienced advice.

1 Like

UP the post to get more chance to be answered

Hi,

Just curious, Could an Array solve this?

Regards

Hello ,

I don t really understand the question.

Could you be more precise please?

Thanks for answer.

I mean by my question what is the usage case of Data Only BPs and DT.

In my game i got some weapons for exemple who have of course data Name, Dmg etc…
So if i want to use it, I must read data table each i instanciate an to get default values wherease with data BP I can just reference the class and read default values.

What kind of stuff i must use in this case?

Do you see any reason to use DataTable
across DataBP?

I do not not understand the question - those entities serve different purposes. It’s a bit like comparing apples and oranges.

If you want to store static data - use a DataTable, if you want to modify and store that data, you could use a data only BP, sure. But you may as well just keep in a struct.

In addition, you can pull values from a DT without any references - which is a good thing.

So, what is the problem with reading from Data Table? How often are you going to be creating instances of the weapon BP? I use Data Tables to quickly generate a large variety of weapons, where I can set everything from damage, to static mesh, colors etc. If your variables are the same, if you have an instance in existance, you could just reference that instance and readd the default valus from that instance, and if there is no instance, create a new one and read from Data Table, then have a Struct on your BP Class for the Defaults and set the values from the table, now you can pass that struct from any instance in existence?

Ok so for u the greatest way for standard instance is to create something like a singleton and read values from this instance.

The problem is i think it s not really optimize to read data table cause if i use DataOnlyBP i think it s more quick?

And in DT i must have something like an index so for designer it s more difficult to create stuff with that.
For exemple when you kill an enemy he will spawn stuff. This stuff is random but i got a BP where there is something like ItemClass | Proba | Value if i switch to an index i think it s quite less friendly for designers who got to look in the DataTable to see what index is what Item?

In general i don t see the use cases beetween DT and DataOnlyBp they looks quite similar they all store data. And DDataOnlyBP are mor easy cause they have the inheritance feature can you explain me the use cases?

Thanks^^

Well, I have only been using Unreal for maybe 10 months now so not really sure what I don’t know. What ARE Data Only Bleprints? Is this what yiou are calling an Actor Component? I only use blueprints, so I dont know if this is a class only accessible through C++?

You could always run a loop test doing 10000 iterations one on DT and one on DataBP and see what the times are. If is negligible then it is up to what is the easiest to work with in the manor in which it is being used. Your Data Table Rows ID is a name, not an index, so you can literally write a name or a type of identifier for each item. E.g. Row Name = “Armor_Helmet_0001”. You can name it whatever so it’s for you to think outside the box and get clever in your naming scheme. And your not just limited to one data table. You could have a data table for Armor, Long Swords, Short Swords, Helmets etc. and then also have a Data Table which has all armor, all weapons all swords or whatever (it would be tricky to create this as I do not know of a way to automatically generate a new Data Table, but may be possible via C++ so that this task is automated. You could alsohave a seperate table for each seperate list of random item drops. Each of those Data Tables would have a listof items that can be randomly dropped from that list. As far as ease of creation, for me, I made a Data-Table for Projectiles, which contains a list of any and all data used by any projectile (Static Mesh, Particle System used, Speed, Damage, Colors Etc.) and this way I can easily create new projectiles just by adding them to the Data Table and selecting values for the options.

I would think the limit on Data Objects is that they are objects, each one is going to take up memory yes/no? so each instance you have is going to take up memory? The downside I have seen from Data Tables is the values are set and cannot be set at runtime from what I know of. The nice thing about Actor Components, is you can simply attach them to the Actor, so if you have an Actor Component for a particular list of item drops, the design can simply attach it to the actor, and the actor can have a variable to hold a reference t the Actor Component Parent Class “Item Drops” while the actual Actor Component could be parent class “Item Drops” but actually be a child called “Weapons Level 1”.

For my setup, I have a spaceship that player can equip. The loadout screen is where player chooses weapons, bullets and ship components, this screen reads data from table which contains descriptions of items etc. Then, when player is done, only the neccesary info for gameplay is stored in Structs (Ship, Reactor, Engine, Weapon 1, Weapon 2 etc.) and those structs are stored on the Player Controller, then when game loads level, the Player Pawn reads the data from player controller, calculates any variables based on that data at begin play, and then when level ends, I hve the original setuip to bring back up on load screen. I use Actor Components for all the ship components so that each “Burst Mode” has access to same functions, but each child can have different code to control how ship moves using that burst mode.

Thanks for answering =)

DataonlyBP is a blueprint where you only change values whitout making any functions etc.
You can create for exemple a Weapon BP inherit from Uobject.
WeaponBow how inherit from WeaponBP.
and in this one you code the custom code for bows and u got some properties like you said projectile mesh, speed emitter etc…

When you are inherit for this WeaponBowBP and name your bp like WeaponLongbow and restart the engine you will see a BP when u can easilly change properties. End by the node get class defaults you can get the properties values. So it s why i m a litle lost about DataOnlyBP and DT.

They all seems do the same thing.

DataTable was originally made to imported table data like csv files and historiclly ever since UE1 classes (regardless if UnrealScript or C++) always been used as main property storage and making empty classes with data layering over each other was always standard practice… specially that there was no DataTables at all. For some reason in UE4, they become considered main storage of static data as Everynone implied. Sometimes overused for no reason, like storing list of levels, while you can make data asset with simple array, or even better make a world settings storing information of next level (In most cases probably because people don’t kwno you can do that and requires C++, but oyu can still make some level playlist class ;]).

So in general properties (not only data-only BP, but also data assets and in general settings properties like world settings) are always better to store information in UE4, regadless if it static of not, there no better example of that the… all assets you see stored in content browser, they have a lot more benefits

-They a lot easier to access don’t need to parse thru the table, don’t need to create as you can read defaults and you can use data assets that are already a objects in asset registry

-Data Assets (Well classes too if you read from defaults) in perticilar are a lot easier to reference via they are visible as objects, while in Data Table you can refrence only entire table and you need to use keying to reference anything

-In BP classes in perticlar, you can use benefits of inherence. If you don’t override specific property in sub classes, if you change in it parent class all sub classes will automatically inherent that

-They are properly serialized to byte form of respective used types, so inherently they better for processing in UE4

-DataTables have limited types while in properties you can use any type that UE4 has to offer.

Only benefit for DataTable that i can think of and probably main reason why people use them so much is proper out of the box table editor for asset that stores data, while data asset just use generic property editor where data can be show as table. Also data assets require C++, so data storing blueprint is only option if you don’t want to use C++… but come on declaring properties in C++ is super easy and thats all you need to do ;p But you can still use blueprint classes option

If you don’t know about data assets:

Data assets are actually shortcut for creating proper asset types, which requires to make UFactory and AssetActions

1 Like

Well, for the most part, they do, how ever Data Tables are also able to read in Data from Databases and CSV files etc. You just have to decide which is best for your situation. If you have to SET variables at run I would go with DataBP, if your Data is not going to change at run-, I would use Data Tables. You could even combine the two if you need to change the variable values at runtime, have your DataBP load initially from data-table, then changed values can be saved to the DataBP and your original values are still in tact. Personally I prefer Data Tables cause I can quickly changes settings for many things on one screen witout having to open each individually. But by using inheritance, you can change a variable in parent and it will change all. , I know I’m not making this easier to decide, but there really i no best solution, there is just the solution that works best for you. Would you rather have a folder with 10k objects in it? Or a Data-Table with 10k rows?

ohhh, ain’t she purrrdy! That there is one of the sexiest answers I have ever come upon. A lot of good info there! Thanks for that! I will have to lookinto creating Data Assets whn I get into C++, for now I have too many more important things to learn than C++, but for my next [roject I will have to use C++.
I will check out DataOnly Blueprints, but the only thing I dont quite understand, is how to get/make a reference or variable for something that is in the content browser to be able to access it in blueprint only. From my expereince, it has to actually be in the (the(World Outliner) to be able to reference/access it, which is why I used Data Tables amongst other reasons, because I can access a Data Table without having to get a reference to something in the Level.
What you informed about DataObjects though will solve a problem I had trying to figure out how to do Level Scale as I tried putting a variable in Level Blueprint but then realized nothing can access it or get the value. Now I can create a Data Blueprint and add to the World Outliner for that level with the scale of the level, and whenever I spawn an actor can search for that actor class (which would be the only one) and bget the level scale! Thats wonderful!.
The one thing I do with data tables though, is in naming the row with a pattern, I can create the name and get the row. Maybe once I understand data blueprint better I will see how to do that with Data Blueprints. For instance, “A” prefix is for weapons that get attached to weapon slot “A”, and a digitit serialed number after is the weapon identifier number. So I can pull any weapon out of data table by knowing the slot letter and weapon number. Don’t need to egt an reference.
! Again, great nfo and links!
Thanks

Thx.

So yeah i think that having inheritance of bp class is a real plus and data table seams to be a litle oudated cause we need to create id and them remember those ids to use as string etc… I really prefer direct reference to a BP and i thing it s 8bytes if i don t miss something there.