Unreal Engine 4.x Scripting with C++ Cookbook
图书信息
| 作者 | John P. Doran |
| 出版社 | Packt Publishing |
| ISBN | 9781789803372 |
| 出版时间 | 2019-03-29 |
| 字数 | 54.3万 |
| 分类 | 进口书,外文原版书,电脑,网络 |
读书简介
Write efficient, reusable scripts to build custom characters, game environments, and control enemy AI Key Features * Build captivating multiplayer games using Unreal Engine and C++ * Incorporate existing C++ libraries into your game to add extra functionality such as hardware integration * Practical solutions for memory management, error handling, inputs, and collision for your game codebase Book Description Unreal Engine 4 (UE4) is a popular and award-winning game engine that powers some of the most popular games. A truly powerful tool for game development, there has never been a better time to use it for both commercial and independent projects. With more than 100 recipes, this book shows how to unleash the power of C++ while developing games with Unreal Engine. This book takes you on a journey to jumpstart your C++ and UE4 development skills. You will start off by setting up UE4 for C++ development and learn how to work with Visual Studio, a popular code editor. You will learn how to create C++ classes and structs the Unreal way. This will be followed by exploring memory management, smart pointers, and debugging your code. You will then learn how to make your own Actors and Components through code and how to handle input and collision events. You will also get exposure to many elements of game development including creating user interfaces, artificial intelligence, and writing code with networked play in mind. You will also learn how to add on to the Unreal Editor itself. With a range of task-oriented recipes, this book provides actionable information about writing code for games with UE4 using C++. By the end of the book, you will be empowered to become a top-notch developer with UE4 using C++ as your scripting language! What you will learn * Create C++ classes and structs that integrate well with UE4 and the Blueprints editor * Discover how to work with various APIs that Unreal Engine already contains * Utilize advanced concepts such as events, delegates, and interfaces in your UE4 projects * Build user interfaces using Canvas and UMG through C++ * Extend the Unreal Editor by creating custom windows and editors * Implement AI tasks and services using C++, Blackboard, and Behavior Trees * Write C++ code with networking in mind and replicate properties and functions Who this book is for If you are really passionate game developer looking for solutions to common scripting problems, then this is the book for you. Understanding of the fundamentals of game design and C++ is expected to get the most from this book.
目录
Contributors
About the authors
About the reviewer
Packt is searching for authors like you
www.PacktPub.com
Why subscribe?
Packt.com
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Download the color images
Conventions used
Sections
Getting ready
How to do it…
How it works…
There's more…
See also
Get in touch
Reviews
UE4 Development Tools
Introduction
Technical requirements
Installing Visual Studio
Getting ready
How to do it...
How it works...
Creating and building your first C++ project in Visual Studio
Getting ready
How to do it...
How it works...
There's more...
Changing the code font and color in Visual Studio
Getting ready
How to do it...
How it works...
There's more...
See also
Extension – changing the color theme in Visual Studio
How to do it...
How it works...
Formatting your code (Autocomplete settings) in Visual Studio
Getting ready
How to do it...
How it works...
Shortcut keys in Visual Studio
Getting ready
How to do it...
How it works...
Extended mouse usage in Visual Studio
How to do it...
How it works...
Installing Unreal Engine 4 (UE4)
Getting ready
How to do it...
How it works...
There's more...
Creating your first project in UE4
How to do it...
Creating your first level in UE4
Getting ready
How to do it...
UE4 – hot reloading
Getting ready
How to do it...
UE4 – logging with UE_LOG
Getting ready
How to do it...
How it works...
UE4 – making an FString from FStrings and other variables
Getting ready
How to do it...
Creating Classes
Introduction
Technical requirements
Making a UCLASS – deriving from UObject
Getting ready
How to do it...
How it works...
There's more...
See also
Creating a blueprint from your custom UCLASS
Getting ready
How to do it...
How it works...
Creating a user-editable UPROPERTY
Getting ready
How to do it...
How it works...
There's more...
See also
Accessing a UPROPERTY from blueprints
How to do it...
How it works...
Specifying a UCLASS as the type of a UPROPERTY
Getting ready
How to do it...
How it works...
TSubclassOf
FStringClassReference
Instantiating UObject-derived classes (ConstructObject< > and NewObject< >)
Getting ready
How to do it...
How it works...
There's more...
Destroying UObject-derived classes
Getting ready
How to do it...
How it works...
Creating a USTRUCT
Getting ready
How to do it...
How it works...
There's more...
Creating a UENUM( )
How to do it...
How it works...
Memory Management, Smart Pointers, and Debugging
Introduction
Technical requirements
Unmanaged memory – using malloc( ) / free( )
How to do it...
How it works...
Unmanaged memory – using new/delete
Getting ready
How to do it...
How it works...
There's more...
Managed memory – using NewObject< > and ConstructObject< >
Getting ready
How to do it...
How it works...
There's more...
See also
Managed memory – de-allocating memory
Getting ready
How to do it...
How it works...
Managed memory – smart pointers (TSharedPtr, TWeakPtr, TAutoPtr) to track an object
Getting ready
How to do it...
How it works...
There's more...
Using TScopedPointer to track an object
Getting ready
How to do it...
How it works...
Unreal's garbage collection system and UPROPERTY( )
How to do it...
How it works...
Forcing garbage collection
Getting ready
How to do it...
Breakpoints and stepping through code
Getting ready
How to do it...
How it works...
Finding bugs and using call stacks
Getting ready
How to do it...
How it works...
Using the profiler to identify hot spots
How to do it...
How it works...
Actors and Components
Introduction
Technical requirements
Creating a custom Actor in C++
Getting ready
How to do it...
How it works...
Instantiating an Actor using SpawnActor
How to do it...
How it works...
Creating a UFUNCTION
How to do it...
How it works...
Destroying an Actor using Destroy and a Timer
How to do it...
How it works...
Destroying an Actor after a delay using SetLifeSpan
How to do it...
How it works...
Implementing the Actor functionality by composition
Getting ready
How to do it...
How it works...
See also
Loading assets into components using FObjectFinder
Getting ready
How to do it...
How it works...
Implementing the Actor functionality by inheritance
How to do it...
How it works...
See also
Attaching components to create a hierarchy
How to do it...
How it works...
Creating a custom Actor Component
How to do it...
How it works...
Creating a custom Scene Component
How to do it...
How it works...
See also
Creating an InventoryComponent for an RPG
Getting ready
How to do it...
How it works...
See also
Creating an OrbitingMovement Component
How to do it...
How it works...
Creating a building that spawns units
How to do it...
How it works...
Handling Events and Delegates
Introduction
Technical requirements
Handling events that have been implemented via virtual functions
How to do it...
How it works...
There's more...
Creating a delegate that is bound to a UFUNCTION
Getting ready
How to do it...
How it works...
See also
Unregistering a delegate
Getting ready
How to do it...
How it works...
Creating a delegate that takes input parameters
Getting ready
How to do it...
How it works...
See also
Passing payload data with a delegate binding
Getting ready
How to do it...
How it works...
See also
Creating a multicast delegate
Getting ready
How to do it...
How it works...
Creating a custom Event
Getting ready
How to do it...
How it works...
Creating a Time of Day handler
How to do it...
How it works...
Creating a respawning pickup for a First Person Shooter
How to do it...
How it works...
Input and Collision
Introduction
Technical requirements
Axis Mappings – keyboard, mouse, and gamepad directional input for an FPS character
Getting ready
How to do it...
How it works...
See also
Axis Mappings – normalized input
Getting ready
How to do it...
How it works...
Action Mappings – one-button responses for an FPS character
Getting ready
How to do it...
How it works...
See also
Adding Axis and Action Mappings from C++
Getting ready
How to do it...
How it works...
Mouse UI input handling
Getting ready
How to do it...
How it works...
UMG keyboard UI shortcut keys
Getting ready
How to do it...
How it works...
Collision – letting objects pass through one another using Ignore
Getting ready
How to do it...
How it works...
Collision – picking up objects using Overlap
Getting ready
How to do it...
How it works...
Collision – preventing interpenetration using Block
Getting ready
How to do it...
How it works...
There's more...
Communication Between Classes and Interfaces: Part I
Introduction
Technical requirements
Creating a UInterface
How to do it...
How it works...
See also
Implementing a UInterface on an object
Getting ready
How to do it...
How it works...
Checking if a class implements a UInterface
Getting ready
How to do it...
How it works...
See also
Casting to a UInterface implemented in native code
Getting ready
How to do it...
How it works...
Calling native UInterface functions from C++
Getting ready
How to do it...
How it works...
See also
Inheriting UInterfaces from one another
How to do it...
How it works...
Overriding UInterface functions in C++
Getting ready
How to do it...
How it works...
See also
Implementing a simple interaction system with UInterfaces
Getting ready...
How to do it...
How it works...
Communication Between Classes and Interfaces: Part II
Introduction
Technical requirements
Exposing UInterface methods to Blueprint from a native base class
How to do it...
How it works...
See also
Implementing UInterface functions in Blueprint
How to do it...
How it works...
See also
Overriding C++ UInterface functions through Blueprints
How to do it...
How it works...
Calling Blueprint-defined interface functions from C++
How to do it...
How it works...
Integrating C++ and the Unreal Editor: Part I
Introduction
Technical requirements
Using a class or struct as a blueprint variable
How to do it...
How it works...
There's more...
Creating classes or structs that can be subclassed in Blueprint
How to do it...
How it works...
Creating functions that can be called in Blueprint
How to do it...
How it works...
See also
Creating events that can be implemented in Blueprints
How to do it...
How it works...
Exposing multi-cast delegates to Blueprint
How to do it...
How it works...
See also
Creating C++ enums that can be used in Blueprint
How to do it...
How it works...
Editing class properties in different places in the editor
How to do it...
How it works...
See also
Making properties accessible in the Blueprint editor graph
How to do it...
How it works...
Responding to property changed events from the editor
How to do it...
How it works...
Implementing a native code Construction Script
How to do it...
How it works...
Integrating C++ and the Unreal Editor: Part II
Introduction
Creating a new editor module
How to do it...
How it works...
Creating new toolbar buttons
How to do it...
How it works...
Creating new menu entries
How to do it...
How it works...
Creating a new editor window
How to do it...
How it works...
See also
Creating a new Asset type
How to do it...
How it works...
See also
Creating custom context menu entries for Assets
How to do it...
How it works...
Creating new console commands
Getting ready
How to do it...
How it works...
See also
Creating a new graph pin visualizer for Blueprint
How to do it...
How it works...
Inspecting types with custom Details panels
How to do it...
How it works...
Working with UE4 APIs
Introduction
Technical requirements
Core/Logging API – defining a custom log category
Getting ready
How to do it...
How it works...
There's more...
Core/Logging API – FMessageLog to write messages to the Message Log
Getting ready
How to do it...
How it works...
Core/Math API – rotation using FRotator
Getting ready
How to do it...
Core/Math API – rotation using FQuat
Getting ready
How to do it...
How it works...
There's more...
API – rotation using FRotationMatrix to have one object face another
Getting ready
How to do it...
How it works...
GameplayAbilities API – triggering an actor's gameplay abilities with game controls
Getting ready
How to do it...
How it works...
There's more...
See also
GameplayAbilities API - Implementing stats with UAttributeSet
Getting ready
How to do it...
How it works...
There's more...
GameplayAbilities API – implementing buffs with GameplayEffect
Getting ready
How to do it...
How it works...
There's more...
GameplayTasks API – making things happen with GameplayTasks
Getting ready
How to do it...
How it works...
There's more...
HTTP API – downloading webpages using web requests
Getting ready
How to do it...
How it works...
There's more...
HTTP API – displaying downloaded progress
Getting ready
How to do it...
How it works...
Multiplayer Networking in UE4
Introduction
Technical requirements
Testing your game as a client and a server simultaneously
How to do it...
How it works...
Replicating properties over the network
How to do it...
How it works...
There's more...
Replicating functions over the network
How to do it...
How it works...
See also...
Handling UI network events
Getting ready...
How to do it...
How it works...
See also...
AI for Controlling NPCs
Introduction
Technical requirements
Implementing a simple following behavior
Getting ready
How to do it...
How it works...
Laying down a Navigation Mesh
Getting ready
How to do it...
How it works...
Creating a Blackboard
How to do it...
How it works...
Creating a Behavior Tree
How to do it...
How it works...
Connecting a Behavior Tree to a Character
Getting ready
How to do it...
How it works...
Creating a BTService
Getting ready...
How to do it...
How it works...
Creating a BTTask
Getting ready...
How to do it...
How it works...
User Interfaces - UI and UMG
Introduction
Technical requirements
Drawing using Canvas
Getting ready...
How to do it...
How it works...
See also...
Adding Slate Widgets to the screen
Getting ready
How to do it...
How it works...
Creating screen size-aware scaling for the UI
Getting ready
How to do it...
Using the In-Editor method
Using the Config file method
How it works...
See also
Displaying and hiding a sheet of UMG elements in-game
How to do it...
How it works...
Attaching function calls to Slate events
Getting ready
How to do it...
How it works...
Using Data Binding with Unreal Motion Graphics
How to do it...
How it works...
Controlling widget appearance with Styles
How to do it...
How it works...
Creating a custom SWidget/UWidget
Getting ready
How to do it...
How it works...
Other Books You May Enjoy
Leave a review - let other readers know what you think
- 经济数学-微积分习题解答(安徽财经大学大学数学教学研究中心)
- 中国资本市场:重塑生态链(吴晓求 等)
- 爱情下一秒(沈星妤)
- Emergency Admissions(Kit Wharton)
- 图说天下学生版 超级兵器传奇 世界王牌武器陆海空大阅兵(套装共3册)(试读本)(薛金冉 编著)
- 小红书爆款规律(吕白)
- Gone With the Windsors(Laurie Graham)
