Unreal Balance Spreadsheets - UDataTable and FTableRowBase explained - UE C++ Tutorial

preview_player
Показать описание
Data tables are a way to integrate spread sheets into your game.
Spreadsheets give a high level way of controlling a lot of data in a single place, ideal for game balancing.
Unreal implements this with the UDataTable class.
You create a custom FTableRowBase struct subclass, to define your data.
Each member variable in your FTableRowBase struct, corresponds to a column in the spread sheet.
That is, as long as they're UPROPERTYs with the same name, of a supported data type.

You can read this data in gameplay using an FDataTableRowHandle.
This allows you to conveniently specify a UDataTable and a row in that data table, from which to pull data.

In C++, you can restrict the UDataTables selectable by using the "RowType" meta specifier.
Here you specify the name of the FTableRowBase subclass you want to constrain your FDataTableRowHandle variable to.
Just make sure to remove your "F" prefix from the type, it needs to appear as it does in the editor (which omits the F prefix)
With this, in the editor you can only select appropriate row types.

Data tables can also be created via blueprint structs, which define the row type.
You can do this entirely in the editor, and then export as a CSV file to convert over to a spreadsheet workflow.
This CSV file can be checked into source control and allows merging.
The Data table uasset can "reimport" from this CSV file to take changes made in the spreadsheet workflow.

CSV stands for comma separated values.
It is actually just a text file.
Commas separate the columns.
And new lines separate rows.
This makes it easy to see changes in a diff view.
You can even merge changes by hand, if necessary.

Additionally, there is a workflow with XLSM files, which are microsoft excel files.
These can contain formulas for complex calculations.
The result of the formulas can be exported to a CSV for engine consumption.
Macros within excel are used to export the results to a CSV file.
The Unreal documentation provides an example on how to set up a workflow like this.
Note that excel files are binary files, and not plain text like CSV.
For this reason, I personally prefer to work with CSV files where appropriate.
But some game systems may need complex data manipulation, and excel can be used in those situations.

The data table workflows are flexible in this regard, giving you many options for testing changes in the editor, or in a spreadsheet.

0:00 Video Preview
5:50 Building a csv spreadsheet that can be used by the engine
6:21 Saving CSV files in the content data table folder
6:45 Showing CSV files are text files
6:55 Mapping CSV data to code with FTableRowBase
8:00 Getting CSV file into engine, as a UDataTable uasset. Selecting the FTableRowBase
8:25 |Editor to CSV| Writing editor changes to data back to a CSV file (exporting to an existing CSV file, export as csv)
9:04 |CSV to Editor| Reimporting data changes from a CSV back to editor
9:22 Creating a C++ "jumping" actor, that reads data from a data table to change how it jumps.
9:28 Jumping actor constructor
9:37 Jumping actor begin play
9:55 Jumping actor actor overlap
10:15 --- Using FDataTableRowHandle to access an individual row in a data table spread sheet ---
10:37 Constraining the row types with meta=(RowType="TableRowBaseSubclass")
11:01 Constraining row types including module name
11:35 Checking if a row has been set
11:43 Cleaning up code by adding access specifiers
11:48 Jumping actor - making a blueprint subclass
12:07 Selecting a table - hooking up to a FDataTableRowHandle in the editor, with constraints vs non constraints
13:01 Selecting a row
13:16 Jumping actor - adding box overlap
13:29 Setting rows on level instances
13:50 Jumping actor tick override pt 1
14:50 !!! How to read data from a table row handle in code -- GetRow template function !!!
16:27 Jumping actor tick override pt 2
18:00 Testing data driven jump behavior with breakpoints and PIE
19:03 Reading C++ defined table rows in blueprint
20:00 Testing blueprint reading C++ row data in PIE
20:22 Creating a table uasset in blueprint, from the editor
20:29 Blueprint table - making a blueprint row structure
20:51 Blueprint table - making a table from a blueprint structure (no CSV, yet), and adding rows
21:50 Blueprint table - exporting to a CSV file (export as CSV) and establishing reimport flow pt1
22:59 Changing data table import property details (like ignore fields, etc.)
23:08 Blueprint table - exporting to a CSV file (export as CSV) and establishing reimport flow pt2
23:30 Blueprint table row handle variables - reading data from variable
24:51 Blueprint table row handle variables - testing in PIE
25:10 Unreal official documentation on data tables
25:20 Using excel files to export to CSV
27:09 Complex data in spreadsheets - references to static mesh assets
29:24 Closing remarks
29:29 Outro

Рекомендации по теме
Комментарии
Автор

Corrections / Amendments:
5:54 - This sounds like you have to type the text "RowName" but you don't. You just need to make sure the first column has the row names. but the heading doesn't have to be that literal "RowName" text. I could have worded that better.
27:31 - I meant to say, it may not be loaded into RAM. it will be on disk, but maybe not in loaded memory.

enigma_dev
visit shbcf.ru