Learning C++ by Creating Games with UE4
eBook - ePub

Learning C++ by Creating Games with UE4

William Sherif

  1. 342 pages
  2. English
  3. ePUB (adapté aux mobiles)
  4. Disponible sur iOS et Android
eBook - ePub

Learning C++ by Creating Games with UE4

William Sherif

DĂ©tails du livre
Aperçu du livre
Table des matiĂšres
Citations

Foire aux questions

Comment puis-je résilier mon abonnement ?
Il vous suffit de vous rendre dans la section compte dans paramĂštres et de cliquer sur « RĂ©silier l’abonnement ». C’est aussi simple que cela ! Une fois que vous aurez rĂ©siliĂ© votre abonnement, il restera actif pour le reste de la pĂ©riode pour laquelle vous avez payĂ©. DĂ©couvrez-en plus ici.
Puis-je / comment puis-je télécharger des livres ?
Pour le moment, tous nos livres en format ePub adaptĂ©s aux mobiles peuvent ĂȘtre tĂ©lĂ©chargĂ©s via l’application. La plupart de nos PDF sont Ă©galement disponibles en tĂ©lĂ©chargement et les autres seront tĂ©lĂ©chargeables trĂšs prochainement. DĂ©couvrez-en plus ici.
Quelle est la différence entre les formules tarifaires ?
Les deux abonnements vous donnent un accĂšs complet Ă  la bibliothĂšque et Ă  toutes les fonctionnalitĂ©s de Perlego. Les seules diffĂ©rences sont les tarifs ainsi que la pĂ©riode d’abonnement : avec l’abonnement annuel, vous Ă©conomiserez environ 30 % par rapport Ă  12 mois d’abonnement mensuel.
Qu’est-ce que Perlego ?
Nous sommes un service d’abonnement Ă  des ouvrages universitaires en ligne, oĂč vous pouvez accĂ©der Ă  toute une bibliothĂšque pour un prix infĂ©rieur Ă  celui d’un seul livre par mois. Avec plus d’un million de livres sur plus de 1 000 sujets, nous avons ce qu’il vous faut ! DĂ©couvrez-en plus ici.
Prenez-vous en charge la synthÚse vocale ?
Recherchez le symbole Écouter sur votre prochain livre pour voir si vous pouvez l’écouter. L’outil Écouter lit le texte Ă  haute voix pour vous, en surlignant le passage qui est en cours de lecture. Vous pouvez le mettre sur pause, l’accĂ©lĂ©rer ou le ralentir. DĂ©couvrez-en plus ici.
Est-ce que Learning C++ by Creating Games with UE4 est un PDF/ePUB en ligne ?
Oui, vous pouvez accĂ©der Ă  Learning C++ by Creating Games with UE4 par William Sherif en format PDF et/ou ePUB ainsi qu’à d’autres livres populaires dans Informatique et Programmation orientĂ©e objet. Nous disposons de plus d’un million d’ouvrages Ă  dĂ©couvrir dans notre catalogue.

Informations

Année
2015
ISBN
9781784396572

Learning C++ by Creating Games with UE4


Table of Contents

Learning C++ by Creating Games with UE4
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What is a game engine anyway?
What will using UE4 cost me?
Why don't I just program my own engine and save the 5 percent?
A game's overview – the Play-Reward-Growth loop
Monetization
Why C++
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Coding with C++
Setting up our project
Using Microsoft Visual C++ on Windows
Using XCode on a Mac
Creating your first C++ program
Semicolons
Handling errors
Warnings
What is building and compiling?
Scripting
Exercise – ASCII art
Summary
2. Variables and Memory
Variables
Declaring variables – touching the silicon
Reading and writing to your reserved spot in memory
Numbers are everything
More on variables
Math in C++
Exercises
Generalized variable syntax
Primitive types
Object types
Exercise – Player
Solution
Pointers
What can pointers do?
Address of operator &
The Null pointers
cin
printf()
Exercise
Solution
Summary
3. If, Else, and Switch
Branching
Controlling the flow of your program
The == operator
Coding if statements
Coding else statements
Testing for inequalities using other comparison operators (>, >=, <, <=, and !=)
Using logical operators
The Not (!) operator
Exercises
Solution
The And (&&) operator
The Or (||) operator
Our first example with Unreal Engine
Exercise
Solution
Branching code in more than two ways
The else if statement
Exercise
Solution
The switch statement
Switch versus if
Exercise
Solution
Summary
4. Looping
The while loop
Infinite loops
Exercises
Solutions
The do/while loop
The for loop
Exercises
Solutions
Looping with Unreal Engine
Summary
5. Functions and Macros
Functions
An example of a <cmath> library function – sqrt()
Writing our own functions
A sample program trace
Exercise
Solution
Functions with arguments
Functions that return values
Exercises
Solutions
Variables, revisited
Global variables
Local variables
The scope of a variable
Static local variables
Const variables
Function prototypes
.h and .cpp files
prototypes.h contains
funcs.cpp contains
main.cpp contains
Extern variables
Macros
Advice – try to use const variables where possible
Macros with arguments
Advice – use inline functions instead of macros with arguments
Summary
6. Objects, Classes, and Inheritance
struct objects
Member functions
The this keyword
Strings are objects?
Invoking a member function
Exercises
Solutions
Privates and encapsulation
Some people like it public
class versus struct
Getters and setters
Getters
Setters
But what's the point of get/set operations?
Constructors and destructors
Class inheritance
Derived classes
Syntax of inheritance
What does inheritance do?
is-a relationship
protected variables
Virtual functions
Purely virtual functions (and abstract classes)
Multiple inheritance
private inheritance
Putting your classes into headers
.h and .cpp
Exercise
Summary
7. Dynamic Memory Allocation
Dynamic memory allocation
The delete keyword
Memory leaks
Regular arrays
The array syntax
Exercise
Solutions
C++ style dynamic size arrays (new[] and delete[])
Dynamic C-style arrays
Summary
8. Actors and Pawns
Actors versus pawns
Creating a world to put your actors in
The UE4 editor
Editor controls
Play mode controls
Adding objects to the scene
Starting from scratch
Adding light sources
Collision volumes
Adding collision detection for the objects editor
Adding an actor to the scene
Creating a player entity
Inheriting from UE4 GameFramework classes
Associating a model with the Avatar class
Downloading free models
Loading the mesh
Creating a blueprint from our C++ class
Writing C++ code that controls the game's character
Making the player an instance of the Avatar class
Setting up controller inputs
Exercise
Solution
Yaw and pitch
Creating non-player character entities
Displaying a quote from each NPC dialog box
Displaying messages on the HUD
Using TArray<Message>
Exercise
Solution
Triggering an event when it is near an NPC
Make the NPC display something to the HUD when something is nearby
Exercises
Solutions
Summary
9. Templates and Commonly Used Containers
Debugging the output in UE4
UE4's TArray<T>
An example that uses TArray<T>
Iterating a TArray
...

Table des matiĂšres

  1. Learning C++ by Creating Games with UE4