100% found this document useful (1 vote)
74 views

Unreal Engine 5 Game Development with C++ Scripting: Become a professional game developer and create fully functional, high-quality games 1st Edition Zhenyu George Li - Experience the full ebook by downloading it now

The document promotes various eBooks available for download on ebookmeta.com, focusing on game development using Unreal Engine 5 and C++. It highlights titles such as 'Unreal Engine 5 Game Development with C++ Scripting' by Zhenyu George Li, along with other recommended digital products related to game development. The document also provides links to access these resources instantly.

Uploaded by

raghodkulyan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
74 views

Unreal Engine 5 Game Development with C++ Scripting: Become a professional game developer and create fully functional, high-quality games 1st Edition Zhenyu George Li - Experience the full ebook by downloading it now

The document promotes various eBooks available for download on ebookmeta.com, focusing on game development using Unreal Engine 5 and C++. It highlights titles such as 'Unreal Engine 5 Game Development with C++ Scripting' by Zhenyu George Li, along with other recommended digital products related to game development. The document also provides links to access these resources instantly.

Uploaded by

raghodkulyan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 79

Read Anytime Anywhere Easy Ebook Downloads at ebookmeta.

com

Unreal Engine 5 Game Development with C++


Scripting: Become a professional game developer
and create fully functional, high-quality games
1st Edition Zhenyu George Li
https://ebookmeta.com/product/unreal-engine-5-game-
development-with-c-scripting-become-a-professional-game-
developer-and-create-fully-functional-high-quality-
games-1st-edition-zhenyu-george-li/

OR CLICK HERE

DOWLOAD EBOOK

Visit and Get More Ebook Downloads Instantly at https://ebookmeta.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Advanced Unity Game Development: Build Professional Games


with Unity, C#, and Visual Studio Victor G Brusca

https://ebookmeta.com/product/advanced-unity-game-development-build-
professional-games-with-unity-c-and-visual-studio-victor-g-brusca/

ebookmeta.com

Game Development with MonoGame: Build a 2D Game Using Your


Own Reusable and Performant Game Engine 1st Edition Louis
Salin
https://ebookmeta.com/product/game-development-with-monogame-
build-a-2d-game-using-your-own-reusable-and-performant-game-
engine-1st-edition-louis-salin/
ebookmeta.com

Blueprints Visual Scripting for Unreal Engine 5: Unleash


the true power of Blueprints to create impressive games
and applications in UE5 3rd Edition Marcos Romero
https://ebookmeta.com/product/blueprints-visual-scripting-for-unreal-
engine-5-unleash-the-true-power-of-blueprints-to-create-impressive-
games-and-applications-in-ue5-3rd-edition-marcos-romero/
ebookmeta.com

Our Living Tradition First Series 1st Edition Claude


Bissell

https://ebookmeta.com/product/our-living-tradition-first-series-1st-
edition-claude-bissell/

ebookmeta.com
Demon Huntress 1st Edition Milly Taiden

https://ebookmeta.com/product/demon-huntress-1st-edition-milly-
taiden-3/

ebookmeta.com

Lonely Planet Colombia 10th Edition Lonely Planet

https://ebookmeta.com/product/lonely-planet-colombia-10th-edition-
lonely-planet/

ebookmeta.com

Leading From the Edge of the Inside: Embracing the Heart


of Business Leadership Jim Moats

https://ebookmeta.com/product/leading-from-the-edge-of-the-inside-
embracing-the-heart-of-business-leadership-jim-moats/

ebookmeta.com

Haxe Game Development Essentials 1st Edition Jeremy


Mccurdy

https://ebookmeta.com/product/haxe-game-development-essentials-1st-
edition-jeremy-mccurdy/

ebookmeta.com

Colorado Cold Case 1st Edition Elle James

https://ebookmeta.com/product/colorado-cold-case-1st-edition-elle-
james/

ebookmeta.com
Complete Calisthenics 2nd Edition The Ultimate Guide to
Bodyweight Exercise Ashley Kalym

https://ebookmeta.com/product/complete-calisthenics-2nd-edition-the-
ultimate-guide-to-bodyweight-exercise-ashley-kalym/

ebookmeta.com
Unreal Engine 5
Game Development
with C++ Scripting

Become a professional game developer


and create fully functional, high-quality games

Zhenyu George Li

BIRMINGHAM—MUMBAI
Unreal Engine 5 Game Development with C++ Scripting
Copyright © 2023 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.

Group Product Manager: Rohit Rajkumar


Publishing Product Manager: Vaideeshwari Muralikrishnan
Senior Editor: Hayden Edwards
Technical Editor: Simran Udasi
Copy Editor: Safis Editing
Project Coordinator: Aishwarya Mohan
Proofreader: Safis Editing
Indexer: Manju Arasan
Production Designer: Ponraj Dhandapani
Marketing Coordinators: Namita Velgekar & Nivedita Pandey

First published: August 2023


Production reference: 1110823

Published by Packt Publishing Ltd.


Grosvenor House
11 St Paul’s Square
Birmingham
B3 1R

ISBN 978-1-80461-393-1

www.packtpub.com
Foreword
I have known and worked with George Li in various capacities for more than 20 years.
We met first as colleagues at a private college of interactive arts in downtown Vancouver, Canada. I
was a full professor of linguistics at a university in the area, with extensive experience in developing
a cognitive science program at the university. Establishing a curriculum for such a program involved
familiarizing myself with areas well beyond the area of my specific academic position and collaborating
closely with colleagues – particularly in computing science (cognitive), psychology, and philosophy
(particularly concerning socio-epistemological issues such as AI). It was in this spirit that I was happy
to associate myself with a private college, focusing on language study and teaching, together with
preparing students to handle 3D computer applications (e.g., 3ds Max, 3D GameStudio, and Unreal)
and showing them how to generate animation materials for film, TV, and games.
George Li was in charge of all the technical requirements of the college. I very quickly realized that he
was not merely extremely competent and forthcoming (he had already occupied high-level computing-
related positions, software engineering for instance, in China prior to emigrating to Canada) but
also computationally competent and brilliantly innovative. He also had a particular interest in the
development of game engines and was already collaborating with his colleague, Charles Yeh, on a
practical reference book, XNA PC & Xbox360 C# Game Programming, with proprietary-produced
text and games to his credit.
As colleagues in the college, George and I found common, mutually strengthening interests. Eventually,
he and I found ourselves in charge of creating a two-year interactive-arts program curriculum for
the college.
My whole career, at universities in the UK and Canada, and as a member of the editorial boards of
a major academic journal and a very influential series, has closely involved the evaluation of the
intellectual quality of people’s capabilities and work, and in my opinion, George Li’s innate talents
shine out clearly throughout his work and will continue to do so in the future. His ability to express
his knowledge of the subject at hand is outstandingly demonstrated in all his work, performance,
expressions, and character.
This book, like the one co-authored with Yeh, is designed for independent developers and company
training, plus for reference after post-secondary education. The knowledge presented herein is most
intelligently, clearly, and effectively presented so as to be as efficiently applicable and pedagogically
effective as possible on any device or platform, producing high-quality games, accessories, and edits.
This volume will certainly stand the test of time and fulfill the majority of the needs of those working
in the field of gaming. However, I am certain that George will make further, very crucial contributions
to this topic.
Until then, this volume will serve you excellently, helping you enjoy and prosper with your future
activities and products.

Dr. E. Wyn Roberts (M.A. Ph.D (Cantab.))


Emeritus Professor of Linguistics, Simon Fraser University
Contributors

About the author


Zhenyu George Li is a passionate video game developer with over 20 years of experience in the field.
As a seasoned software engineer, George has contributed significantly to the development of numerous
games throughout his career and currently serves as a senior development consultant at Unity.
George’s fascination with video games was sparked during his college studies, igniting a passion that
would shape his professional journey. During the early stages of his game development endeavors,
George immersed himself in technologies such as Visual Basic, C/C++, DirectX, OpenGL, and Windows
GUI. These foundational experiences laid the groundwork for his subsequent success in the industry.
Throughout his career, George has made substantial contributions to various commercial games.
Notable titles in his portfolio include Halo Infinite, Magic: The Gathering Arena, Stela, Dead Rising 2,
The Bigs 2, and so on. His involvement in these projects has allowed him to gain extensive knowledge
and practical experience in a wide range of domains, including programming, game engines, gameplay
and AI, graphics, animation, multiplayer games, multiplayform games, and game physics. In practical
applications, George has used both the Unreal and Unity engines in the development of real game projects.
In addition to his achievements as a game developer, George has also honed his teaching abilities during
his eight years of college-level instruction. He has shared his knowledge and expertise with aspiring
developers, serving as a lecturer at the Vancouver Film School (VFS), the College of Interactive Arts,
and Hefei Union University. During his teaching at VFS, George instructed students in the intricacies
of Unreal Engine.

I express my gratitude to my wife, Alison Guo, for her support in handling family responsibilities and
for enabling me to dedicate time to completing this book. I also extend my thanks to Sarah Beck and
Willy Campos for their encouragement and support throughout the writing process.
About the reviewers
Aditya Dutta holds a game programming advanced diploma from Humber College and is a highly
accomplished senior software engineer at Archiact Interactive, bringing expertise in Unreal Engine
and C++ system design and implementation.
With a strong collaborative spirit, Aditya leads feature development and takes ownership of tools
while actively improving team processes. These leadership skills were evident during his tenure
as lead programmer at Humber College, where he successfully guided and mentored a team of
programmers, overseeing the technical aspects of significant projects in the virtual production and
architecture industries.
His contributions at UP360 Inc. as a programmer included shipping numerous training VR simulations,
developing iterative tools, and implementing gameplay mechanics using Unreal Engine.

Michael Oakes is a senior software consultant for Unity and has over 27 years of experience in the
IT industry. He has worked with real-time 3D and games for over eight years, specializing in mixed
reality design and development, shader programming, and AI and multiplayer systems.
He has worked as a technical consultant on other titles, including Packt Publishing’s Learn ML-Agents
– Fundamentals of Unity Machine Learning, written by Micheal Lanham.
Table of Contents
Part 1 – Getting Started with Unreal C++
Scripting
1
Creating Your First Unreal C++ Game 3
Technical requirements 3 Ensuring your UE has the source code installed 9
Understanding C++ scripting in Unreal 4 Launching the UE5 editor through the Epic
Games Launcher 10
What is the difference between C++ and
Creating the MyShooter C++ project 10
Blueprint?4
Associating VS with UE5 as the default source
When do you use C++? 5
code editor 12
What is the difference between C++
Opening the C++ source code in VS (optional) 13
programming and C++ scripting? 5

Creating your C++ Shooter project Converting an existing Blueprint


from a template 6 project to a C++ project 15
Installing Visual Studio 2022 6 Summary20

2
Editing C++ Code in Visual Studio 21
Technical requirements 21 Solution Explorer 26
Launching VS 22 Output window 27
Error List window 28
Walking through the VS IDE’s UI 24
Code editor 25 Editing code in VS 29
Menus26 Controlling the caret (input cursor) 30
Search box 26 The text editing keys 30
Toolbar26 Code selection 30
viii Table of Contents

IntelliSense31 Creating the main.cpp file 35


Useful editing hotkeys 31 Changing the editor theme 37
Writing the initial code for main.cpp 38
Practicing C++ coding 32
Adding the Calculator class 40
Creating a new C++ solution in VS 33
Summary42

3
Learning C++ and Object-Oriented Programming 43
Technical requirements 44 Working on the improved calculator
What is C++? 44 program66
Exploring the C++ program structure 45 Creating references and pointers 72
Defining C++ functions 46 References73
Pointers74
Defining functions with or without parameters 47
Calling functions 47 Understanding OOP 74
Writing the main() function 47 What is OOP? 75
Working with a basic calculator What are classes and objects? 75
program48 Creating classes in C++ 76
Creating objects in C++ 77
Learning the C++ syntax 49
Using the C++ data types 50 Working on an OOP calculator
Defining variables 51 program78
Using C++ arrays 52 Adding constructor and getter functions for
Using C++ operators 53 the calculator class 83
Accepting user input 57 Creating the CalculatorEx class, which
Adding C++ comments 57 inherits from the Calculator class 84
Controlling the C++ flow 58 Summary88

4
Investigating the Shooter Game’s Generated Project and C++ Code 89
Technical requirements 89 Getting familiar with the source code 95
Understanding the MyShooter C++ MyShooterCharacter.h95
project structure 90 MyShooterCharacter.cpp100
Understanding the game program MyShooterProjectile.h and
structure92 MyShooterProjectile.cpp103
Table of Contents ix

TP_PickUpComponent.h and TP_ MyShooter.Build.cs, MyShooter.Target.cs,


PickUpComponent.cpp106 and MyShooterEditor.target.cs 111
TP_WeaponComponent.h and TP_
Launching Unreal Editor and
WeaponComponent.cpp108
opening the game project in Visual
MyShooter.h and MyShooter.cpp 110
Studio112
MyShooterGameMode.h and
MyShooterGameMode.cpp110 Summary114

Part 2 – C++ Scripting for Unreal Engine


5
Learning How to Use UE Gameplay Framework Base Classes 117
Technical requirements 118 Defining private properties for these two
components136
Creating a Pangaea top-down game
project118 Adding public getter functions to the
components137
Understanding the gameplay Creating components in the class constructor 138
framework base classes 119
Creating game actor classes 120 Creating blueprints from the new
actor classes 138
Creating the ADefenseTower class 120
Creating the AProjectile class 125 Learning about the Unreal gameplay
Creating the APlayerAvatar class 125 framework classes 142
Locating and creating gameplay framework
Recompiling C++ projects 127 classes in Pangaea 142
Using the UPROPERTY macro 128 Learning about the PlayerController class 143
The UPROPERTY syntax 129 Learning about the GameModeBase class 144
The UPROPERTY specifiers and metadata keys130 GameState144
Marking the ADefenseTower, AProjectile, GameInstance144
and APlayerAvatar attributes as UE properties 130 Retrieving class instances from your code 145

Using the UFUNCTION macro 132 Using the Cast template function 145
The UFUNCTION syntax 132 Summary147
UFUNCTION specifiers and metadata keys 132
Tagging ADefenseTower and APlayerAvatar
member functions as UFUNCTION macros 133

Adding components to the new actors136


Including component header files 136
x Table of Contents

6
Creating Game Actors 149
Technical requirements 149 Replacing the game’s player pawn 160
Setting up the player avatar 150 Creating the player avatar’s
Adding SpringArmComponent and animation blueprint 162
CameraComponent to PlayerAvatar 150 Creating the PlayerAvatarAnimInstance class 163
Initializing the player avatar 154 Creating the ABP_PlayerAvatar blueprint 169
Setting up the character’s Creating the State Machine on ABP_
SkeletalMeshComponent155 PlayerAvatar171
Syncing the movement speed with the
Importing the character model 155
animation instance 174
Using the Hero skeletal mesh in BP_
PlayerAvatar160 Summary176

7
Controlling Characters 179
Technical requirements 180 Implementing the OnStateAnimationEnds
function186
Controlling the player character to
attack180 Destroying actors 187
Adding the Attack action to the action map 180 Creating the enemy character 189
Binding the handler function to the Attack Creating the Enemy class 190
action181
Creating the EnemyController class 195
Implementing the OnAttackPressed() action
Creating the ABP_Enemy animation blueprint 200
handler function 182
Creating the BP_Enemy blueprint 201
Implementing the CanAttack() and Attack()
functions182 Testing the game 203
Processing non-loop animations 184 Summary204

8
Handling Collisions 205
Technical requirements 205 Using collisions for game interactions213
Understanding collision detection 206 Downloading and creating the weapon,
defense tower, and fireball actors 214
Setting the collision presets 210
Table of Contents xi

Picking up weapons 218 target is hit 230


Spawning a weapon for the enemy 224 Processing a defense tower hit 234
Defense tower firing fireballs 225
Summary236
Moving the fireball and checking whether the

9
Improving C++ Code Quality 239
Technical requirements 239 Creating a fireball pool 256
Refactoring code 240 Outputting debug messages 263
Combining the PlayerAvatarAnimInstance Using the UE_LOG macro 264
and EnemyAnimInstance classes 240 Printing debug messages to the screen 265
Making PangaeaCharacter the parent class of
APlayerAvatar and AEnemy 243 Checking an Actor instance’s actual
class type 266
Refining code 255
Summary269
Using caching variables 255

Part 3 – Making a Complete Multiplayer Game


10
Making Pangaea a Network Multiplayer Game 273
Technical requirements 273 replications282
Comparing single-player and Updating the character health bar with
multiplayer games 274 RepNotify284
Processing hits on the server 290
Launching the multiplayer Pangaea
Spawning fireballs on the server side 291
game in the editor 275
Understanding multiplayer game Summary293
network modes 277
Handling network synchronizations 278
Notifying player attacks with RPCs 278
Syncing actor variables to clients with
xii Table of Contents

11
Controlling the Game Flow 295
Technical requirements 295 Adding the Timer variable to the
APangaeaGameState class 313
Designing the Pangaea game’s flow 296
Making the Timer variable replicable 314
Creating the UI widgets 297
Defining OnTimeChangedDelegate 314
Creating BP_LobbyWidget 298
Creating and binding the custom event to
Creating BP_HUDWidget 301 OnTimeChangedDelegate315
Creating BP_GameOverWidget 303 Counting down the timer 317
Adding networking functions to Designating APangaeaGameState as the
PangaeaGameInstance306 project’s game state class 319

Adding UI widgets to game levels 310 Destroying a base defense tower to


Adding the game timer 312 win the game 320
Summary326

12
Polishing and Packaging the Game 327
Technical requirements 327 Packaging the game 338
Polishing the game 328 Configuring the project settings for packaging 338
Importing and using high-quality game assets 328 Making the build a windowed game 340
Fixing bugs 331 Avoiding the hardcoded path for finding
Profiling and optimization 331 content341
Packaging the project 344
Using Unreal Engine console
commands332 What to do next 347
Exploring modes and console commands 332 Summary348
Executing console commands in C++ 336

Index349

Other Books You May Enjoy 360


Preface
Welcome, and thank you for choosing to pick up the Unreal Engine 5 Game Development with C++
Scripting book! This comprehensive book is designed to assist game developers and students in
advancing their professional skills in C++ programming for Unreal Engine game development.
Unreal Engine is a powerful and versatile game engine widely used in both the gaming and movie-
making industries. Possessing advanced and professional Unreal Engine development skills enables
individuals to adapt more effectively to the demands of a career in game development, opening a
multitude of opportunities for them.
When developing with Unreal Engine, you have the option to use either one or both of two available
programming tools:

• Blueprint provides a user-friendly interface suitable for non-programmer developers


• C++ is predominantly employed by software engineers, providing a more robust and flexible
approach to game development

As an Unreal Engine developer, you may have a genuine interest in understanding C++ and how it
integrates with the engine, even if you don’t identify as a software engineer or aspire to become one.
This book is designed to assist you in expanding your knowledge and skills by guiding you through
the necessary steps to create a fully fledged game, covering essential aspects of game development. It
aims to smoothen the learning curve, allowing for a more seamless and efficient grasp of the concepts
presented. The carefully organized topics eliminate the need for random searching and prevent wasted
time on unrelated readings, enabling you to focus on the relevant information. Moreover, this book
serves as a valuable reference manual, offering a comprehensive resource that can be revisited and
utilized for further study.

Who this book is for


It is important to note that this book does not serve as a beginner’s guide to using Unreal Engine. Prior
to exploring its contents, you should already possess a basic understanding of, and practical experience
with, Unreal Engine and Blueprint. This prerequisite ensures that you have a solid foundation of
knowledge to fully leverage the material covered in this book, maximizing your learning experience.
xiv Preface

This book caters to a diverse range of readers:

• Non-engineer game developers, such as game designers and artists who aspire to learn and
comprehend C++ in the context of Unreal Engine development
• Software engineers who may lack prior experience in Unreal Engine C++ programming but
wish to quickly acquire the necessary skills for their next project or job
• Students who are interested in learning and digging into Unreal C++ programming for their
study or personal projects
• Individuals with a keen interest in game development using Unreal Engine will benefit from
the comprehensive knowledge presented within these pages

What this book covers


Chapter 1, Creating Your First Unreal C++ Game, guides you quickly through creating a new C++
game project based on the Shooter template in Unreal. This chapter also introduces how to convert
an existing Blueprint game project into a C++ game project.
Chapter 2, Editing C++ Code in Visual Studio, provides basic information on how to use the powerful
integrated development environment Microsoft Visual Studio to edit C++ code. This chapter not only
presents the editing skills needed but also demonstrates how to create a calculator application in C++.
Chapter 3, Learning C++ and Object-Oriented Programming, goes deeper into C++ programming based
on the previous chapter’s calculator project. This chapter covers the fundamental C++ syntax, data
types, flow control, and so on. C++ object-oriented programming is also introduced in this chapter.
Chapter 4, Investigating the Shooter Game’s Generated Project and C++ Code, explores the details of
the generated shooter game project, including the project files’ structure and the source files. In this
chapter, the C++ code lines are briefly explained, so that you gain an overall understanding of how
C++ code works.
Chapter 5, Learning How to Use the UE Gameplay Framework Base Classes, instructs you on how to
create our new top-down game project, Pangaea. You will be guided on how to create the game actors,
DefenseTower, for instance, and the game character, PlayerAvatar classes, for instance, as
well as defining actor properties and functions in C++.
Chapter 6, Creating Game Actors, provides steps to write code and set up the main character for the
Pangaea game. It includes setting up the character, creating the animation instance, defining the state
machine, and synchronizing the animations.
Chapter 7, Controlling Characters, provides methods of controlling game characters. This includes
configuring the input map, handling player input, and effectively processing the reactions of the
player character. Additionally, you will be introduced to the AI controller and the navigation system
for controlling non-player characters.
Preface xv

Chapter 8, Handling Collisions, discusses the engine’s collision system and its configurations for game
interactions. To handle collision events – attack hits and projectile hits, for example – you will learn
how to configure actor colliders and triggers. Using ray casts to check whether a projectile hits the
target is also introduced in this chapter.
Chapter 9, Improving C++ Code Quality, presents how to employ software engineering practices during
code refactoring and refinement. This chapter implements class generalization, caching, and pooling
methods to improve the game code’s quality and performance.
Chapter 10, Making Pangaea a Network Multiplayer Game, starts by introducing the fundamental
concepts related to multiplayer games, including servers, clients, and multiplayer modes. You will
be guided step by step through converting the single-player Pangaea game into a multiplayer game.
Chapter 11, Controlling the Game Flow, intends to make Pangaea a complete multiplayer game, which
has a main menu as the lobby, so that players can decide whether they want to start a host or join
a game session. C++ and Blueprint scripting skills for user interface operations are also revealed in
this chapter.
Chapter 12, Polishing and Packaging the Game, provides resources, methods, and suggestions on how to
polish games from both visual experience and product quality aspects. This chapter also provides steps
for configuring and packaging the Pangaea project to be an executable standalone game for distribution.

To get the most out of this book


You will need to have knowledge and experience in using Unreal Engine. Basic Blueprint scripting
knowledge is also required prior to reading this book.

Software/hardware covered in the book Operating system requirements


Unreal Engine 5.0 and up Microsoft Windows 10 and up
Microsoft Visual Studio 2002 with the C++ compiler

If you conduct experiments with the samples on systems other than Microsoft Windows, such as
macOS, please keep in mind that there may be user interface and configuration differences that may
not be addressed in this book.
If you are using the digital version of this book, we advise you to type the code yourself or access
the code from the book’s GitHub repository (a link is available in the next section). Doing so will
help you avoid any potential errors related to the copying and pasting of code.

Download the example code files


You can download the example code files for this book from GitHub at https://github.com/
PacktPublishing/Unreal-Engine-5-Game-Development-with-C-Scripting.
If there’s an update to the code, it will be updated in the GitHub repository.
xvi Preface

We also have other code bundles from our rich catalog of books and videos available at https://
github.com/PacktPublishing/. Check them out!

Conventions used
There are a number of text conventions used throughout this book.
Code in text: Indicates code words in text, database table names, folder names, filenames,
file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example:
"The AProjectile class can be inherited as child classes for creating various fireable objects, such as
AFireBall, AMissile, ABomb, and so on."
A block of code is set as follows:

#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "DefenseTower.generated.h

When we wish to draw your attention to a particular part of a code block, the relevant lines or items
are set in bold:

void APangaeaCharacter::BeginPlay()
{

_AnimInstance = Cast<UPangaeaAnimInstance>(
GetMesh()->GetAnimInstance());

}

Any command-line input or output is written as follows:

$ mkdir css
$ cd css

Bold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in
menus or dialog boxes appear in bold. Here is an example: "In the Unreal Project Browser window,
choose the GAMES tab on the left side. Then select the First Person template."

Tips or important notes


Appear like this.
Preface xvii

Additionally, the C++ sample code provided in this book adheres primarily to Unreal Engine’s coding
standard, ensuring consistency and minimizing confusion for readers. For detailed information, you
can visit the official Code Standard website here: https://docs.unrealengine.com/5.0/
en-US/epic-cplusplus-coding-standard-for-unreal-engine/.
Exceptions may occur when using compact expressions that are clear and easily understood, allowing the
text to fit within the constraints of the page printing layout without compromising reader comprehension.
For example, the following line of code follows the code standard by explicitly declaring the type of
the assigned GameInst variable:

UPlayerAvatarAnimationInstance* GameInst = Cast


  <UPlayerAvatarAnimationInstance>(GetMesh()->GetAnimInstance())

The following modified version is used instead:

auto GameInst = Cast<UPlayerAvatarAnimationInstance>(


  GetMesh()->GetAnimInstance())

Get in touch
Feedback from our readers is always welcome.
General feedback: If you have questions about any aspect of this book, email us at
[email protected] and mention the book title in the subject of your
message.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen.
If you have found a mistake in this book, we would be grateful if you would report this to us. Please
visit www.packtpub.com/support/errata and fill in the form.
Piracy: If you come across any illegal copies of our works in any form on the internet, we would
be grateful if you would provide us with the location address or website name. Please contact us at
[email protected] with a link to the material.
If you are interested in becoming an author: If there is a topic that you have expertise in and you
are interested in either writing or contributing to a book, please visit authors.packtpub.com.
xviii

Share Your Thoughts


Once you’ve read Unreal Engine 5 Game Development with C++ Scripting, we’d love to hear your thoughts!
Please click here to go straight to the Amazon review page for this book and share your feedback.
Your review is important to us and the tech community and will help us make sure we’re delivering
excellent quality content.
xix

Download a free PDF copy of this book


Thanks for purchasing this book!
Do you like to read on the go but are unable to carry your print books everywhere?
Is your eBook purchase not compatible with the device of your choice?
Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.
Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical
books directly into your application.
The perks don’t stop there, you can get exclusive access to discounts, newsletters, and great free content
in your inbox daily
Follow these simple steps to get the benefits:

1. Scan the QR code or visit the link below

https://packt.link/free-ebook/9781804613931

2. Submit your proof of purchase


3. That’s it! We’ll send your free PDF and other benefits to your email directly
Part 1 –
Getting Started with
Unreal C++ Scripting

In this part, the primary focus will be on providing an introduction to the basics of C++ programming,
specifically for game development with Unreal Engine. You will gain knowledge on creating a C++
game project in Unreal, as well as utilizing MS Visual Studio to access and modify the game’s source
code. Moreover, essential concepts of C++ and object-oriented programming, along with their syntax,
will be introduced. Building upon this foundation, we will examine the generated source code to
conduct an initial investigation into the game project.
This part contains the following chapters:

• Chapter 1, Creating Your First Unreal C++ Game


• Chapter 2, Editing C++ Code in Visual Studio
• Chapter 3, Learning C++ and Object-Oriented Programming
• Chapter 4, Investigating the Shooter Game’s Generated Project and C++ Code
1
Creating Your First Unreal
C++ Game
Unreal Engine (UE) is one of the most popular 3D computer graphics game engines developed by Epic
Games, providing a comprehensive set of tools and functionalities to develop high-quality, immersive
3D simulations. The engine offers its intuitive visual scripting system, Blueprint, and a robust C++
programming framework for developers of all skill levels. This book provides a concise introduction
to C++ programming and demonstrates how to write C++ scripts in UE for game development.
In this chapter, you will learn the essential skill of creating an Unreal C++ project from scratch
or converting an existing Unreal Blueprint project into an Unreal C++ project, which serves as a
fundamental skill to advance in game development. By mastering this process, you will gain the
necessary foundation to take your game development abilities to the next level.
This chapter will cover the following topics:

• Understanding C++ scripting in Unreal


• Creating your C++ shooter project from a template
• Converting an existing Blueprint project to a C++ project

Technical requirements
As a reader of this book, you will be expected to have common computer operational skills. You
should also have basic knowledge of and experience with the UE5 editor, as well as some Blueprint
scripting skills.
To follow this chapter, you should have installed Epic Games Hub and the 5.03 or later version of
the engine editor on your computer. If you haven’t done so, please go to the official Epic website
(https://www.unrealengine.com/en-US) to register an account and download the Epic
Games Launcher.
4 Creating Your First Unreal C++ Game

The minimum required development environment is as follows:

• Operating system: Windows 10


• Processor: Intel 7th generation or equivalent
• Memory: 16 GB of RAM
• GPU: GTX 1080 (or AMD equivalent)
• DirectX: Version 12
• Storage: 25 GB of available space
• Additional notes: 8 GB of VRAM recommended

The official system requirements can be found here: https://docs.unrealengine.com/5.0/


en-US/hardware-and-software-specifications-for-unreal-engine/. To save
game editing time in the UE5 editor, it is recommended to use a computer with an i9 (or an AMD
equivalent) CPU, 64 GB of RAM, and a GeForce RTX 3060 video card.

Understanding C++ scripting in Unreal


Before getting started, we need to answer some questions that people usually ask about C++ scripting.
This will help to clarify the pros and cons of using C++, the reasons to use C++, and the difference
between UE C++ scripting and C++ programming.

What is the difference between C++ and Blueprint?


Both C++ and Blueprint are scripting languages that can accomplish the same tasks, but one might be
better suited than the other under certain circumstances. The main difference between them is that
C++ is a programming language that allows you to write general-purpose, text-based code, whereas
Blueprint is a visual scripting system for UE.
For UE projects, game studios usually use both C++ and Blueprint to develop commercial-level games.
C++ is usually used for advanced techniques, complex algorithms, and big-scale logic code. If you
can script with C++, you will have more chances to work on a professional team.
One of the most important advantages of using C++ is performance. C++ allows you to write low-level
operational code. It also provides control over the core system that is not accessible to Blueprint.
In addition, the final C++ code will eventually be optimized and compiled to be machine-friendly
binary native code. On the other hand, Blueprint scripts are interpreted and executed by a middle
layer, which means more execution time.
Understanding C++ scripting in Unreal 5

C++ code and files can be well-organized based on an entire project’s mechanics. It is easy to globally
search, locate, and access code blocks to edit, maintain, and troubleshoot. In the meantime, it is also
easier to read and understand a big chunk of code that implements complex algorithms and logic.
Blueprint, on the other hand, is a context-sensitive scripting environment. Blueprint graphs are
relatively independent. When a graph needs to solve complex logic, the nodes and the connection
lines create messy spaghetti that can hardly be understood and maintained.
C++ also has some shortcomings. One example is that it may cause critical errors that may crash an
entire system. That is usually caused by the developer’s mistakes. Since Blueprint is a protected layer,
it is safer, and hence, the chances of the system crashing are fewer.
In conclusion, the choice between C++ and Blueprint should be made based on specific development
requirements and conditions, considering the pros and cons of each approach.

When do you use C++?


Both C++ and Blueprint can handle game development processes without a problem. There is no
exact rule that regulates when to use C++ or Blueprint. It mainly depends on your experience and the
actual needs of different games. You make your own decision based on how much you know about
the two scripting systems.
Before you start working on something, you can ask yourself this question: “Where does it make sense
to use C++, and where does it make sense to use Blueprints?” We recommend basing your answer on
the following aspects and trade-offs:

• Performance
• Logic and algorithm complexity
• Accessibility to a system’s core functions
• The developer’s experience

If you want higher performance and deal with advanced game logic and system processes, and you
are capable of coding and solving complex problems, you should go for C++.

What is the difference between C++ programming and C++


scripting?
You may be confused about the difference between C++ programming and C++ scripting. We want
to clarify the meanings of these two terms.
6 Creating Your First Unreal C++ Game

C++ programming means using the C++ programming language to write code for any purpose; it
doesn’t have to be just for UE projects. C++ scripting, in this book, is a specific dialect of the C++
programming language supported by the UE. It takes advantage of the power of C++ syntax and also
works with UE’s Application Programming Interfaces (APIs), which allow developers to create and
extend the engine’s functionalities for their games and the development environment’s context, such
as objects, graphics, audio, and network communication.
Now that we have a basic overview of C++ and have learned why and when to use C++ for Unreal
game developments, let’s dive deeper into C++ scripting by creating a sample project.

Creating your C++ Shooter project from a template


Now, it’s the time to get your hands dirty working on a UE5 C++ project yourself. We will go through
the steps to create a new C++ project from scratch based on the First Person template.
The First Person template is one of the default game templates that come with UE. When you want
to create a new project, you can pick this template from the Unreal Project Browser window. Our
new MyShooter game will derive all the features from the template game, and we don’t have to do any
additional work.
To get started with C++ scripting, we first need to install an IDE. In this book, we will use MS Visual
Studio 2022 as an example.

Installing Visual Studio 2022


Visual Studio (VS) is an Integrated Development Environment (IDE) from Microsoft. It is a tool used
to create, edit, debug, and compile code. In order to do C++ scripting, you need to go to the official
website at https://visualstudio.microsoft.com/vs/ and download the Community
2022 version installation package (see Figure 1.1).
Creating your C++ Shooter project from a template 7

Figure 1.1 – Downloading VS 2022

Note
To install VS, a Microsoft account is typically required. If you don’t have a Microsoft account, you
can register using the following page: https://account.microsoft.com/account/.

Next, launch VisualStudioSetup.exe inside the folder where you downloaded the VS installer
(the \Downloads folder, for example).
Enable the two Game development with C++ and Desktop development with C++ checkboxes –
these two options tell the installer to install the C++ compiler and the professional game development
support for UE (see Figure 1.2).
8 Creating Your First Unreal C++ Game

Figure 1.2 – Picking workloads for the VS installation

Also, keep an eye on the following options on the Installation details panel that belongs to the Desktop
development with C++ group, and make sure the following are checked:

• C++ profiling tools


• C++ AddressSanitizer
• Windows 10 SDK
• IntelliCode
• IDE support for Unreal Engine

Then, click the Install button to install the workloads and reboot the system, and then you will see a
prompt from the dialog popup (see Figure 1.3):

Figure 1.3 – The VS Done installing dialog box


Creating your C++ Shooter project from a template 9

The next thing we need to do is to confirm that we have installed the engine source code together
with the UE5 editor. The reason why we need this is that when we generate a new project, the engine
source code can be integrated into the new project; under certain circumstances, we may need to
modify or customize the engine for the game’s specific needs.

Ensuring your UE has the source code installed


Before launching the UE5 editor, we first need to check whether Engine Source is installed for the
editor. By doing this check, we make sure that the UE5 source code is integrated with the C++ projects
we are going to create.
The three steps to check or install the engine source code are as follows:

1. Click the downward arrow button and choose Options from the drop-down menu.
2. Make sure that the Engine Source option is checked.
3. Press the Apply button:

Figure 1.4 – The UE5 Options menu

UE is an ongoing development product, with bugs and defects that may need to be fixed by its users.
Also, professional developers sometimes modify the engine source code to adapt to their specific
needs. An example of this is when we face an issue with geometry instancing (or instanced rendering)
working only in the game’s development build but not in the release build, which is subsequently
resolved by our engineer modifying the engine’s source code.
10 Creating Your First Unreal C++ Game

Note
Geometry instancing is a rendering technique that renders multiple instances of a visual object
in a single draw call and provides each instance with some unique attributes: https://
en.wikipedia.org/wiki/Geometry_instancing.

We are now ready to start the UE editor through the Epic Games Launcher.

Launching the UE5 editor through the Epic Games Launcher


Launching the UE5 editor is pretty straightforward. You simply click the Launch button on the 5.03
engine card to start the editor (see Figure 1.5).

Figure 1.5 – Launching the UE5 editor from the Epic Games Launcher

The next thing we want to do is to create a new game project. Let’s name the new project MyShooter.

Creating the MyShooter C++ project


To create the project, follow these steps (and see Figure 1.6 for reference):

1. In the Unreal Project Browser window, choose the GAMES tab on the left side.
2. Select the First Person template.
3. Select the C++ button.
Creating your C++ Shooter project from a template 11

4. Choose the project location (for example, C:\UEProjects) and type MyShooter in the
Project Name field.
5. Click the Create button.

Figure 1.6 – Creating the MyShooter project

The created game project also includes the starter content, which is packaged with assets and resources
that can be used to prototype the game.
The engine will do some initialization work and then open the editor when things are ready. If you
look at the project tree panel’s MyShooter tab in the bottom-left corner of the editor window, you
should see the C++ Classes node on the same layer as the Content node (see Figure 1.7).
12 Creating Your First Unreal C++ Game

Figure 1.7 – The MyShooter C++ project opened in the UE5 editor

Associating VS with UE5 as the default source code editor


Since we created the C++, project, all the C++ source code for the game was already generated. To open
the source files directly in the UE5 editor, we want to associate VS as the engine editor’s default IDE.
On the UE5 Editor’s main menu, select Edit | Editor Preferences to open the preference window, then
find the General | Source Code item on the left panel, and finally, pick Visual Studio 2022 from the
Source Code Editor dropdown (see Figure 1.8).
Creating your C++ Shooter project from a template 13

Figure 1.8 – Making VS the default source code editor

You can now use VS to open the source code files.

Opening the C++ source code in VS (optional)


If you want to open and view the C++ source code in VS, you can find the source code file (for example,
C++/MyShooter/MyShooterCharacter.cpp) in the project and simply double-click on it
(see Figure 1.9).

Figure 1.9 – Opening MyShooterCharacter.cpp source code in VS

The system will automatically launch VS, and the VS editor will open the MyShooterCharacter.
cpp file (see Figure 1.10).
14 Creating Your First Unreal C++ Game

Figure 1.10 – Viewing the MyShooterCharacter.cpp source code in VS

Back in the Unreal editor, click the Play ( ) button to start the game. While playing the game on the battlefield,
you can control your character, move them around, and pick up the gun in front of them (see Figure 1.11).

Figure 1.11 – Playing the MyShooter game


Converting an existing Blueprint project to a C++ project 15

We have learned how to create a UE C++ project from scratch. However, what if we already have a
Blueprint project and want to convert it to a C++ project? UE allows developers to do it by adding a
new C++ class to the project. Let’s practice converting a MyBPShooter Blueprint project.

Converting an existing Blueprint project to a C++ project


UE provides a very straightforward way to convert an existing Blueprint project to a C++ project.
All you need to do is add a C++ class to your project and then let UE take care of the conversion and
add the needed project files:

1. First of all, you have to create a Blueprint project, MyBPShoopter, under C:\UEProjects
(you can choose a different path to create the new project). Use the same steps introduced in
the Creating the MyShooter C++ project section, but choose BLUEPRINT instead of C++ for
the creation of the MyBPShooter project.

Figure 1.12 – Creating MyBPShooter in UE5


16 Creating Your First Unreal C++ Game

2. Secondly, open the new project in UE5. Pay attention to the project tree; it doesn’t have the
C++ Classes node at this stage.

Figure 1.13 – Open MyBPShooter in UE5

3. Select Tools | New C++ Class from the editor’s main menu, and then, in the Add C++ Class window
(see Figure 1.14), choose Character as the base class (a class that contains common attributes
and methods that are shared by its derived classes) to create the MyShooterCharacter class.
Converting an existing Blueprint project to a C++ project 17

Figure 1.14 – Adding a new C++ class from the Character class

Once you click the Next> button, it will navigate to the NAME YOUR NEW CHARACTER screen.
4. On the NAME YOUR NEW CHARACTER screen, type MyBPShooterCharacter into
the Name field.

Figure 1.15 – Adding the MyBPShooterCharacter C++ class


18 Creating Your First Unreal C++ Game

Please pay attention to the path where the header and the source files will be placed. They look
different from the MyShooter project because the C++ node hasn’t been created yet. Don’t worry
about it at the moment. Once the conversion job is done, the system will automatically move
the files to the right place.
5. After clicking the Create Class button, you will see a progress bar.

Figure 1.16 – The MyBPShooterCharacter C++ class Adding code to project… progress bar

Wait for the pop-up message, which indicates that the C++ class job has been added.

Figure 1.17 – A message saying that the MyBPShooterCharacter C++ class is now added

6. Click the OK button. Now, you will see the message dialog, which asks you whether you want
to edit the code (see Figure 1.18). Choose No here.

Figure 1.18 – Dialog for editing the MyBPShooterCharacter source code

7. Shut down your UE editor and reopen MyBPShooter. When you see a dialog that asks
whether you want to rebuild the project, answer Yes here.
Converting an existing Blueprint project to a C++ project 19

Figure 1.19 – The rebuilding MyBPShooter dialog

When it is done, you will find the new C++ Classes node on the project tree, and the
MyShooterCharacter class is already placed in the MyBPShooter folder:

Figure 1.20 – The converted MyBPShooter C++ project

You may have noticed that some other files, such as MyBPShooterGameMode are missing, in
comparison with the MyShooter project. That is because the Blueprint versions already exist, so the
corresponding C++ versions are not automatically generated. You can choose to manually convert
those blueprints to C++ classes only when necessary; otherwise, you just keep the blueprints.
Exploring the Variety of Random
Documents with Different Content
he cared nothing for the world’s praise, it was pleasant to know that
his powers were still unimpaired, and be able to laugh in his sleeve
at the deluded critics. That was like him, and it deceived me till to-
day. Now I know that he begrudged me your admiration, wanted
your tears and smiles for himself, and did not hesitate to steal them.
The night he so adroitly read his work for mine, he tempted me
through you. I had resolved to deserve the love and honor you gave
me; and again I tried, and again I failed, for my romance was a
poor, pale thing to his. He had read it; and, taking the same plot,
made it what you know, writing as only such a man could write,
when a strong motive stimulated him to do his best.”
“But why did you submit? Why stand silent and let him do so false a
thing?” cried poor Gladys, wondering when the end of the tangle
would come.
“At first his coolness staggered me; then I was curious to hear, then
held even, against my will, by admiration of the thing—and you. I
meant to speak out, I longed to do it; but it was very hard, while
you were praising me so eloquently. The words were on my lips,
when in his face I saw a look that sealed them. He meant that I
should utter the self-accusation which would lower me for ever and
raise him in your regard. I could not bear it. There was no time to
think, only to feel, and I vowed to make you happy, at all costs. I
hardly thought he would submit; but he did, and I believed that it
was through surprise at being outwitted for the moment, or pity
towards you. It was neither: he fancied I had discovered his secret,
and he dared not defy me then.”
“But when I was gone? You were so late that night: I heard your
voices, sharp and angry, as I went away.”
“Yes; that was my hour, and I enjoyed it. He had often twitted me
with the hold he had on my name and fame, and I bore it; for, till I
loved you, they were the dearest things I owned. That night I told
him he should not speak; that you should enjoy your pride in me,
even at his expense, and I refused to release him from his bond, as
he had, more than once, refused to release me: for we had sworn
never to confess till both agreed to it. Good heavens! how low he
must have thought I had fallen, if I could consent to buy your
happiness at the cost of my honor! He did think it: that made him
yield; that is the cause of the contempt he has not cared to hide
from me since then; and that adds a double edge to my hatred now.
I was to be knave as well as fool; and while I blinded myself with his
reflected light, he would have filched my one jewel from me. Gladys,
save me, keep me, or I shall do something desperate yet!”
Beside himself with humiliation, remorse, and wrath, Canaris flung
himself down before her, as if only by clinging to that frail spar could
he ride out the storm in which he was lost without compass or
rudder.
Then Gladys showed him that such love as hers could not fail, but,
like an altar-fire, glowed the stronger for every costly sacrifice
thrown therein. Lifting up the discrowned head, she laid it on her
bosom with a sweet motherliness which comforted more than her
tender words.
“My poor Felix! you have suffered enough for this deceit; I forgive it,
and keep my reproaches for the false friend who led you astray.”
“It was so paltry, weak, and selfish. You must despise me,” he said,
wistfully, still thinking more of his own pain than hers.
“I do despise the sin, not the dear sinner who repents and is an
honest man again.”
“But a beggar.”
“We have each other. Hush! stand up; some one is coming.”
Canaris had barely time to spring to his feet, when Stern came in,
and was about to pass on in silence, though much amazed to see
Gladys there at that hour, when the expression of the young man’s
face made him forget decorum and stop short, exclaiming, anxiously,

“Mr. Felix, what’s the matter? Is master worse?”
“Safe and asleep. Mrs. Canaris came to see what I was about.”
“Then, sir, if I may make so bold, the sooner she gets to bed again
the better. It is far too late for her to be down here; the poor young
lady looks half-dead,” Stern whispered, with the freedom of an old
servant.
“You are right. Come, love;” and without another word Canaris led
her away, leaving Stern to shake his gray head as he looked after
them.
Gladys was utterly exhausted; and in the hall she faltered, saying,
with a patient sigh, as she looked up the long stairway, “Dear, wait a
little; it is so far,—my strength is all gone.”
Canaris caught her in his arms and carried her away, asking himself,
with a remorseful pang that rent his heart,—
“Is this the murder I have committed?”
XVII.

“S tern!”
“Yes, sir.”
“What time is it?”
“Past two, sir.”
“What news? I see bad tidings of some sort in that lugubrious face
of yours; out with it!”
“The little boy arrived at dawn, sir,” answered old Stern, with a
paternal air.
“What little boy?”
“Canaris, Jr., sir,” simpered the valet, venturing to be jocose.
“The deuce he did! Precipitate, like his father. Where is Felix?”
“With her, sir. In a state of mind, as well he may be, letting that
delicate young thing sit up to keep him company over his poetry
stuff,” muttered Stern, busying himself with the shutters.
“Sit up! when? where? what are you maundering about, man?” and
Helwyze himself sat up among the pillows, looking unusually wide-
awake.
“Last night, sir, in the study. Mr. Felix made me go for a wink of
sleep, and when I came back, about one, there sat Mrs. Canaris as
white as her gown, and him looking as wild as a hawk. Something
was amiss, I could see plain enough, but it wasn’t my place to ask
questions; so I just made bold to suggest that it was late for her to
be up, and he took her away, looking dazed-like. That’s all I know,
sir, till I found the women in a great flustration this morning.”
“And I slept through it all?”
“Yes, sir; so soundly, I was a bit anxious till you waked. I found the
glass empty and the bottle smashed, and I was afraid you might
have taken too much of that choral while half-asleep.”
“No fear; nothing kills me. Now get me up;” and Helwyze made his
toilet with a speed and energy which caused Stern to consider
“choral” a wonderful discovery.
A pretence of breakfast; then Helwyze sat down to wait for further
tidings,—externally quite calm, internally tormented by a great
anxiety, till Olivia came in, full of cheering news and sanguine
expectations.
“Gladys is asleep, with baby on her arm, and Felix adoring in the
background. Poor boy! he cannot bear much, and is quite bowed
down with remorse for something he has done. Do you know what?”
As she spoke, Olivia stooped to pick up a book half-hidden by the
fringe of a low chair. It lay face downward, and, in smoothing the
crumpled leaves before closing it, she caught sight of a black and
blotted name. So did Helwyze; a look of intelligence flashed over his
face, and, taking the volume quickly, he answered, with his finger on
the title-page,—
“Yes, now I know, and so may you; for if one woman is in the
secret, it will soon be out. Felix wrote that, and it is true.”
“I thought so! One woman has known it for a long time;
nevertheless, the secret was kept for your sake;” and Olivia’s dark
face sparkled with malicious merriment, as she saw the expression
of mingled annoyance, pride, and pleasure in his.
“My compliments and thanks: you are the eighth wonder of the
world. But what led you to suspect this little fraud of ours?”
“I did not, till the last book came; then I was struck here and there
by certain peculiar phrases, certain tender epithets, which I think no
one ever heard from your lips but me. These, in the hero’s mouth,
made me sure that you had helped Canaris, if not done the whole
yourself, and his odd manner at times confirmed my suspicion.”
“You have a good memory: I forgot that.”
“I have had so few such words from you that it is easy to remember
them,” murmured Olivia, reproachfully.
It seemed to touch him; for just then he felt deserted, well knowing
that he had lost both Felix and Gladys; but Olivia never would desert
him, no matter what discovery was made, or who might fall away.
He thanked her for her devotion, with the first ray of hope given for
years, as he said, in the tone so seldom heard,—
“You shall have more henceforth; for you are a staunch friend, and
now I have no other.”
“Dear Jasper, you shall never find me wanting. I will be true to the
death!” she cried, blooming suddenly into her best and brightest
beauty, with the delight of this rare moment. Then, fearing to
express too much, she wisely turned again to Felix, asking curiously,
“But why did you let this young daw deck himself out in your
plumes? It enrages me, to think of his receiving the praise and
honor due to you.”
He told her briefly, adding, with more than his accustomed
bitterness,—
“What did I want with praise and honor? To be gaped and gossiped
about would have driven me mad. It pleased that vain boy as much
as fooling the public amused me. A whim, and, being a dishonest
one, we shall both have to pay for it, I suppose.”
“What will he do?”
“He has told Gladys, to begin with; and, if it had been possible,
would have taken some decisive step to-day. He can do nothing
sagely and quietly: there must be a dramatic dénouement to every
chapter of his life. I think he has one now.” Helwyze laughed, as he
struck back the leaves of the book he still held, and looked at the
dashing signature of his own name.
“He wrote that, then?” asked Olivia.
“Yes, here, at midnight, while I lay asleep and let him tell the tale as
he liked to Gladys. No wonder it startled her, so tragically given. The
sequel may be more tragic yet: I seem to feel it in the air.”
“What shall you do?” asked Olivia, more anxiously than before; for
Helwyze looked up with as sinister an expression as if he knew how
desperate an enemy had stood over him last night, and when his
own turn came, would be less merciful.
“Do? Nothing. They will go; I shall stay; tongues will wag, and I shall
be tormented. I shall seem the gainer, he the loser; but it will not be
so.”
Involuntarily his eye went to the little chair where Gladys would sit
no longer, and darkened as if some light had gone out which used to
cheer and comfort him. Olivia saw it, and could not restrain the
question that broke from her lips,—
“You do love her, Jasper?”
“I shall miss her; but you shall take her place.”
Calm and a little scornful was his face, his voice quite steady, and a
smile was shed upon her with the last welcome words. But Olivia
was not deceived: the calmness was unnatural, the voice too steady,
the smile too sudden; and her heart sank as she thanked him,
without another question. For a while they sat together playing well
their parts, then she went away to Gladys, and he was left to several
hours of solitary musing.
Had he been a better man, he would not have sinned; had he been
a worse one, he could not have suffered; being what he was, he did
both, and, having no one else to study now, looked deeply into
himself, and was dismayed at what he saw. For the new love, purer,
yet more hopeless than the old, shone like a star above an abyss,
showing him whither he had wandered in the dark.
Sunset came, filling the room with its soft splendor; and he watched
the red rays linger longest in Gladys’s corner. Her little basket stood
as she left it, her books lay orderly, her desk was shut, a dead flower
drooped from the slender vase, and across the couch trailed a soft
white shawl she had been wont to wear. Helwyze did not approach
the spot, but stood afar off looking at these small familiar things
with the melancholy fortitude of one inured to loss and pain. Regret
rather than remorse possessed him as he thought, drearily,—
“A year to-morrow since she came. How shall I exist without her?
Where will her new home be?”
An answer was soon given to the last question; for, while his fancy
still hovered about that nook, and the gentle presence which had
vanished as the sunshine was fast vanishing, Canaris came in
wearing such an expression of despair, that Helwyze recoiled, leaving
half-uttered a playful inquiry about “the little son.”
“I have no son.”
“Dead?”
“Dead. I have murdered both.”
“But Gladys?”
“Dying; she asks for you,—come!” No need of that hoarse command;
Helwyze was gone at the first word, swiftly through room and hall,
up the stairs he had not mounted for months, straight to that
chamber-door. There a hand clutched his shoulder, a breathless
voice said, “Here I am first;” and Canaris passed in before him,
motioning away a group of tearful women as he went.
Helwyze lingered, pale and panting, till they were gone; then he
looked and listened, as if turned to stone, for in the heart of the
hush lay Gladys, talking softly to the dead baby on her arm. Not
mourning over it, but yearning with maternal haste to follow and
cherish the creature of her love.
“Only a day old; so young to go away alone. Even in heaven you will
want your mother, darling, and she will come. Sleep, my baby, I will
be with you when you wake.”
A stifled sound of anguish recalled the happy soul, already half-way
home, and Gladys turned her quiet eyes to her husband bending
over her.
“Dear, will he come?” she whispered.
“He is here.”
He was; and, standing on either side the bed, the two men seemed
unconscious of each other, intent only upon her. Feebly she drew the
white cover over the little cold thing in her bosom, as if too sacred
for any eyes but hers to see, then lifted up her hand with a
beseeching glance from one haggard face to the other. They
understood; each gave the hand she asked, and, holding them
together with the last effort of failing strength, she said, clear and
low,—
“Forgive each other for my sake.”
Neither spoke, having no words, but by a mute gesture answered as
she wished. Something brighter than a smile rested on her face,
and, as if satisfied, she turned again to Canaris, seeming to forget all
else in the tender farewell she gave him.
“Remember, love, remember we shall be waiting for you. The new
home will not be home to us until you come.”
As her detaining touch was lifted, the two hands fell apart, never to
meet again. Canaris knelt down to lay his head beside hers on the
pillow, to catch the last accents of the beloved voice, sweet even
now. Helwyze, forgotten by them both, drew back into the shadow
of the deep red curtains, still studying with an awful curiosity the
great mystery of death, asking, even while his heart grew cold within
him,—
“Will the faith she trusted sustain her now?”
It did; for, leaning on the bosom of Infinite Love, like a confiding
child in its father’s arms, without a doubt or fear to mar her peace, a
murmur or lament to make the parting harder, Gladys went to her
own place.
XVIII.

“F or in that sleep of death, what dreams may come. Is this one?”


was the vague feeling, rather than thought, of which Helwyze
was dimly conscious, as he lay in what seemed a grave, so cold, so
dead he felt; so powerless and pent, in what he fancied was his
coffin. He remembered the slow rising of a tide of helplessness
which chilled his blood and benumbed his brain, till the last idea to
be distinguished was, “I am dying: shall I meet Gladys?” then came
oblivion, and now, what was this?
Something was alive still—something which strove to see, move,
speak, yet could not, till the mist, which obscured every sense,
should clear away. A murmur was in the air, growing clearer every
instant, as it rose and fell, like the muffled sound of waves upon a
distant shore. Presently he recognized human voices, and the words
they uttered,—words which had no meaning, till, like an electric
shock, intelligence returned, bringing with it a great fear.
Olivia was mourning over him, and he felt her tears upon his face;
but it was not this which stung him to sudden life,—it was another
voice, saying, low, but with a terrible distinctness,—
“There is no hope. He may remain so for some years; but sooner or
later the brain will share the paralysis of the body, and leave our
poor friend in a state I grieve to think of.”
“No!” burst from Helwyze, with an effort which seemed to dispel the
trance which held his faculties. Stir he could not, but speak he did,
and opened wide the eyes which had been closed for hours. With
the unutterable relief of one roused from a nightmare he recognized
his own room, Olivia’s tender face bent over him, and his physician
holding a hand that had no feeling in it.
“Not dead yet;” he muttered, with a feeble sort of exultation,
adding, with as feeble a despair and doubt, “but she is. Did I dream
that?”
“Alas, no!” and Olivia wiped away her own tears from the forehead
which began to work with the rush of returning memory and
thought.
“What does this numbness mean? Why are you here?” he asked, as
his eye went from one face to the other.
“Dear Jasper, it means that you are ill. Stern found you unconscious
in your chair last night. You are much better now, but it alarmed us,
for we thought you dead,” replied Olivia, knowing that he would
have the truth at any cost.
“I remember thinking it was death, and being glad of it. Why did you
bring me back? I had no wish to come.”
She forgave the ingratitude, and went on chafing the cold hand so
tenderly, that Helwyze reproached no more, but, turning to the
physician, demanded, with a trace of the old imperiousness coming
back into his feeble voice,—
“Is this to be the end of it?”
“I fear so, Mr. Helwyze. You will not suffer any more, let that comfort
you.”
“My body may not, but my mind will suffer horribly. Good heavens,
man, do you call this death in life a comfortable end? How long have
I got to lie here watching my wits go?”
“It is impossible to say.”
“But certain, sooner or later?”
“There is a chance,—your brain has been overworked: it must have
rest,” began the doctor, trying to soften the hard facts, since his
patient would have them.
“Rest! kill me at once, then; annihilation would be far better than
such rest as that. I will not lie here waiting for imbecility,—put an
end to this, or let me!” cried Helwyze, struggling to lift his powerless
right hand; and, finding it impossible, he looked about him with an
impotent desperation which wrung Olivia’s heart, and alarmed the
physician, although he had long foreseen this climax.
Both vainly tried to soothe and console; but after that one despairing
appeal Helwyze turned his face to the wall, and lay so for hours.
Asleep, they hoped, but in reality tasting the first bitterness of the
punishment sent upon him as an expiation for the sin of misusing
one of Heaven’s best gifts. No words could describe the terror such a
fate had for him, since intellect had been his god, and he already felt
it tottering to its fall. On what should he lean, if that were taken?
where see any ray of hope to make the present endurable? where
find any resignation to lighten the gloom of such a future?
Restless mind and lawless will, now imprisoned in a helpless body,
preyed on each other like wild creatures caged, finding it impossible
to escape, and as impossible to submit. Death would not have
daunted him, pain he had learned to endure; but this slow decay of
his most precious possession he could not bear, and suffered a new
martyrdom infinitely sharper than the old.
How time went he never knew; for, although merciful
unconsciousness was denied him, his thoughts, like avenging Furies,
drove him from one bitter memory to another, probing his soul as he
had probed others, and tormenting him with an almost supernatural
activity of brain before its long rest began. Ages seemed to pass,
while he took no heed of what went on about him. People came and
went, faces bent over him, hands ministered to him, and voices
whispered in the room. He knew all this, without the desire to do so,
longing only to forget and be forgotten, with an increasing irritation,
which slowly brought him back from that inner world of wordless
pain to the outer one, which must be faced, and in some fashion
endured.
Olivia still sat near him, as if she had not stirred, though it was
morning when last he spoke, and now night had come. The familiar
room was dim and still, every thing already ordered for his comfort,
and the brilliant cousin had transformed herself into a quiet nurse.
The rustling silks were replaced by a soft, gray gown; the ornaments
all gone; even the fine hair was half-hidden by the little kerchief of
lace tied over it. Yet never had Olivia been more beautiful; for now
the haughty queen had changed to a sad woman, wearing for her
sole ornaments constancy and love. Worn and weary she looked, but
a sort of sorrowful content was visible, a jealous tenderness, which
plainly told that for her, at least, there was a drop of honey even in
the new affliction, since it made him more her own than ever.
“Poor soul! she promised to be faithful to the death; and she will be,
—even such a death as this.”
A sigh, that was almost a groan, broke from Helwyze as the thought
came, and Olivia was instantly at his side.
“Are you suffering, Jasper? What can I do for you?” she said, with
such a passionate desire to serve or cheer, that he could not but
answer, gently,—
“I am done with pain: teach me to be patient.”
“Oh, if I could! we must learn that together,” she said, feeling with
him how sorely both would need the meek virtue to sustain the life
before them.
“Where is Felix?” asked Helwyze, after lying for a while, with his
eyes upon the fire, as if they would absorb its light and warmth into
their melancholy depths.
“Mourning for Gladys,” replied Olivia, fearing to touch the dangerous
topic, yet anxious to know how the two men stood toward one
another; for something in the manner of the younger, when the
elder was mentioned, made her suspect some stronger, sadder tie
between them than the one she had already guessed.
“Does he know of this?” and Helwyze struck himself a feeble blow
with the one hand which he could use, now lying on his breast.
“Yes.”
“What does he say of me?”
“Nothing.”
“I must see him.”
“You shall. I asked him if he had no word for you, and he answered,
with a strange expression, ‘When I have buried my dead I will come,
for the last time.’”
“How does he look?” questioned Helwyze, curious to see, even
through another’s eyes, the effect of sorrow upon the man whom he
had watched so long and closely.
“Sadly broken; but he is young and sanguine: he will soon forget,
and be happy again; so do not let a thought of him disturb you,
Jasper.”
“It does not: we made our bargain, and held each other to it, till he
chose to break it. Let him bear the consequences, as I do.”
“Alas, they fall on him far less heavily than on you! He has all the
world before him where to choose, while you have nothing left—but
me.”
He did not seem to hear her, and fell into a gloomy reverie, which
she dared not break, but sat, patiently beguiling her lonely watch
with sad thoughts of the twilight future they were to share together,
—a future which might have been so beautiful and happy, had true
love earlier made them one.
Another day, another night, then there were sounds about the house
which told Helwyze what was passing, without the need of any
question. He asked none; but lay silent for the most part, as if
careless or unconscious of what went on around him. He missed
Olivia for an hour, and when she returned, traces of tears upon her
cheeks told him that she had been to say farewell to Gladys. He had
not spoken that name even to himself; for now an immeasurable
space seemed to lie between him and its gentle owner. She had
gone into a world whither he could not follow her. A veil, invisible,
yet impenetrable, separated them for ever, he believed, and nothing
remained to him but a memory that would not die,—a memory so
bitter-sweet, so made up of remorse and reverence, love and
longing, that it seemed to waken his heart from its long sleep, and
kindle in it a spark of the divine fire, whose flame purified while it
consumed; for even in his darkness and desolation he was not
forgotten.
Late that day Canaris came, looking like a man escaped from a great
shipwreck, with nothing left him but his life. Unannounced he
entered, and, with the brevity which in moments of strong feeling is
more expressive than eloquence, he said,—
“I am going.”
“Where?” asked Helwyze, conscious that any semblance of
friendship, any word of sympathy, was impossible between them.
“Out into the world again.”
“What will you do?”
“Any honest work I can find.”
“Let me”—
“No! I will take nothing from you. Poor as I came, I will go,—except
the few relics I possess of her.”
A traitorous tremor in the voice which was stern with repressed
emotion warned Canaris to pause there, while his eye turned to
Olivia, as if reminded of some last debt to her. From his breast he
drew a little paper, unfolded it, and took out what looked like a
massive ring of gold; this he laid before her, saying, with a softened
mien and accent,—
“You were very kind,—I have nothing else to offer,—let me give you
this, in memory of Gladys.”
Only a tress of sunny hair; but Olivia received the gift as if it were a
very precious one, thanking him, not only with wet eyes, but friendly
words.
“Dear Felix, for her sake let me help you, if I can. Do not go away so
lonely, purposeless, and poor. The world is hard; you will be
disheartened, and turn desperate, with no one to love and hope and
work for.”
“I must help myself. I am poor; but not purposeless, nor alone.
Disheartened I may be: never desperate again; for I have some one
to love and hope and work for. She is waiting for me somewhere: I
must make myself worthy to follow and find her. I have promised;
and, God helping me, I will keep that promise.”
Very humble, yet hopeful, was the voice; and full of a sad courage
was the young man’s altered face,—for out of it the gladness and
the bloom of youth had gone for ever, leaving the strength of a
noble purpose to confront a life which hereafter should be honest, if
not happy.
Helwyze had not the infinite patience to work in marble; the power
to chisel even his own divided nature into harmony, like the sculptor,
who, in the likeness of a suffering saint, hewed his own features out
of granite. He could only work in clay, as caprice inspired or
circumstance suggested; forgetting that life’s stream of mixed and
molten metals would flow over his faulty models, fixing unalterably
both beauty and blemish. He had found the youth plastic as clay,
had shaped him as he would; till, tiring of the task, he had been
ready to destroy his work. But the hand of a greater Master had
dropped into the furnace the gold of an enduring love, to brighten
the bronze in which suffering and time were to cast the statue of the
man. Helwyze saw this now, and a pang of something sharper than
remorse wrung from him the reluctant words,—
“Take, as my last gift, the fame which has cost you so much. I will
never claim it: to me it is an added affliction, to you it may be a
help. Keep it, I implore you, and give me the pardon she asked of
you.”
But Canaris turned on him with the air of one who cries, “Get thee
behind me!” and answered with enough of the old vehemence to
prove that grief had not yet subdued the passionate spirit which had
been his undoing,—
“It is no longer in your power to tempt me, or in mine to be
tempted, by my bosom sin. Forsythe knows the truth, and the world
already wonders. I will earn a better fame for myself: keep this, and
enjoy it, if you can. Pardon I cannot promise yet; but I give you my
pity, ‘for her sake.’”
With that—the bitterest word he could have uttered—Canaris was
gone, leaving Helwyze to writhe under the double burden imposed
by one more just than generous. Olivia durst not speak; and, in the
silence, both listened to the hasty footsteps that passed from room
to room, till a door closed loudly, and they knew that Canaris had set
forth upon that long pilgrimage which was in time to lead him up to
Gladys.
Helwyze spoke first, exclaiming, with a dreary laugh,—
“So much for playing Providence! You were right, and I was rash to
try it. Goethe could make his Satan as he liked; but Fate was
stronger than I, and so comes ignominious failure. Margaret dies,
and Faust suffers, but Mephistopheles cannot go with him on his
new wanderings. Still, it holds—it holds even to the last! My end
comes too soon; yet it is true. In loving the angel I lose the soul I
had nearly won; the roses turn to flakes of fire, and the poor devil is
left lamenting.”
Olivia thought him wandering, and listened in alarm; for his thoughts
seemed blown to and fro, like leaves in a fitful gust, and she had no
clew to them. Presently, he broke out again, still haunted by the real
tragedy in which he had borne a part; still following Canaris, whose
freedom was like the thought of water to parched Tantalus.
“He will do it! he will do it! When or how, who shall say? but, soon
or late, she will save him, since he believes in such salvation. Would
that I did!”
Perhaps the despairing wish was the seed of a future hope, which
might blossom into belief. Olivia trusted so, and tried to murmur
some comfortable, though vague, assurance of a love and pity
greater even than hers. He did not hear her; for his eyes were fixed,
with an expression of agonized yearning, upon the sky, serene and
beautiful, but infinitely distant, inexorably dumb; and, when he
spoke, his words had in them both his punishment and her own,—
“Life before was Purgatory, now it is Hell; because I loved her, and I
have no hope to follow and find her again.”
A WHISPER IN THE DARK.
A WHISPER IN THE DARK.

A s we rolled along, I scanned my companion covertly, and saw


much to interest a girl of seventeen. My uncle was a handsome
man, with all the polish of foreign life fresh upon him; yet it was
neither comeliness nor graceful ease which most attracted me; for
even my inexperienced eye caught glimpses of something stern and
sombre below these external charms, and my long scrutiny showed
me the keenest eye, the hardest mouth, the subtlest smile I ever
saw,—a face which in repose wore the look which comes to those
who have led lives of pleasure and learned their emptiness. He
seemed intent on some thought that absorbed him, and for a time
rendered him forgetful of my presence, as he sat with folded arms,
fixed eyes, and restless lips. While I looked, my own mind was full of
deeper thought than it had ever been before; for I was recalling,
word for word, a paragraph in that half-read letter:—
“At eighteen Sybil is to marry her cousin, the compact having
been made between my brother and myself in their
childhood. My son is with me now, and I wish them to be
together during the next few months, therefore my niece
must leave you sooner than I at first intended. Oblige me by
preparing her for an immediate and final separation, but
leave all disclosures to me, as I prefer the girl to remain
ignorant of the matter for the present.”
That displeased me. Why was I to remain ignorant of so important
an affair? Then I smiled to myself, remembering that I did know,
thanks to the wilful curiosity that prompted me to steal a peep into
the letter that Madame Bernard had pored over with such an anxious
face. I saw only a single paragraph, for my own name arrested my
eye; and, though wild to read all, I had scarcely time to whisk the
paper back into the reticule the forgetful old soul had left hanging on
the arm of her chair. It was enough, however, to set my girlish brain
in a ferment, and keep me gazing wistfully at my uncle, conscious
that my future now lay in his hands; for I was an orphan and he my
guardian, though I had seen him but seldom since I was confided to
madame a six years’ child. Presently my uncle became cognizant of
my steady stare, and returned it with one as steady for a moment,
then said, in a low, smooth tone, that ill accorded with the satirical
smile that touched his lips,—
“I am a dull companion for my little niece. How shall I provide her
with pleasanter amusement than counting my wrinkles or guessing
my thoughts?”
I was a frank, fearless creature, quick to feel, speak, and act, so I
answered readily,—
“Tell me about my cousin Guy. Is he as handsome, brave, and clever
as madame says his father was when a boy?”
My uncle laughed a short laugh, touched with scorn, whether for
madame, himself, or me I could not tell, for his countenance was
hard to read.
“A girl’s question and artfully put; nevertheless I shall not answer it,
but let you judge for yourself.”
“But, sir, it will amuse me and beguile the way. I feel a little strange
and forlorn at leaving madame, and talking of my new home and
friends will help me to know and love them sooner. Please tell me,
for I’ve had my own way all my life, and can’t bear to be crossed.”
My petulance seemed to amuse him, and I became aware that he
was observing me with a scrutiny as keen as my own had been; but
I smilingly sustained it, for my vanity was pleased by the
approbation his eye betrayed. The evident interest he now took in all
I said and did was sufficient flattery for a young thing, who felt her
charms and longed to try their power.
“I, too, have had my own way all my life; and as the life is double
the length, the will is double the strength of yours, and again I say
no. What next, mademoiselle?”
He was blander than ever as he spoke, but I was piqued, and
resolved to try coaxing, eager to gain my point, lest a too early
submission now should mar my freedom in the future.
“But that is ungallant, uncle, and I still have hopes of a kinder
answer, both because you are too generous to refuse so small a
favor to your ‘little niece,’ and because she can be charmingly
wheedlesome when she likes. Won’t you say yes now, uncle?” and,
pleased with the daring of the thing, I put my arm about his neck,
kissed him daintily, and perched myself upon his knee with most
audacious ease.
He regarded me mutely for an instant, then holding me fast
deliberately returned my salute on lips, cheeks, and forehead, with
such warmth that I turned scarlet and struggled to free myself, while
he laughed that mirthless laugh of his till my shame turned to anger,
and I imperiously commanded him to let me go.
“Not yet, young lady. You came here for your own pleasure, but shall
stay for mine, till I tame you as I see you must be tamed. It is a
short process with me, and I possess experience in the work; for
Guy, though by nature as wild as a hawk, has learned to come at my
call as meekly as a dove. Chut! what a little fury it is!”
I was just then; for exasperated at his coolness, and quite beside
myself, I had suddenly stooped and bitten the shapely white hand
that held both my own. I had better have submitted; for slight as
the foolish action was, it had an influence on my after life as many
another such has had. My uncle stopped laughing, his hand
tightened its grasp, for a moment his cold eye glittered and a grim
look settled round the mouth, giving to his whole face a ruthless
expression that entirely altered it. I felt perfectly powerless. All my
little arts had failed, and for the first time I was mastered. Yet only
physically; my spirit was rebellious still. He saw it in the glance that
met his own, as I sat erect and pale, with something more than
childish anger. I think it pleased him, for swiftly as it had come the
dark look passed, and quietly, as if we were the best of friends, he
began to relate certain exciting adventures he had known abroad,
lending to the picturesque narration the charm of that peculiarly
melodious voice, which soothed and won me in spite of myself,
holding me intent till I forgot the past; and when he paused I found
that I was leaning confidentially on his shoulder, asking for more, yet
conscious of an instinctive distrust of this man whom I had so soon
learned to fear yet fancy.
As I was recalled to myself, I endeavored to leave him; but he still
detained me, and, with a curious expression, produced a case so
quaintly fashioned that I cried out in admiration, while he selected
two cigarettes, mildly aromatic with the herbs they were composed
of, lit them, offered me one, dropped the window, and leaning back
surveyed me with an air of extreme enjoyment, as I sat meekly
puffing and wondering what prank I should play a part in next.
Slowly the narcotic influence of the herbs diffused itself like a
pleasant haze over all my senses; sleep, the most grateful, fell upon
my eyelids, and the last thing I remember was my uncle’s face
dreamily regarding me through a cloud of fragrant smoke. Twilight
wrapped us in its shadows when I woke, with the night wind blowing
on my forehead, the muffled roll of wheels sounding in my ear, and
my cheek pillowed upon my uncle’s arm. He was humming a French
chanson about “Love and Wine, and the Seine to-morrow!” I listened
till I caught the air, and presently joined him, mingling my girlish
treble with his flute-like tenor. He stopped at once, and, in the coolly
courteous tone I had always heard in our few interviews, asked if I
was ready for lights and home.
“Are we there?” I cried; and looking out saw that we were ascending
an avenue which swept up to a pile of buildings that rose tall and
dark against the sky, with here and there a gleam along its gray
front.
“Home at last, thank Heaven!” And springing out with the agility of a
young man, my uncle led me over a terrace into a long hall, light
and warm, and odorous with the breath of flowers blossoming here
and there in graceful groups. A civil, middle-aged maid received and
took me to my room, a bijou of a place, which increased my wonder
when told that my uncle had chosen all its decorations and
superintended their arrangement. “He understands women,” I
thought, handling the toilet ornaments, trying luxurious chair and
lounge, and ending by slipping my feet into the scarlet and white
Turkish slippers, coquettishly turning up their toes before the fire. A
few moments I gave to examination, and, having expressed my
satisfaction, was asked by my maid if I would be pleased to dress, as
“the master” never allowed dinner to wait for any one. This recalled
to me the fact that I was doubtless to meet my future husband at
that meal, and in a moment every faculty was intent upon achieving
a grand toilette for this first interview. The maid possessed skill and
taste, and I a wardrobe lately embellished with Parisian gifts from
my uncle which I was eager to display in his honor.
When ready, I surveyed myself in the long mirror as I had never
done before, and saw there a little figure, slender, yet stately, in a
dress of foreign fashion, ornamented with lace and carnation ribbons
which enhanced the fairness of neck and arms, while blonde hair,
wavy and golden, was gathered into an antique knot of curls behind,
with a carnation fillet, and below a blooming dark-eyed face, just
then radiant with girlish vanity and eagerness and hope.
“I’m glad I’m pretty!”
“So am I, Sybil.”
I had unconsciously spoken aloud, and the echo came from the
doorway where stood my uncle, carefully dressed, looking comelier
and cooler than ever. The disagreeable smile flitted over his lips as
he spoke, and I started, then stood abashed, till beckoning, he
added in his most courtly manner,—
“You were so absorbed in the contemplation of your charming self,
that Janet answered my tap and took herself away unheard. You are
mistress of my table now: it waits; will you come down?”
With a last touch to that unruly hair of mine, a last, comprehensive
glance and shake, I took the offered arm and rustled down the wide
staircase, feeling that the romance of my life was about to begin.
Three covers were laid, three chairs set, but only two were occupied,
for no Guy appeared. I asked no questions, showed no surprise, but
tried to devour my chagrin with my dinner, and exerted myself to
charm my uncle into the belief that I had forgotten my cousin. It
was a failure, however, for that empty seat had an irresistible
fascination for me, and more than once, as my eye returned from its
furtive scrutiny of napkin, plate, and trio of colored glasses, it met
my uncle’s and fell before his penetrative glance. When I gladly rose
to leave him to his wine,—for he did not ask me to remain,—he also
rose, and, as he held the door for me, he said,—
“You asked me to describe your cousin: you have seen one trait of
his character to-night; does it please you?”
I knew he was as much vexed as I at Guy’s absence, so quoting his
own words I answered saucily,—
“Yes; for I’d rather see the hawk free than coming tamely at your
call, uncle.”
He frowned slightly, as if unused to such liberty of speech, yet
bowed when I swept him a stately little curtsey and sailed away to
the drawing-room, wondering if my uncle was as angry with me as I
was with my cousin. In solitary grandeur I amused myself by
strolling through the suite of handsome rooms henceforth to be my
realm, looked at myself in the long mirrors, as every woman is apt to
do when alone and in costume, danced over the mossy carpets,
touched the grand piano, smelt the flowers, fingered the ornaments
on étagère and table, and was just giving my handkerchief a second
drench of some refreshing perfume from a filigree flask that had
captivated me, when the hall door was flung wide, a quick step went
running upstairs, boots tramped overhead, drawers seemed hastily
opened and shut, and a bold, blithe voice broke out into a hunting
song in a tone so like my uncle’s that I involuntarily flew to the door,
crying,—
“Guy is come!”
Fortunately for my dignity, no one heard me, and hurrying back I
stood ready to skim into a chair and assume propriety at a minute’s
notice, conscious, meanwhile, of the new influence which seemed
suddenly to gift the silent house with vitality, and add the one charm
it needed,—that of cheerful companionship. “How will he meet me?
and how shall I meet him?” I thought, looking up at the bright-faced
boy, whose portrait looked back at me with a mirthful light in the
painted eyes and a trace of his father’s disdainful smile in the curves
of the firm-set lips. Presently the quick steps came flying down
again, past the door, straight to the dining-room opposite, and, as I
stood listening with a strange flutter at my heart, I heard an
imperious young voice say rapidly,—
“Beg pardon, sir, unavoidably detained. Has she come? Is she
bearable?”
“I find her so. Dinner is over, and I can offer you nothing but a glass
of wine.”
My uncle’s voice was frostily polite, making a curious contrast to the
other, so impetuous and frank, as if used to command or win all but
one.
“Never mind the dinner! I’m glad to be rid of it; so I’ll drink your
health, father, and then inspect our new ornament.”
“Impertinent boy!” I muttered, yet at the same moment resolved to
deserve his appellation, and immediately grouped myself as
effectively as possible, laughing at my folly as I did so. I possessed a
pretty foot, therefore one little slipper appeared quite naturally
below the last flounce of my dress; a bracelet glittered on my arm as
it emerged from among the lace and carnation knots; that arm
supported my head. My profile was well cut, my eyelashes long,
therefore I read with face half averted from the door. The light
showered down, turning my hair to gold; so I smoothed my curls,
retied my snood, and, after a satisfied survey, composed myself with
an absorbed aspect and a quickened pulse to await the arrival of the
gentlemen.
Soon they came. I knew they paused on the threshold, but never
stirred till an irrepressible, “You are right, sir!” escaped the younger.
Then I rose prepared to give him the coldest greeting, yet I did not.
I had almost expected to meet the boyish face and figure of the
picture; I saw, instead, a man comely and tall. A dark moustache
half hid the proud mouth; the vivacious eyes were far kinder, though
quite as keen as his father’s, and the freshness of unspoiled youth
lent a charm which the older man had lost for ever. Guy’s glance of
pleased surprise was flatteringly frank, his smile so cordial, his
“Welcome, cousin!” such a hearty sound, that my coldness melted in
a breath, my dignity was all forgotten, and before I could restrain
myself I had offered both hands with the impulsive exclamation,—
“Cousin Guy, I know I shall be very happy here! Are you glad I have
come?”
“Glad as I am to see the sun after a November fog.”
And, bending his tall head, he kissed my hand in the graceful foreign
fashion he had learned abroad. It pleased me mightily, for it was
both affectionate and respectful. Involuntarily I contrasted it with my
uncle’s manner, and flashed a significant glance at him as I did so.
He understood it, but only nodded with the satirical look I hated,
shook out his paper and began to read. I sat down again, careless of
myself now; and Guy stood on the rug, surveying me with an
expression of surprise that rather nettled my pride.
“He is only a boy, after all; so I need not be daunted by his inches or
his airs. I wonder if he knows I am to be his wife, and likes it.”
The thought sent the color to my forehead, my eyes fell, and despite
my valiant resolution, I sat like any bashful child before my
handsome cousin. Guy laughed a boyish laugh as he sat down on his
father’s footstool, saying, while he warmed his slender brown hands,

“I beg your pardon, Sybil. (We won’t be formal, will we?) But I
haven’t seen a lady for a month, so I stare like a boor at sight of a
silk gown and high-bred face. Are those people coming, sir?”
“If Sybil likes, ask her.”
“Shall we have a flock of people here to make it gay for you, cousin,
or do you prefer our quiet style better; just riding, driving, lounging,
and enjoying life, each in his own way? Henceforth it is to be as you
command in such matters.”
“Let things go on as they have done, then. I don’t care for society,
and strangers wouldn’t make it gay to me, for I like freedom; so do
you, I think.”
“Ah, don’t I!”
A cloud flitted over his smiling face, and he punched the fire, as if
some vent were necessary for the sudden gust of petulance that knit
his black brows into a frown, and caused his father to tap him on the
shoulder with the bland request, as he rose to leave the room,—
“Bring the portfolios and entertain your cousin; I have letters to
write, and Sybil is too tired to care for music to-night.”
Guy obeyed with a shrug of the shoulder his father touched, but
lingered in the recess till my uncle, having made his apologies to me,
had left the room; then my cousin rejoined me, wearing the same
cordial aspect I first beheld. Some restraint was evidently removed,
and his natural self appeared. A very winsome self it was, courteous,
gay, and frank, with an undertone of deeper feeling than I thought
to find. I watched him covertly, and soon owned to myself that he
was all I most admired in the ideal hero every girl creates in her
romantic fancy; for I no longer looked upon this young man as my
cousin, but my lover, and through all our future intercourse this
thought was always uppermost, full of a charm that never lost its
power.
Before the evening ended Guy was kneeling on the rug beside me,
our two heads close together, while he turned the contents of the
great portfolio spread before us, looking each other freely in the
face, as I listened and he described, both breaking into frequent
peals of laughter at some odd adventure or comical mishap in his
own travels, suggested by the pictured scenes before us. Guy was
very charming, I my blithest, sweetest self, and when we parted
late, my cousin watched me up the stairs with still another, “Good-
night, Sybil,” as if both sight and sound were pleasant to him.
“Is that your horse Sultan?” I called from my window next morning,
as I looked down upon my cousin, who was coming up the drive
from an early gallop on the moors.
“Yes, bonny Sybil; come and admire him,” he called back, hat in
hand, and a quick smile rippling over his face.
I went, and, standing on the terrace, caressed the handsome
creature, while Guy said, glancing up at his father’s undrawn
curtains,—
“If your saddle had come, we would take a turn before ‘my lord’ is
ready for breakfast. This autumn air is the wine you women need.”
I yearned to go, and when I willed the way soon appeared; so
careless of bonnetless head and cambric gown, I stretched my
hands to him, saying boldly,—
“Play young Lochinvar, Guy; I am little and light; take me up before
you and show me the sea.”
He liked the daring feat, held out his hand, I stepped on his boot
toe, sprang up, and away we went over the wide moor, where the
sun shone in a cloudless heaven, the lark soared singing from the
green grass at our feet, and the September wind blew freshly from
the sea. As we paused on the upland slope, that gave us a free view
of the country for miles, Guy dismounted, and, standing with his arm
about the saddle to steady me in my precarious seat, began to talk.
“Do you like your new home, cousin?”
“More than I can tell you!”
“And my father, Sybil?”
“Both yes and no to that question, Guy; I hardly know him yet.”
“True, but you must not expect to find him as indulgent and fond as
many guardians would be to such as you. It’s not his nature. Yet you
can win his heart by obedience, and soon grow quite at ease with
him.”
“Bless you! I’m that already, for I fear no one. Why, I sat on his knee
yesterday and smoked a cigarette of his own offering, though
madame would have fainted if she had seen me; then I slept on his
arm an hour, and he was fatherly kind, though I teased him like a
gnat.”
“The deuce he was!” with which energetic expression Guy frowned
at the landscape and harshly checked Sultan’s attempt to browse,
while I wondered what was amiss between father and son, and
resolved to discover; but, finding the conversation at an end, started
it afresh, by asking,—
“Is any of my property in this part of the country, Guy? Do you know
I am as ignorant as a baby about my own affairs; for, as long as
every whim was gratified and my purse full, I left the rest to
madame and uncle, though the first hadn’t a bit of judgment, and
the last I scarcely knew. I never cared to ask questions before, but
now I am intensely curious to know how matters stand.”
“All you see is yours, Sybil,” was the brief answer.
“What, that great house, the lovely gardens, these moors, and the
forest stretching to the sea? I’m glad! I’m glad! But where, then, is
your home, Guy?”
“Nowhere.”
At this I looked so amazed, that his gloom vanished in a laugh, as he
explained, but briefly, as if this subject were no pleasanter than the
first,—

You might also like