Detailed Study Guide on Data Types and Variables in Unreal Engine

Overview of Data Types and Variables

  • Review of data types and variables discussed previously.

  • Starting arithmetic operations in blueprints, allowing calculations.

Project Access

  • Access projects by navigating to the root of the designated drive:

    • Go to the full self folder.

    • Navigate to the current month.

    • Select the relevant class and assignment or lecture.

    • Double-click the project file to open it.

  • Importance of this method: Avoids opening multiple copies of projects, reducing confusion.

Unreal Engine Loading

  • Initial loading time observed; longer for the first session of the day.

  • After caching, loading speeds improve.

Project Overview

  • Working within the third-person template project created earlier.

  • Notable components in the level:

    • Instance of the "BP Data Types" blueprint.

  • Nodes with red headers indicate events that occur in the game.

    • Example: "Event Begin Play" which triggers upon game start.

Data Types

  • Boolean Values:

    • Definition: Represents true/false; abstract concept.

    • Limitations: Not used in arithmetic calculations.

  • Integers:

    • Explanation of types:

    • Byte: Stores values 0-255.

    • Regular Integer: Approximately ±2 billion.

    • Int64: Approximately ±9 quintillion.

  • Floats:

    • Two types:

    • Single Precision: Limited decimal precision.

    • Double Precision: Greater decimal precision.

  • Strings:

    • Description: Character strings made of printable symbols.

    • Name, string, and text types for various lengths and use-cases.

  • Composite Data Types:

    • Vector: Composed of three floats (x, y, z).

    • Rotator: Similar to vector, but specifically for rotation without gimbal lock.

    • Transform: Composed of two vectors and one rotator (location, scale, direction).

Value Types vs Reference Types

  • Value Types: The actual values stored (e.g., integers, booleans).

  • Reference Types: Store a memory address rather than the actual object (e.g., actors). Examples provided using Adam Sandler as a metaphor.

Understanding Variables

  • A variable is a container for storing information, akin to a box on a shelf.

Creating a Variable:
  1. Click the plus button next to variables.

  2. Name the variable (uses Pascal case).

  3. Choose the appropriate data type.

  4. Assign an initial value to the variable:

    • Setting Values:

      • During runtime: use "Set" node.

      • At compile time: using the details panel or making editable in the editor.

  • Example of character stats:

    • Assigning various attributes like name, strength, stamina, etc. as variables.

Assigning and Retrieving Variable Values

  • Various methods and examples of setting variable values:

    • During Runtime: ( \text{Set Node} )

    • At Compile Time: Use the details panel for direct assignment.

    • Make a variable instance editable for setting references.

  • Retrieving values from variables using the Get Node.

  • Importance of using Get instead of Set to avoid overwriting values inadvertently.

Arithmetic in Blueprints

Basic Operators:

  • Five arithmetic operators discussed: Add, Subtract, Multiply, Divide, Modulus.

Example Demonstration:
  • Addition Example: Correctly connecting inputs to perform addition.

Pitfalls:
  • Division by zero and output type conversion errors explained.

Utilizing Delta Time for Animation

  • Need for consistent rotation or movements irrespective of frame rate:

    • Introduced delta seconds for timing movements accurately.

    • Demonstration of using delta seconds with a rotation speed variable.

Best Practices in Blueprint Logic

  • Structure code for readability and avoid visually confusing elements (referencing "bad pins").

  • Suggested guidelines for creating efficient and understandable Blueprint scripts:

    • Increment and decrement nodes for changes in variable.

  • Reinforcement of avoiding unnecessary math operations, allowing the engine to handle calculations

Assignment Guidelines

  • More practice and explorations of arithmetic functions will continue in subsequent lessons.

  • Encouragement to explore the variables and arithmetic concepts in practical applications.

Conclusion

  • Recap of data types, variables, and basic arithmetic usage in Blueprints

  • Encouraged engagement for next class session.