x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How efficient is accessing data tables?

I would like to know how efficient it is to:

  1. Search for a data

  2. Get data by row name

Is it O(1) or O(n) ? Do I have to manually cache Data Table in memory or will they be cached into memory at runtime?

Imagine I have to implement an item inventory system for an RPG.

Data Table Method:
I could save all basic data related to all items such as Name, Type, Value, Weight and Static Mesh Reference, in a Data Table. Then I can have a common class/object and assign these values from data table at runtime when needed. (there will be many Get Data Table Row calls). However, unique items need to have their own classes.

OOP Method:
Create basic item class and all items inherit from it as a separate class. Unique items are dealt the same way.

Which method above will be efficient in time ? and in space ?

Product Version: UE 4.16
Tags:
more ▼

asked Jul 12 '17 at 08:18 AM in Blueprint Scripting

avatar image

Deamonpog
16 1 2 3

avatar image Strombonni Mar 09 '18 at 01:57 AM

I'm hoping that a map is like a C# dictionary which is very fast access, and that datatable access is as fast as that. But I don't know and haven't measured performance with a data table of significant size.

avatar image Simsaladoo Mar 09 '18 at 02:53 AM

the performance should be great in-game, but the struct editor and datatable editor within unreal will lag horribly past around 100 or so rows. RAM is great for that kinda stuff at runtime, but I'd recommend writing the struct and enums or other stuff straight into source for ease of editing.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

4 answers: sort voted first

Im making an extensive data driven Rpg thats drawn from my co-dev's work of 20 years creating a Pen and paper game (which is actively played) I am using massive data driven tables for everything from item generation, player stats (temp, elevation,sickness, hunger, thirst) and have not noticed any decrease in performance pulling from the data sets (which is done though the use of onconstruct or event begin play (not on tick)

I have been smart about my data, I have sectioned it so instead of one giant table, its many smaller tables which direct the information where its needed and I don't constantly pull or set data in tables (only at certain points, like skill changes) instead of tracking things like health which constantly update (this is handled though Var's and then verified by the server for multiplayer (as a basic anti-cheat)

my world includes huge open area's an infinite procedurally generated dungeon and 2&4k textures (with tessellation/displacement) and still no performance drop, data tables are absolutely the way to go, and its far easier to deal with finding/changing variables this way.

there is apparently a known issue when a DT gets too big in Unreal editor environment (over 500) but when launches in-game/standalone no issues with data slowdown.

more ▼

answered Apr 01 '18 at 03:32 PM

avatar image

Demonsunder
11 1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Data Tables are the way to go for data driven design. You won't run into any performance issues in 99.99% of the use-cases, I use them extensively for the use-case you've described.

more ▼

answered Apr 01 '18 at 03:18 PM

avatar image

gk0r
161 1 6 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

@Demonsunder: Thank you. Do you spawn a loader object which calls the data table, then destroy the object when it's done? Essentially, I'm trying to avoid having everything that's in the data table stored in memory at all times (skeletal meshes for armor), and if I keep the call to the data table in the function on the player character, I'm worried they will be.

more ▼

answered Apr 15 '19 at 11:49 AM

avatar image

Nerdballer Games
35 5 15 15

avatar image Nick Jackson Apr 21 '19 at 11:25 AM

It only stores them as reference, you don't have to worry about memory bloat.

avatar image Nerdballer Games Apr 24 '19 at 08:48 AM

Wrong, memory bloat from refs can be substantial. In fact, mine is, and I need a solution. My question still stands.

avatar image aWinter Apr 24 '19 at 12:42 PM

Personally I haven't found a reasonable way to use BP Datatables. The answers in this Thread (just like many Inventory Systems in the Marketplace) are disturbing. So I'd like to second Nerdballer's Question. Although I don't see a Loader object solving this by any means.

avatar image Nerdballer Games Apr 25 '19 at 03:46 AM

Youre right. I've tested and loader objects do nothing.

If you're doing it mainly for an inventory, you're in luck: arpg example project has a nice solution for you. Just copy it. As the visuals of an inventory are client-side, it's not a problem.

My problem is I need to roll in networking with my system. In other words, you haven't loaded in on your client a reference for every armor in the game, so when another player becomes net relevant, it needs to do a check to see if it needs to load their armor. I'll probably edit Replication Graph for this, but it's a bear.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

You can also pull datatables out of unreal and edit them with Gsheets/excel and then replace them just ensure you save as a .csv

more ▼

answered Apr 01 '18 at 12:09 AM

avatar image

Demonsunder
11 1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question