The Gameplay Framework of Unreal Engine 4 is the way that Epic Games envisioned Unreal will be used to make games. It is still possible to make your own way but the framework provides a standard to follow and is integrated in the engine and the workflow.
- UObject - The base class for almost everything in the engine is UObject. Not used directly as there are more specific classes.
- Level -
- Actor - The basic game object or entity in unreal that can exist in a level.
- Pawn - A player or AI controlled actor.
- Game - The classes that manage to rules of the game.
- Subsystems -
- GameplayStatics - This is a static class with many game related functions. All functions can be called from anywhere using UGamePlayStatics::SomeFunction().
- GetFrameWorkObjects: GetGameInstance, GetGameMode, GetGameState. GetPlayerCameraManager, GetPlayerCharacter, GetPlayerController and GetPlayerPawn.
- Time : Get game time, real time, delta time and pause and unpause game.
- Spawn : Spawn things such as Sounds, Emitters and Decals.
There are three actors used to build the geometry of the game.
Trigger are actors that fires a event when some other object in the level interact with them. The shapes to select from are Box or Sphere triggers.
Data Driven Gameplay
Instead of tweaking values directly inside of blueprints and c++ code one can put them in spreadsheet documents and import them into the unreal. The first column is the name by which each row is accessed in the game. The rest of the columns depends on if it is imported as a Data table or a Curve table in Unreal. To use the sheet export it as a csv file and then import it to unreal.
In a curve table each row is the points of a curve. Each column heading contains the x-axis position and each value in the column is the y-axis value for the curve. The ability system in unreal use it for level values. So on row can be named Fireball_damage and then the curve is the damage for a level 1, 2 or 3 level fireball. For single values use a row with name, 0 and 1 and put the values in 01 and comments for designers in column 1. Sample at level 0 and ignore the other column that will be all zero.
- Blueprint: Use Evalute Curve Table row to get the value of a row.
- C++: UCurveTable and then GetRowMap and then Eval on the row.
For a data table a struct based on FTableRowBase is created in C++. Each row is in the sheet is then the content of such as struct and you use the name in the first column to access it. The header for each column is the name of a variable in the structure. A data table is useful when there is many things with the same information. Like if you have monsters in the game and each one has its health, movement speed and xp when killed.
- Blueprint: Get Data Table Row to get a row from a data table. Use break to split the structure for access to elements.
Composite data/curve tables