Mac game programming 1st Edition Mark Szymczyk pdf download
Mac game programming 1st Edition Mark Szymczyk pdf download
download
https://ebookname.com/product/mac-game-programming-1st-edition-
mark-szymczyk/
https://ebookname.com/product/linux-game-programming-w-cd-prima-
tech-s-game-development-1st-edition-mark-collins/
https://ebookname.com/product/game-programming-with-python-game-
development-series-1st-edition-riley/
https://ebookname.com/product/ai-game-programming-wisdom-1st-
edition-steve-rabin/
https://ebookname.com/product/latino-education-an-agenda-for-
community-action-research-national-latino-a-education-research-
and-policy-project-1st-edition-melissa-rivera-pedro-pedraza/
Harry B Smith Dean of American Librettists 1st Edition
John Franceschina
https://ebookname.com/product/harry-b-smith-dean-of-american-
librettists-1st-edition-john-franceschina/
https://ebookname.com/product/nationalisms-in-japan-1st-edition-
naoko-shimazu/
https://ebookname.com/product/handbook-of-collective-
intelligence-1st-edition-thomas-w-malone/
https://ebookname.com/product/attachment-focused-trauma-
treatment-for-children-and-adolescents-phase-oriented-strategies-
for-addressing-complex-trauma-disorders-1st-edition-niki-gomez-
perales/
https://ebookname.com/product/global-leadership-research-
practice-and-development-mark-e-mendenhall/
Tourism Culture and Regeneration First Edition M. K.
Smith
https://ebookname.com/product/tourism-culture-and-regeneration-
first-edition-m-k-smith/
00 Macgame_FM.qxd 2/21/03 5:02 PM Page i
Mac Game
Programming
00 Macgame_FM.qxd 2/21/03 5:02 PM Page ii
Mac Game
Programming
Mark Szymczyk
00 Macgame_FM.qxd 2/21/03 5:02 PM Page iv
© 2002 by Premier Press, Inc. All rights reserved. No part of this book may be reproduced or trans-
mitted in any form or by any means, electronic or mechanical, including photocopying, recording, or
by any information storage or retrieval system without written permission from Premier Press, except
for the inclusion of brief quotations in a review.
The Premier Press logo, top edge printing, and related trade dress are trademarks of Premier
Press, Inc. and may not be used without written permission. All other trademarks are the
property of their respective owners.
Foreword
S o you want to be a Mac game programmer? This book is a great place to start.
Whether you are interested in how games work, want to learn to write share-
ware games, or want to become the next great commercial game developer, this
book will show you some of the key technologies and techniques required to make
your dream game.
Through the years, I’ve worked on many Mac games, from Duke Nukem 3D to Tomb
Raider and Unreal Tournament. When I began writing Mac games in 1985, I would
have loved to have access to a reference like this one. In those early years, Mac
game developers learned tricks from anywhere they could find them—late nights
pouring over Apple documentation, swapping ideas with other developers, and a
lot of trial and error.
As president of Westlake Interactive, I’m often asked by people how to break into
the Mac game business. My first answer is to get experience any way you can.
Anything from writing simple 2D games to working on flashy demos will show
potential employers that you have the drive and knowledge to make it in the game
business. Mac game programmers are incredibly difficult to find these days, so the
market for people with the interest and talent to work in the industry is very
strong.
Writing Macintosh games can be some of the most exciting, challenging, and
rewarding work a programmer can tackle. You have in your hands the perfect start-
ing point to enter the world of game programming; with hard work and determina-
tion, you’ll be well on your way to writing that next great Mac game!
Glenda Adams
President, Westlake Interactive
May 2002
00 Macgame_FM.qxd 2/21/03 5:02 PM Page vii
Acknowledgments
I t pains me to admit it, but I did not single-handedly create this book. Many people
helped make this book a reality, and I’d like to thank them here.
First, I’d like to thank my editors at Premier Press—and I worked with many editors
on this book. I would like to thank my original acquisitions editor, Jody Kennen, for
discovering me and for putting the book deal together. I would also like to thank my
original project editor, Brian Thomasson, for his help as I wrote the first chapters of
this book. He helped me get up to speed quickly on writing the chapters.
While I was writing this book, both Jody and Brian left to take other positions. Emi
Smith became my new acquisitions editor. I need to thank Emi for gathering all the
permissions necessary to include all the programs on the CD-ROM and for putting
up with delays in the project. Thanks to my copy editor, Alice Martina Smith, for
cleaning up some of my grammar and for bringing up questions that made the text
of this book easier for you to understand. I would also like to thank my Tech Editor,
Darrell Walisser, for reviewing all the source code in this book and making sure it all
runs well.
Next, I owe a huge Thank You to Carlos Camacho, the editor of the Mac game pro-
gramming site iDevGames, for two reasons. First, he let me write some articles for his
site, which is how Premier Press found me. Without his Web site, I wouldn’t be writ-
ing this book. Second, he donated artwork, music, and sound effects for the CD-
ROM that accompanies this book. His donation will make it easier for you to make
your own games, improving the book in the process.
I had many programming questions as I wrote the code for the book. I would like to
thank everyone who answered my questions on various mailing lists and message
boards. I don’t have a list of individuals who helped, but you know who you are.
00 Macgame_FM.qxd 2/21/03 5:02 PM Page viii
The CD-ROM that is with this book comes packed with development tools, games,
source code, and game assets. I would like to thank everyone who graciously let me
include their programs on the CD-ROM. You have helped make this book as good as
it can possibly be.
Finally, I want to thank my family for helping keep me sane while I wrote the book.
To my parents Stan and Mary, my brothers Dave and Steve, my sister Kathy, her hus-
band John, and my nephews Zachary and Christian, thank you.
00 Macgame_FM.qxd 2/21/03 5:02 PM Page ix
Contents at a Glance
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . xxviii
Chapter 1
Introduction to the Mac and to
Game Programming . . . . . . . . . . . . . . . . . . . . . . . 1
Chapter 2
Project Builder . . . . . . . . . . . . . . . . . . . . . . . . 27
Chapter 3
C++ for C Programmers. . . . . . . . . . . . . . . . . . . 59
Chapter 4
Introduction to
Macintosh Graphics . . . . . . . . . . . . . . . . . . . . . . 77
Chapter 5
Tiles and Scrolling. . . . . . . . . . . . . . . . . . . . . . 113
Chapter 6
Animation. . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
Chapter 7
InputSprocket. . . . . . . . . . . . . . . . . . . . . . . . . 197
Chapter 8
HID Manager . . . . . . . . . . . . . . . . . . . . . . . . . 233
Chapter 9
Reading the Keyboard and Mouse
Plus Event Handling . . . . . . . . . . . . . . . . . . . . 297
00 Macgame_FM.qxd 2/21/03 5:02 PM Page xi
Contents at a Glance xi
Chapter 10
Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
Chapter 11
Physics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391
Chapter 12
Beginning Artificial Intelligence . . . . . . . . . . . . 455
Chapter 13
Pathfinding . . . . . . . . . . . . . . . . . . . . . . . . . . 491
Chapter 14
DrawSprocket . . . . . . . . . . . . . . . . . . . . . . . . 545
Chapter 15
Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585
Chapter 16
Putting It All Together . . . . . . . . . . . . . . . . . . 639
Chapter 17
Understanding the Game’s Source Code . . . . . . . 675
Chapter 18
Optimization . . . . . . . . . . . . . . . . . . . . . . . 717
Chapter 19
Game Development Tips . . . . . . . . . . . . . . . . . . 763
Appendix A
Installing Programs from the CD-ROM . . . . . . . . 797
Appendix B
Game Development Resources . . . . . . . . . . . . . . 801
Appendix C
CD-ROM Contents . . . . . . . . . . . . . . . . . . . . . . 813
00 Macgame_FM.qxd 2/21/03 5:02 PM Page xii
xii
Contents
Foreword . . . . . . . . . . . . . . . . . . . . . . . vi
Letter from the Series Editor. . . . . . . . xxxi
Introduction . . . . . . . . . . . . . . . . . . . xxxiii
Chapter 1
Introduction to the Mac and to
Game Programming . . . . . . . . . . . . 1
A Brief History of the Mac OS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Mac Programming Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Mac Toolbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Carbon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Cocoa . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Programming with Carbon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
What to Place in Your System Folder. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
What to Place in Your Compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
A Description of the Game We Will Develop . . . . . . . . . . . . . . . . . . . 12
Elements of a Computer Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Player Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Physics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Game Event Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
00 Macgame_FM.qxd 2/21/03 5:02 PM Page xiii
Contents xiii
Chapter 2
Project Builder . . . . . . . . . . . . . 27
Creating Your First Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Your First Real Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Creating Source Code Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Adding Files to a Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Adding Frameworks to a Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Contents List Tabs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Files Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Classes Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Bookmarks Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Targets Tab. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Breakpoints Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Action Panel Tabs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Find Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Build Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Run Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Debug Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
00 Macgame_FM.qxd 2/21/03 5:02 PM Page xiv
xiv Contents
Compiling a Project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Debugging a Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Setting Breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
A Debugging Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Chapter 3
C++ for C Programmers . . . . . . . 59
Structured vs. Object-Oriented Programming . . . . . . . . . . . . . . . . . . 61
Structured Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Object-Oriented Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Data Members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Member Functions: Constructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Member Functions: Destructors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Member Functions: Accessors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Member Functions: General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Inheritance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Virtual Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Private, Protected, and Public Keywords . . . . . . . . . . . . . . . . . . . . . . 71
Dynamic Memory Allocation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Converting the Book Code to C from C++ . . . . . . . . . . . . . . . . . . . . 75
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Chapter 4
Introduction to
Macintosh Graphics. . . . . . . . . . . 77
Macintosh Color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
8-Bit Color Pixels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
00 Macgame_FM.qxd 2/21/03 5:02 PM Page xv
Contents xv
Chapter 5
Tiles and Scrolling. . . . . . . . . . . 113
Introduction to Tiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Storing Tiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Storing Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Finding a Tile’s Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Drawing Tiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
00 Macgame_FM.qxd 2/21/03 5:02 PM Page xvi
xvi Contents
Chapter 6
Animation . . . . . . . . . . . . . . . . 155
Introduction to Sprites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Generating Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Storing Sprites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Creating Transparency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
Drawing Sprites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
Sprite Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Creating the AnimationController Class . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Updating the Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Handling Movement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Handling Attacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Handling Standing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Maneuvering the Sprite through the Game World. . . . . . . . . . . . . . 176
Moving Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Moving Down . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
00 Macgame_FM.qxd 2/21/03 5:02 PM Page xvii
Contents xvii
Chapter 7
InputSprocket. . . . . . . . . . . . . . 197
Introduction to InputSprocket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
Setting Up Your Game to Use InputSprocket. . . . . . . . . . . . . . . . . . 200
What to Place in Your System Extensions Folder . . . . . . . . . . . . . . . . . . . . 200
What to Place in Your Compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
InputSprocket Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
InputSprocket Programming. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
InputSprocket Terminology. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
The InputController Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
Starting InputSprocket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
Determining the Version of InputSprocket the Player Has . . . . . . . . . . . . . 210
Initializing InputSprocket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Letting the User Configure the Controls . . . . . . . . . . . . . . . . . . . . . . . . . . 220
Reading Button Presses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
Reading Player Movement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
Pausing and Resuming InputSprocket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
Quitting InputSprocket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
00 Macgame_FM.qxd 2/21/03 5:02 PM Page xviii
xviii Contents
Chapter 8
HID Manager . . . . . . . . . . . . . . 233
Introduction to the HID Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
Setting Up Your Game to Use the HID Manager . . . . . . . . . . . . . . . 236
Programming with the HID Manager . . . . . . . . . . . . . . . . . . . . . . . . 236
HID Manager Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
HID Manager Version of the InputController Class . . . . . . . . . . . . . . . . . . 245
Finding the Player’s HID-Capable Devices . . . . . . . . . . . . . . . . . . . . . . . . . 247
Creating Device Interfaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
Opening a Connection to the Input Device . . . . . . . . . . . . . . . . . . . . . . . . 252
Reading Button Presses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
Reading Digital Movement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
Reading Analog Movement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
Configuring Controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
Setting Default Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
Pausing and Resuming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Cleaning Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
Chapter 9
Reading the Keyboard and Mouse
Plus Event Handling . . . . . . . . . 297
Reading the Keyboard Directly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
Reading the Mouse Directly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
Reading the Mouse Location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
Reading the Mouse Button. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
Using the Classic Event Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
00 Macgame_FM.qxd 2/21/03 5:02 PM Page xix
Contents xix
Chapter 10
Sound. . . . . . . . . . . . . . . . . . . 345
A Sound Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
Sound Formats. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
Sampled Sounds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
Programming Sound with the Sound Manager. . . . . . . . . . . . . . . . . 355
The GameSound Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
Playing a Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
Sound Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
Callback Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362
Looping a Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
Setting a Sound’s Volume . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
Pausing a Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
Resuming a Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
Stopping a Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
Cleaning Up . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
Low-Level Sound Playing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
00 Macgame_FM.qxd 2/21/03 5:02 PM Page xx
xx Contents
Chapter 11
Physics . . . . . . . . . . . . . . . . . . 391
Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392
Vector Sums and Differences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
Multiplication by a Scalar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397
Dot Product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
Unit Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
Parallel and Orthogonal Vectors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
Linear Motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
Position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
Velocity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
Acceleration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406
Force . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
Center of Mass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
Calculating the Total Linear Momentum . . . . . . . . . . . . . . . . . . . . . . . . . . . 411
00 Macgame_FM.qxd 2/21/03 5:02 PM Page xxi
Contents xxi
Chapter 12
Beginning Artificial Intelligence . . 455
Introduction to Game AI. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456
Our AI System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458
00 Macgame_FM.qxd 2/21/03 5:02 PM Page xxii
xxii Contents
Chapter 13
Pathfinding . . . . . . . . . . . . . . . 491
Introduction to Pathfinding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492
The A* Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493
A* Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495
Estimating the Path Cost . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508
Coding the A* Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509
Weaknesses of the A* Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523
The Iterative Deepening A* Algorithm . . . . . . . . . . . . . . . . . . . . . . . 524
Coding the Iterative Deepening A* Algorithm . . . . . . . . . . . . . . . . . . . . . . 526
Coding the Depth-First Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527
00 Macgame_FM.qxd 2/21/03 5:02 PM Page xxiii
Contents xxiii
Chapter 14
DrawSprocket . . . . . . . . . . . . . 545
Introduction to DrawSprocket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546
DrawSprocket vs. QuickTime. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547
Draw Contexts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 548
Setting Up DrawSprocket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 548
What to Place in Your System Folder. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549
What to Place in Your Compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549
Programming with DrawSprocket . . . . . . . . . . . . . . . . . . . . . . . . . . 550
The DrawContext Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551
Starting DrawSprocket. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552
Setting a Draw Context’s Needs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552
Maintaining the Current Screen Resolution . . . . . . . . . . . . . . . . . . . . . . . . 556
Selecting a Draw Context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557
Multiple Monitor Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 560
Making a List of All Draw Contexts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564
Activating a Draw Context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
Dealing with Questionable Resolutions . . . . . . . . . . . . . . . . . . . . . . . . . . . 566
Pausing and Resuming Draw Contexts. . . . . . . . . . . . . . . . . . . . . . . . . . . . 570
Gamma Fades . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 571
Event Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573
Manipulating Color Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574
00 Macgame_FM.qxd 2/21/03 5:02 PM Page xxiv
xxiv Contents
Chapter 15
Files . . . . . . . . . . . . . . . . . . . 585
Introduction to Navigation Services . . . . . . . . . . . . . . . . . . . . . . . . . 586
Opening Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588
Navigation Services Dialog Box Options . . . . . . . . . . . . . . . . . . . . . . . . . . 591
Event Handlers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595
Navigation Type Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597
After You Get the File to Open . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597
Saving Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599
Data and Resource Forks of a File . . . . . . . . . . . . . . . . . . . . . . . . . . 603
Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604
Common Apple-Defined Resource Types . . . . . . . . . . . . . . . . . . . . . . . . . . 605
Creating Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607
Writing Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608
Reading Resources. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 610
A Resource Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612
Writing to the Data Fork . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 616
Reading from the Data Fork . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 621
Bundles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 623
A Bundle’s Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 624
Creating a Bundle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626
Finding the Application’s Main Bundle. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626
Extracting Resources from a Bundle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 627
Another Random Document on
Scribd Without Any Related Topics
CHAPTER XXXV
They were in the great sombre dining-room, with the almost black
tapestries, with the almost black panels of the ceiling, with the almost black
oak carvings, with the black, monumental chimney-piece and, above it, the
arms of the family in black marble. The light of two tall silver candle-sticks
on the table merely cast a gleam over the damask and crystal, but left the
remainder of the too large room in a gloomy obscurity of shadow, piled in
the corners into masses of densest shadow, with a fainter shadow
descending from the ceiling like a haze of dark velvet that floated in atoms
above the candlelight. The ancestral antiquity of San Stefano hovered above
them in this room like a palpable sense of awe, blended with a melancholy
of black silence and black pride. Here their words sounded muffled. This
still remained as it always had been, retaining as it were the sacrosanctity of
their aristocratic traditions, in which Urania would never dare to alter
anything, even as she hardly ventured to open her mouth to speak or eat.
They waited for a moment. Then a double door was opened. And there
entered like a spectral shade an old, grey man, with his arm in the arm of
the priest walking beside him. Old Prince Ercole approached with very slow
and stately steps, while the chaplain regulated his pace by that stately
slowness. He wore a long black coat of an old-fashioned, roomy cut, which
hung about him in folds, something like a cassock, and on his silvery grey
hair, which waved over his neck, a black-velvet skull-cap. And the others
approached him with the greatest respect: first the marchesa; then Urania,
whom he kissed on the forehead, very slowly, as though he were
consecrating her; then Gilio, who submissively kissed his father’s hand. The
old man nodded to young Hope, who bowed, and glanced towards Cornélie.
Urania presented her. And the prince said a few amiable words to her, as
though he were granting an audience, and asked her if she liked Italy. When
Cornélie had replied, Prince Ercole sat down and handed his skull-cap to
Giuseppe, who took it with a deep bow. Then they all sat down: the
marchesa and the chaplain opposite Prince Ercole, who sat between
Cornélie and Urania; Gilio next to Cornélie; Bob Hope next to his sister:
“Papa nearly had a stroke, because old Hope haggled over Urania’s dowry.
Ten millions? Five millions? Not three millions! Dollars? No, lire!”
And the prince suddenly struck her as the grey-haired egoism of San
Stefano’s glory and aristocratic pride, struck her as the living shade of the
past that loomed behind him, as she had felt it that afternoon, when she
stood gazing with Urania into the deep, blue lake: an exacting shade; a
shade demanding millions; a shade demanding a new increment of vitality;
a spectral parasite who had sold his depreciated symbols to gratify the
vanity of a new commercial house, but who, in his distinction, had been no
match for the merchant’s cunning. Their title of princess and duchess for
less than three million lire! Papa had almost had a stroke, Gilio had said.
And Cornélie, during the measured, affable stiffness of the conversation led
by Prince Ercole, looked from the old prince and duke, seventy years of
age, to the breezy young Far-Westerner, aged eighteen, and from him to
Prince Gilio, the hope of the old house, its only hope. Here, in the gloom of
this dining-room, where he was bored and moreover still out of temper, he
seemed small, insignificant, shrunken, a paltry, distinguished little viveur;
and his carbuncle eyes, which could sparkle merrily with wit and depravity,
now looked dully, from under their drooping lids, upon his plate, at which
he picked without appetite.
She felt sorry for him; and her mind went back to the golden bridal
chamber. She despised him a little. She looked upon him not so much as a
man who could not obtain what he wanted but rather as a naughty boy. And
he must feel jealous of Bob, she reflected: jealous of his young blood,
which tingled in his cheeks, of his broad shoulders and his broad chest. But
still he amused her. He could be very agreeable, gay and witty and
vivacious, when in the mood, vivacious in his words and in his wits. She
liked him, when all was said. And then he was good-hearted. She thought of
the bracelet and especially the thousand lire, always remembered, with a
certain emotion, how touched she had been during that walk up and down
past the post-office, how touched by his letter and his generous assistance.
He had no backbone, he was not a man to her; but he was witty and he had
a very good heart. She liked him as a friend and a pleasant companion. How
dejected and moody he was! But then why would he venture on those silly
enterprises?...
She spoke to him now and again, but could not succeed in rousing him from
his depression. For the rest, the conversation dragged on stiffly and affably,
always led by Prince Ercole. The dinner came to an end; and Prince Ercole
rose from his chair. Giuseppe handed him his skull-cap; every one said
good-night to him; the doors were opened and Prince Ercole withdrew,
leaning on his chaplain’s arm. Gilio, still angry, disappeared. The marchesa,
still terrified of Cornélie, also disappeared, making the jettatura at her in
the folds of her dress. And Urania took Cornélie and Bob back with her to
her own drawing-room. They all three breathed again. They all talked
freely, in English: the boy said in despair that he wasn’t getting enough to
eat, that he dared not eat enough to stay his hunger; and Cornélie laughed,
thinking him jolly, because of his wholesomeness, while Urania hunted out
some biscuits for him and a piece of cake left over from tea and promised
that he should have some cold meat and bread before they went to bed. And
they relaxed their minds after the pompous, stately meal. Urania said that
the old prince never appeared except at dinner, but that she always looked
him up in the morning and sat talking to him for an hour or playing chess
with him. At other times he played chess with the chaplain. She was very
busy, Urania. The reorganizing of the housekeeping, which used to be left to
a poor relation, who now lived at a pension in Rome, took up a lot of her
time. In the mornings, she discussed a host of details with Prince Ercole,
who, notwithstanding his secluded life, knew about everything. Then she
had consultations with her architect from Rome about the restorations to be
effected in the castle: these consultations were sometimes held in the old
prince’s study. Then she was having a big hostel built in the town, an
albergo dei poveri, a hostel for old men and women, for which old Hope
had given her a separate endowment. When she first came to San Stefano
she had been struck by the ruinous, tumbledown houses and cottages of the
poorer quarters, leprous and scabby with filth, eaten up by their own
poverty, in which a whole population vegetated like toadstools. She was
now building the hostel for the old people, finding work on the estate for
the young and healthy and looking after the neglected children; she had
built a new school-house. She talked about all this very simply, while
cutting cake for her brother Bob, who was tucking in after his formal
dinner. She asked Cornélie to come with her one morning to see how the
albergo was progressing, to see the new school, run by two priests who had
been recommended to her by the monsignori.
Through the pointed windows the town loomed faintly in the depths below;
and the lines of the cathedral rose high into the sultry, star-spangled night.
And Cornélie thought to herself:
“It was not only for a shadow and an unsubstantial shade that she came
here, the rich American who thought titles ‘so nice,’ the child who used to
collect patterns of the queen’s ball-dresses—she hides the album now that
she is a ‘black’ princess—the girl who used to trip through the Forum in her
white-serge tailor-made, without understanding either ancient Rome or the
dawn of the new future.”
And, as Cornélie went to her own room through the silent heavy darkness
of the Castle of San Stefano, she thought:
“I write, but she acts. I dream and think; but she teaches the children,
though it be with the aid of a priest; she feeds and houses old men and
women.”
Then, in her room, looking out at the lake under the summer night all
dusted with stars, she reflected that she too would like to be rich and to
have a wide field of labour. For now she had no field, now she had no
money and now ... now she longed only for Duco; and he must not leave
her too long alone in this castle, amid all this sombre greatness, which
oppressed her as with the weight of the centuries.
CHAPTER XXXVI
“Look here, prince, there must be an end of this ill-temper of yours. Do you
hear? It’s got to finish. I insist. I won’t have any more sulking to-day; and I
hope that you’ll go back to your cheerful, witty style of conversation as
soon as possible, for that’s what I like in you.”
He mumbled something.
“But why?”
“Because I don’t care for you as a host.”
“Me?”
“Yes, you. Yesterday you insult me. I defend myself, you go on being rude,
I at once become as amiable as ever, I give you my hand, I even give you a
kiss. At dinner you sulk with me in the most uncivil fashion. You go to bed
without bidding me good-night. This morning you meet me without a word
of greeting. You grunt, sulk and mumble like a naughty child. Your eyes are
blazing with anger, you are yellow with spleen. Really, you’re looking very
bad. It doesn’t suit you at all. You are most unpleasant, rough, rude and
petty. I have no inclination to breakfast with you in that mood. And I’m
going to my room.”
“No,” he implored.
“Yes, I am.”
“No, no!”
“Then be different. Make an effort, don’t think any more about your defeat
and be nice to me. You’re behaving as the offended party, whereas it is I
who ought to take offence. But I don’t know how to sulk and I am not petty.
I can’t behave pettily. I forgive you; do you forgive me too. Say something
nice, say something pleasant.”
“You don’t show it. If you’re mad about me, be pleasant, civil, gay and
witty. I demand it of you as my host.”
“I won’t sulk any longer ... but I do love you so! And you struck me!”
“No, never!”
“Then good-bye.”
She turned to go.
“No, no, don’t go back. Come to breakfast in the pergola. I apologize, I beg
your pardon. I won’t be rude again, I won’t be petty. You are not petty. You
are the most wonderful woman I ever met. I worship you.”
His eyes, his black carbuncle eyes, began to light up again, to laugh; his
face lost its wrinkles and cheered up.
“Poor prince!”
“You just won’t believe me. You never take me seriously. I have to be your
clown, your buffoon. And I love you and have nothing to hope for. Tell me,
mayn’t I hope?”
“Not much.”
“I have to be severe with you: you are just like a naughty boy.... Oh, I see
the pergola! Do you promise to improve?”
“I shall be good.”
“And amusing?”
He heaved a sigh:
Breakfast was a sunny and cheerful meal, after yesterday’s dark and gloomy
dinner. Urania talked vivaciously about her albergo, which she was going to
visit presently with Cornélie, Gilio recovered his amiability and Bob ate
heartily. And, when Bob went off bicycling, Gilio even accompanied the
ladies to the town. They drove at a foot-pace in a landau down the castle
road. The sun grew hotter and the little old town lit up, with whitish-grey
and creamy-white houses like stone mirrors, in which the sun reflected
itself, and little open spaces like walls, into which the sun poured its light.
The coachman pulled up outside the partly-finished albergo. They all
alighted; the contractor approached ceremoniously; the perspiring masons
looked round at the prince and princess. The heat was stifling. Gilio kept on
wiping his forehead and sheltered under Cornélie’s parasol. But Urania was
all vivacity and interest; quick and full of energy in her white-piqué
costume, with her white sailor-hat under her white sun-shade, she tripped
along planks, past heaps of bricks and cement and tubs full of mortar,
accompanied by her contractor. She made him explain things, proffered
advice, disagreed with him at times and pulled a wise face, saying that she
did not like certain measurements and refused to accept the contractor’s
assurance that she would like the measurements as the building progressed;
she shook her head and impressed this and that upon him, all in a quick,
none too correct, broken Italian, which she chewed between her teeth. But
Cornélie thought her charming, attractive, every inch the Princess di Forte-
Braccio. There was not a doubt about it. While Gilio, fearful of dirtying his
light flannel suit and brown shoes with the mortar, remained in the shadow
of her parasol, puffing and blowing with the heat and taking no interest
whatever, his wife was untiring, did not trouble to think that her white skirt
was becoming soiled at the hem and spoke to the contractor with a lively
and dignified certainty which compelled respect. Where had the child learnt
that? Where had she acquired her powers of assimilation? Where did she
get this love for San Stefano, this love for its poor? How had the American
girl picked up this talent for filling her new and exalted position so
worthily? Gilio thought her admirabile and whispered as much to Cornélie.
He was not blind to her good qualities. He thought Urania splendid,
excellent; she always astounded him. No Italian woman of his own set
would have been like that. And they liked her. The servants at the castle
loved her. Giuseppe would have gone through fire and water for her; that
contractor admired her; the masons followed her respectfully with their
eyes, because she was so clever and knew so much and was so good to
them in their poverty.
But he puffed and blowed. He knew nothing about bricks, beams and
measurements and did not understand where Urania had got that technical
sense from. She was indefatigable. She went all over the works, while he
cast up his eyes to Cornélie in entreaty. And at last, speaking in English, he
begged his wife in Heaven’s name to come away. They went back to the
carriage; the contractor took off his hat, the workmen raised their caps with
an air of mingled gratitude and independence. And they drove to the
cathedral, which Cornélie wanted to see. Urania showed her round. Gilio
asked to be excused and went and sat on the steps of the altar, with his
hands hanging over his knees, to cool himself.
CHAPTER XXXVII
A week had passed. Duco had arrived. After the solemn dinner in the
gloomy dining-room, where Duco had been presented to Prince Ercole, the
summer evening, when Cornélie and Duco went outside, was like a dream.
The castle was already wrapped in heavy repose; but Cornélie had made
Giuseppe give her a key. And they went out, to the pergola. The stars dusted
the night sky with a pale radiance; and the moon crowned the hill-tops and
shimmered faintly in the mystic depths of the lake. A breath of sleeping
roses was wafted from the flower-garden beyond the pergola; and below, in
the flat-roofed town, the cathedral, standing in its moonlit square, lifted its
gigantic fabric to the stars. And sleep hung everywhere, over the lake, over
the town and behind the windows of the castle; the caryatides and hermes—
the satyrs and nymphs—slept, as they bore the leafy roof of the pergola, in
the enchanted attitudes of the servants of the Sleeping Beauty. A cricket
chirped, but fell silent the moment that Duco and Cornélie approached. And
they sat down on an antique bench; and she flung her arms about his body
and nestled against him:
She was silent and lay against his breast. The cricket chirped again, with a
long quaver. But everything else slept....
“Between us,” she repeated, as though in a fever; and she embraced him
passionately.
The whole night slept; and, while they breathed their life in each other’s
arms, the enchanted caryatides—fauns and nymphs—lifted the leafy roof of
the pergola above their heads, between them and the star-spangled sky.
CHAPTER XXXVIII
Urania was disconcerted, but Duco went on, interrupted the architect,
advised him to build up only what was actually falling to pieces, and, so far
as possible, to confine himself to underpinning, reinforcing and preserving.
And one morning Prince Ercole deigned to walk through the long rooms
with Duco, Urania and Cornélie. There was a great deal to be done, Duco
considered, by merely repairing and artistically arranging what at present
stood thoughtlessly huddled together.
“Let them be,” Duco considered. “At the most, new window-curtains; but
the old red Venetian damask; oh, let it be, let it be!”
Gilio had followed the advice of his cousin, the Countess di Rosavilla.
Immediately after dinner, he had stolen outside; and he walked along the
pergola to the rotunda, into which the moonlight fell as into a white beaker.
But there was shadow behind a couple of caryatides; and here he hid. He
waited for an hour. But the night slept, the caryatides slept, standing
motionless and supporting the leafy roof. He uttered a curse and stole
indoors again. He walked down the corridors on tiptoe and listened at Van
der Staal’s door. He heard nothing, but perhaps Van der Staal was asleep?...
Gilio, however, crept along another corridor and listened at Cornélie’s door.
He held his breath.... Yes, there was a sound of voices. They were together!
Together! He clenched his fists and walked away. But why did he excite
himself? He knew all about their relations. Why should they not be together
here? And he went on and tapped at the countess’ door....
Next evening he again waited in the rotunda. They did not come. But, a few
evenings later, as he sat waiting, choking with annoyance, he saw them
come. He saw Duco lock the terrace-door behind him: the rusty lock grated
in the distance. Slowly he saw them walk along and approach in the light,
disappearing from view in the shadow, reappearing in the moonlight. They
sat down on the marble bench....
How happy they seemed! He was jealous of their happiness, jealous above
all of him. And how gentle and tender she was, she who considered him,
Gilio, only good enough for her amusement, to flirt with, a clown: she, the
devilish woman, was angelic to the man she loved! She bent towards her
lover with a smiling caress, with a curve of her arm, with a proffering of her
lips, with something intensely alluring, with a velvety languor of love
which he would never have suspected in her, after her cold, jesting flirtation
with him, Gilio. She was now leaning on Duco’s arms, on his breast, with
her face against his.... Oh, how her kiss filled Gilio with flame and fury!
This was no longer her icy lack of sensuous response towards him, Gilio, in
the camera degli sposi. And he could restrain himself no longer: he would
at least disturb their moment of happiness. And, quivering in every nerve,
he stepped from behind the caryatides and went towards them, through the
rotunda. Lost in each other’s eyes, they did not see him at once. But,
suddenly, simultaneously, they both started; their arms fell apart then and
there; they sprang up in one movement; they saw him approaching but
evidently did not at once recognize him. Not until he was closer did they
perceive who he was; and they looked at him in startled silence, wondering
what he would say. He made a satirical bow:
“A delightful evening, isn’t it? The view is lovely, like this, at night, from
the pergola. You are right to come and enjoy it. I hope that I am not
disturbing you with my unexpected company?”
His tremulous voice sounded so spiteful and aggressive that they could not
doubt the violence of his anger.
“At this hour! What do you mean, prince, what are you suggesting?”
Cornélie caught Duco by the arm; the prince cursed and clenched his fists.
“Prince,” she said, “you have obviously come to pick a quarrel with us.
Why? What objection can you have to my meeting Van der Staal here in the
evening? In the first place, our relation towards each other is no secret for
you. And then I think it unworthy of you to come spying on us.”
And, blind with rage, he flew at Duco’s throat. The attack was so
unexpected that Duco stumbled. They both wrestled furiously. All their
hidden antipathy broke forth in fury. They did not hear Cornélie’s
entreaties, they struck each other with their fists, they grappled with arms
and legs, breast to breast. Then Cornélie saw something flash. In the
moonlight she saw that the prince had drawn a knife. But the very
movement was an advantage to Duco, who gripped his wrist as in a vice,
forced him to the ground and, pressing his knee on Gilio’s chest, took him
by the throat with his other hand.
The knife dropped from his fingers. Duco grasped it and rose to his feet:
“Get up,” he said, “we can continue this fight, if you like, to-morrow, under
less primitive conditions: not with a knife, but with swords or pistols.”
The prince stood panting, blue in the face.... When he came to himself, he
said, slowly:
“No, I will not fight a duel. Unless you want to. But I don’t. I am defeated.
She has a demoniacal force which would always make you win, whatever
game we played. We’ve had our duel. This struggle tells me more than a
regular duel would. Only, if you want to fight me, I have no objection. But I
now know for certain that you would kill me. She protects you.”
“Then let us look on this struggle as a duel and now give me your hand.”
“We have to forgive each other. I forgive you the blow you struck me.”
“I forgive you nothing. I shall never forgive you this evening’s work: not
your spying, nor your lack of self-control, nor the rights which you try to
claim from me, an unmarried woman—whereas I allow you no rights
whatever—nor your attack, nor your knife.”
“I am also an Italian.”
“I remind you of everything that might make you more gently disposed
towards me.”
“It is no use.”
“Enemies then?”
They walked up the pergola. He himself opened the terrace-door and let
them in before him.
They went in silence to their rooms. The castle lay asleep in darkness. The
prince struck a match to light the way. Duco was the first to reach his room.
And without more she locked the door behind her. He remained on his
knees for another moment. Then he slowly rose to his feet. His throat hurt
him. His shoulder felt as though it were dislocated.
“It’s over,” he muttered. “I am defeated. She is stronger now than I, but not
because she is a devil. I have seen them together. I have seen their embrace.
She is stronger, he is stronger than I ... because of their happiness. I feel
that, because of their happiness, they will always be stronger than I....”
He went to his room, which adjoined Urania’s bedroom. His chest heaved
with sobs. Dressed as he was, he flung himself sobbing on his bed,
swallowing his sobs in the slumbering night that hung over the castle. Then
he got up and looked out of the window. He saw the lake. He saw the
pergola, where they had been fighting. The night was sleeping there; the
caryatides, sleeping, stood out white against the shadow. And his eyes
sought the exact spot of their struggle and of his defeat. And, with his
superstitious faith in their happiness, he became convinced that there would
be no fighting against it, ever.
Then he shrugged his shoulders, as if he were flinging a load off his back:
And he meant that to-morrow he would achieve, if not this victory, another.
Then, with eyes still moist, he fell asleep like a child.
CHAPTER XL
Urania sobbed nervously in Cornélie’s arms when she told the young
princess that she was leaving that morning. She and Duco were alone with
Urania in Urania’s own drawing-room.
“That’s impossible, my dear girl. Gilio has insulted me, Gilio drew his knife
against Duco; and those are two things which I can never forgive him. So it
is impossible for us to remain.”
“It’s all so empty!” she sobbed. “It means nothing to me. I need affection.
Who is there that is fond of me? I have tried to love Gilio and I do love him,
but he doesn’t care for me. Nobody cares for me.”
“Your poor are devoted to you. You have a noble aim in life.”
“I’m glad of it, but I am too young to live only for an aim. And I have
nothing else. Nobody cares for me.”
“No, he despises me. Listen. I told you once before what Gilio said ... that
there were no family-jewels, that they were all sold: you remember, don’t
you? Well, there are family-jewels. I gathered that from something the
Countess di Rosavilla said. There are family-jewels. But Prince Ercole
keeps them in the Banco di Roma. They despise me; and I am not thought
good enough to wear them. And to me they pretend that there are none left.
And the worst of it is that all their friends, all their set know that the jewels
are there, in the bank, and they all say that Prince Ercole is right. My money
is good enough for them, but I am not good enough for their old jewels, the
jewels of their grandmother!”
“It’s the truth!” sobbed Urania. “Oh, do make it up, stay a little longer, for
my sake!...”
“But his impetuousness, his anger, his jealousy are my fault. I am sorry
about it, Urania, because of you. Forgive me. Come and look me up in
Rome when you go back. Don’t forget me; and write, won’t you?... Now I
must go and pack my trunk. What time is the train?”
“Can I say good-bye to Prince Ercole? Send and ask if he can see me.”
“The first thing that comes into your head: that a friend of mine in Rome is
ill, that I am going to look after her and that Van der Staal is taking me back
because I am nervous travelling. I don’t care what Prince Ercole thinks.”
“Cornélie....”
“Darling, I really haven’t another moment. Kiss me and forgive me. And
think of me sometimes. Good-bye. We have had a delightful time together
and I have grown very fond of you.”
She tore herself from Urania’s embrace; Duco also said good-bye. They left
the princess sobbing by herself. In the passage they met Gilio.
But they went on and left him standing there, while Urania sat sobbing in
the drawing-room.
CHAPTER XLI
In the train, in the scorching morning heat, they were silent; and they found
Rome as it were bursting out of its houses in the blazing sunshine. The
studio, however, was cool, solitary and peaceful.
“Cornélie,” said Duco, “tell me what happened between you and the prince.
Why did you strike him?”
She pulled him down on the sofa, threw herself on his neck and told him the
incident of the camera degli sposi. She told him of the thousand lire and the
bracelet. She explained that she had said nothing about it before, so as not
to speak to him of financial worries while he was finishing his water-colour
for the exhibition in London:
“Duco,” she continued, “I was so frightened when I saw Gilio draw that
knife yesterday. I felt as if I was going to faint, but I didn’t. I had never seen
him like that, so violent, so ready to do anything.... It was then that I really
felt how much I loved you. I should have murdered him if he had wounded
you.”
“You ought not to have played with him,” he said, severely. “He loves you.”
Filled with a certain consciousness of guilt, she laid her head coaxingly on
his chest:
She made no further reply, merely stroked his face with her hand. She liked
him all the better for reproaching her as he did; she loved that stern, earnest
voice, which he hardly ever adopted towards her. She knew that she had
that need for flirting in her, that she had had it ever since she was a very
young girl; it did not count with her, it was only innocent fun. She did not
agree with Duco, but thought it unnecessary to go over the whole ground: it
was as it was, she didn’t think about it, didn’t dispute it; it was like a
difference of opinion, almost of taste, which did not count. She was lying
against him too comfortably, after the excitement of last evening, after a
sleepless night, after a precipitate departure, after a three hours’ railway-
journey in the blazing heat, to argue to any extent. She liked the silent
coolness of the studio, the sense of being alone with him, after her three
weeks at San Stefano. There was a peacefulness here, a return to herself,
which filled her with bliss. The tall window was open and the warm air
poured in beneficently and was tempered by the natural chilliness of the
north room. Duco’s easel stood empty, awaiting him. This was their home,
amid all that colour and form of art which surrounded them. She now
understood that colour and form; she was learning Rome. She was learning
it all in dreams of happiness. She gave little thought to the woman question
and hardly glanced at the notices of her pamphlet, taking but a scanty
interest in them. She admired Lippo’s angel, admired the panel of Gentile
da Fabriano and the resplendent colours of the old chasubles. It was very
little, after the treasures at San Stefano, but it was theirs and it was home.
She did not speak, felt happy and contented resting on Duco’s breast and
passing her fingers over his face.
He clasped her more tightly, to make her feel that he did not want to
grumble at her, even though he thought that she had done wrong. She
thought that she had done right not to mention the thousand lire to him, but
she did not defend herself. It meant useless words; and she felt too happy to
talk about money.
“Why?”
“What do you care about the opinion of ‘small, insignificant people, who
chance to cross your path,’ as you yourself say?”
“It’s different now. We owe the prince money; and Urania is the only friend
you have.”
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookname.com