Learning C++ by Building Games with Unreal Engine 4
Second Edition
A beginner's guide to learning 3D game development with C++ and UE4
Sharan Volin
BIRMINGHAM - MUMBAI
Learning C++ by Building Games with Unreal Engine 4Second Edition
Copyright 2018 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Commissioning Editor: Kunal Chaudhari
Acquisition Editor: Trusha Shriyan
Content Development Editor: Francis Carneiro
Technical Editor: Surabhi Kulkarni
Copy Editor: Safis Editing
Project Coordinator: Pragati Shukla
Proofreader: Safis Editing
Indexer: Mariammal Chettiyar
Graphics: Alishon Mendonsa
Production Coordinator: Deepika Naik
First published: February 2015
Second edition: December 2018
Production reference: 1261218
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78847-624-9
www.packtpub.com
mapt.io
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
Packt.com
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.packt.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at customercare@packtpub.com for more details.
At www.packt.com , you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Contributors
About the author
Sharan Volin has been programming games for more than a decade. In the past, she worked on AAA and other titles for such companies as Sony Online Entertainment, Electronic Arts (Los Angeles), and 7 Studios (Activision). She primarily specialized in UI Programming. She also taught Game Programming for a year at the Art Institute of California. Sharan has both a BS in Computer Science (Games) and an MS in Computer Science from the University of Southern California, as well as degrees and certificates from other schools. Originally from New York, she lived in Los Angeles until she moved to Montreal, Canada with her 3 cats in early 2018 to work as a System Programmer at Behavior Interactive.
I'd like to thank my mother, Linda Volin, an English teacher, who inspired me to read and write. She really supports me in my game programming career. I'd also thank my brother, the rest of my family, my friends, my cats, and the great community of people I've met in the game industry, who made it worth staying in the field even during rough times.
About the reviewer
Agne Skripkaite is a UE4 software engineer with a particular interest in virtual reality applications. Agne has a BSc physics degree with honors from the University of Edinburgh and became a full-time engineer partway through a physics PhD program at Caltech. Over the last few years, Agne has developed for room-scale and seated VR games as part of teams of various sizes, right from two-engineer teams to large development teams. Agne has also served as a user comfort and motion sickness mitigation expert for seated VR applications.
Packt is searching for authors like you
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Preface
So, you want to program your own games using Unreal Engine 4 (UE4). You have a great number of reasons to do so: UE4 is powerfulUE4 provides some of the most state-of-the-art, beautiful, and realistic lighting and physics effects available, of the kind used by AAA studios.
UE4 is device-agnostic: code written for UE4 will work on Windows desktop machines, Mac desktop machines, all the major game consoles (if you're an official developer), Android devices, and iOS devices (at the time of writing this bookeven more devices may be supported in the future!). So, you can use UE4 to write the main parts of your game once, and after that, deploy to iOS and Android marketplaces without a hitch. (Of course, there will be a few hitches: iOS and Android in-app purchases and notifications will have to be programmed separately, and there could be other differences.)
Who this book is for
This book is for anyone who wants to learn game programming. We'll be going through and creating a simple game, so you will get a good idea of the whole process.
This book is also for anyone who wants to learn C++, particularly C++ 17. We'll be going over the basics of C++ and how to program in it, with an introduction to some of the new features in the latest C++ version.
Finally, the book is for anyone who wants to learn UE4. We'll be using this to create our game. We will be primarily focused on the C++ side, but we will be looking at some basic blueprint development.
What this book covers
, Getting Started with C++ 17 , covers creating your first C++ project in either Visual Studio Community 2017 or Xcode. We'll be creating our first simple C++ program.
, Variables and Memory , covers different types of variables, the basic method of storing data in C++, as well as pointers, namespaces, and basic input and output in a console application.
Next page