fit2097 notes sample - s3.studentvip.com.au

5
FIT2097 Games Programming 2 - Notes Contents GAME DEVELOPMENT TEAM 2 GAME OBJECTS 2 BLUEPRINTS 3 RENDERING 4 GAMEPLAY ELEMENTS 10 UNREAL ENGINE CLASSES 10 EXTENDED BLUEPRINT FUNCTIONALITY 12 PARTICLE SYSTEMS 12 USING C++ AND UE4 15 PHYSICS, COLLISIONS AND CASTS 17 MULTIPLAYER NETWORKING 18 ARTIFICIAL INTELLIGENCE 20 1

Upload: others

Post on 21-Feb-2022

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: FIT2097 Notes Sample - s3.studentvip.com.au

FIT2097 Games Programming 2 - Notes

ContentsGAME DEVELOPMENT TEAM 2

GAME OBJECTS 2

BLUEPRINTS 3

RENDERING 4

GAMEPLAY ELEMENTS 10

UNREAL ENGINE CLASSES 10

EXTENDED BLUEPRINT FUNCTIONALITY 12

PARTICLE SYSTEMS 12

USING C++ AND UE4 15

PHYSICS, COLLISIONS AND CASTS 17

MULTIPLAYER NETWORKING 18

ARTIFICIAL INTELLIGENCE 20

�1

Page 2: FIT2097 Notes Sample - s3.studentvip.com.au

Game Development TeamThe game development team consists on numerous people with a different set of roles:

• Designers• Artists• Programmers• Management• Business / Finance

A designer can also take up to form of a range of roles:• Game Designer• Level Designer• Gameplay Designer• Quality Assurance (QA) / Testing

An artist can have a large range of specific roles as well:• Technical Artist• Concept Artist - Provides designs on the end goal of the project• 3D Artist - 3D models objects• Texture Artist - Creates the appearance of different sprites and assets

Each programmer has a set of unique roles but are not limited to:• An engine programmer would create the game engine being used to run the game:

‣ C / C++ proficient‣ Specialises in a specific area:

‣ Physics‣ Rendering‣ AI

• A tools programmer creates tools for artists and designers‣ C++ and Game Engine‣ For example, Level Creation and Editing, Animation, ect.

• A gameplay programmer creates the game and incorporates all assets and code together.‣ C++, C#, JavaScript, Blueprints, ect and Game Engine‣ The specific gameplay elements are refined and tuned by designers

Although creating the game is important, regardless of quality, it is a failure without correct business and marketing strategies. The management team is important for a development team:

• Producer / Project Manager• CEO / Executive• Marketing• Community Management - Listens to the audience and allows for adjustments• Financial

Game ObjectsA game object is a C++ class that can be scripted and defined in the scene. In the Unreal Engine, the base class used is called an actor. There are many kinds of actors available:

• Meshes contain the 3D models created in 3D modelling packages such as Maya, 3DS Max, Blender, ect

• Lights, such as point lights, spot lights and directional lights�2

Page 3: FIT2097 Notes Sample - s3.studentvip.com.au

• Cameras display a portion of the screen to the user• Pawns can be possessed by a Controller (Player or AI) and a character is a child of a

pawn, including a skeleton mesh.• Volumes can be used to trigger certain code or activate specific physics functionality

Every actor has a:• Location• Rotation• Scale

These are known as the transform properties.

BlueprintsBlueprints are a way to implement game objects with visual scripting in the Unreal Engine. They can be instantiated multiple times in multiple scenes and projects. There are two types of blueprint:

• Level Blueprint: Is specific for the level and can’t be transferred and used on other levels

• Blueprint Class: Can be used on and level and in other projects

Games are developed by teams of both programmers and technical/creative professionals. Many artists don’t understand coding, so blueprints provides a visual way for them to implement their ideas in the game. They can utilise a range of complex tasks and can work just as fluently as the C++ versions.

• C++ runs faster than Blueprints when it come to execution• It is faster to develop a blueprint based game

If the team has multiple programmers, C++ is the recommended base, but a more artistic team would require blueprint use of coding. A good process is to develop the game in Blueprints and use C++ for the more complex tasks.

Blueprints can control a range of functions:• Events - controller fixed motions and cinematic• Variable changes• Function calls

Events tell us something has happened in the game world. Their nodes are red - a node is a blueprint connection.

• The BeginPlay event occurs when the level is loaded and game play commences

• A tick occurs every frame.

Execution wires link Blueprint nodes.• The order of execution follows the order of linked nodes from left to right.• To link nodes, simply drag from the execution point of

one node to the next.• To break a link either:

• Right click on the connection point and select Break link to… [next node type]

• Hold down the ALT key and click on the connection point

A branch node is the equivalent of a conditional if/else code statement. It takes a Boolean condition and executes different sets of statements depending upon the value.

�3

Page 4: FIT2097 Notes Sample - s3.studentvip.com.au

A sequence node can simplify large and complex blueprints to allow them to be readable and easily adjustable. It specifies the sequence of execution.

A switch node takes a variable as an input. The variable can be of various types and similar to a programming switch statement, it can execute a range of actions depending on the value testing. There can also be a Default pin that can be used if all other values fail.

A for loop node executes multiple lines from the first to the last index of a set. It exits via the Completion pin when finished. The entire loop is executed before the next frame is rendered.

While loops are similar, but execute code until the condition is no longer met. It too is executed entirely before the rendering of a frame.

One of the most important things while scripting to do is to output values. This allows for easy debugging of issues.

• The PrintString node will output text to the screen. The text will remain visible for the number of seconds specified in the properties. A colour can also be specified.

• The Append node can be used to easily convert a value of almost any type to a string to allow for output. They can also be used to join strings together.

Arrays can be declared and implanted in Blueprints. Default values can also be added for the array once it has been compiled. •The get node returns the value of the index specified. •Similarly, the add and remove nodes add and remove indexes from the array - arrays are fluent and not static like a conventional C++ array.

Blueprint functions can also be added which encapsulates a range of coding statements and conditions. They can also include a set of

parameters, both input and output. Calling a function can be done by simply calling the relevant node.

To make a comment in a Blueprint script, select the node required to comment and press the ‘c’ key.

RenderingUnreal Engine’s rendering system is based upon the DirectX 11 Pipeline:

Vertex Shader → Hull Shader → Domain Shader → Geometry Shader → Pixel Shader

There are three types of lighting paths:• Fully Dynamic (moveable)

‣ Calculated at run time‣ Supports moveable objects and lights‣ Sacrifices quality for flexibility

�4

Page 5: FIT2097 Notes Sample - s3.studentvip.com.au

• Fully Static (static)‣ Lighting is pre-calculated and baked into the map‣ Moveable objects and lights are not supported‣ Can provide the best quality using more intense methods such as ray tracing to

calculate lighting• Partially Static (stationary)

‣ Combines elements of dynamic and static lighting

For static and stationary lighting, light maps are similar to textures when they are baked. The higher the light map detail, the better quality lighting and shadows; the more memory is occupied. These form of lighting require calculation before the effects can be seen. Lightmass is the too Unreal uses to calculate baked lighting. Building lighting can take hours or even days, depending on the scale of the map, but can create cinematic quality effects.

Real time rendering is computationally expensive and can compromise the frame rate. To create a sense of realism in the scene, combination of different forms of mapping can be used.There are a few tricks to ‘fake’ some specific lighting effects:

• Opacity mapping makes sections of an object transparent or opaque. Dark colours create transparency - white has no transparency, mid-tones have partial transparency. Specular highlights are maintained giving a glass like appearance.

• Normal maps use normal vectors (unit vectors perpendicular to the surface) to determine the orientation of the surface. They are texture maps that use RGB channels to represent the direction of the normal vector.

• Faking reflection can also be done in two ways:‣ Environment mapping provides a ‘cheep’ but effective alternative to properly

mirroring the environment (requiring large computations) in a reflection. 6 projections (up, down, left, right, front, back) are rendered from the position of the reflected object and then mapped to the object.

�5