100% found this document useful (2 votes)
38 views

Beginning Game Programming 1st Edition Jonathan S. Harbour instant download

The document provides links to download various game programming books by Jonathan S. Harbour and others, including titles on Java, Visual Basic, Python, OpenGL, and DirectX. It includes details about the 'Beginning Game Programming' book, such as its edition, file size, and publication year. Additionally, it features acknowledgments and a brief author biography highlighting Harbour's experience in game programming and writing.

Uploaded by

narozsoub
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 (2 votes)
38 views

Beginning Game Programming 1st Edition Jonathan S. Harbour instant download

The document provides links to download various game programming books by Jonathan S. Harbour and others, including titles on Java, Visual Basic, Python, OpenGL, and DirectX. It includes details about the 'Beginning Game Programming' book, such as its edition, file size, and publication year. Additionally, it features acknowledgments and a brief author biography highlighting Harbour's experience in game programming and writing.

Uploaded by

narozsoub
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/ 52

Beginning Game Programming 1st Edition Jonathan

S. Harbour pdf download

https://ebookfinal.com/download/beginning-game-programming-1st-
edition-jonathan-s-harbour/

Explore and download more ebooks or textbooks


at ebookfinal.com
We believe these products will be a great fit for you. Click
the link to download now, or visit ebookfinal
to discover even more!

Beginning Java SE 6 Game Programming 3rd Edition Jonathan


S. Harbour

https://ebookfinal.com/download/beginning-java-se-6-game-
programming-3rd-edition-jonathan-s-harbour/

Microsoft Visual Basic Game Programming for Teens 2nd


Edition Jonathan S.(Jonathan S. Harbour) Harbour

https://ebookfinal.com/download/microsoft-visual-basic-game-
programming-for-teens-2nd-edition-jonathan-s-jonathan-s-harbour-
harbour/

More Python Programming for the Absolute Beginner 1st


Edition Jonathan S. Harbour

https://ebookfinal.com/download/more-python-programming-for-the-
absolute-beginner-1st-edition-jonathan-s-harbour/

Microsoft Visual Basic NET Programming for the Absolute


Beginner 1st Edition Jonathan S. Harbour

https://ebookfinal.com/download/microsoft-visual-basic-net-
programming-for-the-absolute-beginner-1st-edition-jonathan-s-harbour/
Beginning OpenGL Game Programming 1st Edition Dave Astle

https://ebookfinal.com/download/beginning-opengl-game-programming-1st-
edition-dave-astle/

Beginning OpenGL Game Programming 1st Edition Dave Astle

https://ebookfinal.com/download/beginning-opengl-game-programming-1st-
edition-dave-astle-2/

Beginning DirectX 11 Game Programming 1st Edition Allen


Sherrod

https://ebookfinal.com/download/beginning-directx-11-game-
programming-1st-edition-allen-sherrod/

Beginning C Through Game Programming 4th Edition Michael


Dawson

https://ebookfinal.com/download/beginning-c-through-game-
programming-4th-edition-michael-dawson/

OpenGL Game Programming Prima Tech s Game Development 1st


Edition Kevin Hawkins

https://ebookfinal.com/download/opengl-game-programming-prima-tech-s-
game-development-1st-edition-kevin-hawkins/
Beginning Game Programming 1st Edition Jonathan S.
Harbour Digital Instant Download
Author(s): Jonathan S. Harbour
ISBN(s): 9781592005864, 1592005861
Edition: 1
File Details: PDF, 8.76 MB
Year: 2004
Language: english
TEAM LinG - Live, Informative, Non-cost and Genuine!
Beginning
Game Programming

Jonathan S. Harbour

TEAM LinG - Live, Informative, Non-cost and Genuine!


© 2005 by Thomson Course Technology PTR. All rights reserved. No SVP, Course Professional, Trade,
part of this book may be reproduced or transmitted in any form or by Reference Group:
any means, electronic or mechanical, including photocopying, record- Andy Shafran
ing, or by any information storage or retrieval system without written
Publisher:
permission from Thomson Course Technology PTR, except for the
Stacy L. Hiquet
inclusion of brief quotations in a review.
The Premier Press and Thomson Course Technology PTR logo and Senior Marketing Manager:
related trade dress are trademarks of Thomson Course Technology PTR Sarah O’Donnell
and may not be used without written permission. Marketing Manager:
Microsoft, Windows, DirectX, and Direct3D are either registered trade- Heather Hurley
marks or trademarks of Microsoft Corporation in the United States Manager of Editorial Services:
and/or other countries. Heather Talbot
Clip art images copyright JupiterImages. Acquisitions Editor:
All other trademarks are the property of their respective owners. Mitzi Koontz
Important: Thomson Course Technology PTR cannot provide software Senior Editor:
support. Please contact the appropriate software manufacturer’s techni- Mark Garvey
cal support line or Web site for assistance.
Associate Marketing Manager:
Thomson Course Technology PTR and the author have attempted Kristin Eisenzopf
throughout this book to distinguish proprietary trademarks from descrip-
tive terms by following the capitalization style used by the manufacturer. Marketing Coordinator:
Jordan Casey
Information contained in this book has been obtained by Thomson
Course Technology PTR from sources believed to be reliable. However, Project Editor and Copy Editor:
because of the possibility of human or mechanical error by our sources, Estelle Manticas
Thomson Course Technology PTR, or others, the Publisher does not Technical Reviewers:
guarantee the accuracy, adequacy, or completeness of any information Joshua Smith and Sebastien St-Laurent
and is not responsible for any errors or omissions or the results obtained
from use of such information. Readers should be particularly aware of PTR Editorial Services:
the fact that the Internet is an ever-changing entity. Some facts may have Elizabeth Furbish
changed since this book went to press. Interior Layout:
Educational facilities, companies, and organizations interested in multiple Argosy Publishing
copies or licensing of this book should contact the publisher for quantity
Cover Designer:
discount information. Training manuals, CD-ROMs, and portions of this
Mike Tanamachi
book are also available individually or can be tailored for specific needs.
CD-ROM Producer:
ISBN: 1-59200-585-3
Brandon Penticuff
Library of Congress Catalog Card Number: 2004109697
Printed in the United States of America Indexer:
04 05 06 07 08 BH 10 9 8 7 6 5 4 3 2 1 Larry Sweazy
Proofreader:
Kim Cofer

Course PTR, a division of Course Technology


25 Thomson Place
Boston, MA 02210
http://www.courseptr.com

TEAM LinG - Live, Informative, Non-cost and Genuine!


For my mother, Vicki Myrlene Harbour

TEAM LinG - Live, Informative, Non-cost and Genuine!


Acknowledgments

I am grateful to my wife, Jennifer, for allowing me to write while also working full time.
Thank you for being so supportive. I love you. I am also blessed to have two wonder-
ful kids, Jeremiah and Kayleigh, who help me take a break and play now and then. I
thank God for all of these blessings in life.
I am indebted to the hardworking editors, artists, and layout specialists at Course PTR and
to all of the freelancers for doing such a fine job. Many thanks to Estelle Manticas, Jenny
Davidson, Brandon Penticuff, Mitzi Koontz, and Emi Smith. Thanks go to Joshua Smith
and Sebastien St-Laurent for their technical review, which was very helpful. I believe you
will find this a true gem of a game programming book due to all of their efforts.
I want to send greetings to friends, co-workers, and relatives from whom I occasionally
derive inspiration (or is it consternation?). After all, I’m not working in a hole somewhere
(although sometimes it feels that way!). Thanks to the following for your friendship: Peter
Blue, Nathan Warthan, John Striker, Gerald “Dr. Ghastly” Winkler, Chris “Vermis” Henson,
Trammel “Banshee” Stevens, Matt Klein, Jennifer Whitwell, Matt Hamby, Wade and Lind-
sey Eutsey, Justin and Kim Galloway, Brandon and Emily Figg, Jason and Kelly Trisco. And
to the Friday night gang: could you please stahhhhp messing up the house? Just kidding!
This has been a very challenging year for many of my friends and co-workers due to the
tragic loss of two of our best. I want to remember a fellow gamer and friend who passed
away this year, Brian “Zonious” Parker, who worked as a WAN engineer. I also honor the
memory of Jason Ward, a fellow programmer and sports-car enthusiast. Rest in peace.

iv
TEAM LinG - Live, Informative, Non-cost and Genuine!
About the Author

Jonathan S. Harbour has been an avid gamer and programmer for 17 years, having
started with early systems like the Commodore PET, Apple II, and Tandy 1000. He holds
a bachelor of science degree in Computer Information Systems and has earned a position
as senior programmer with seven years of professional experience. He enjoys writing code
mainly in C, C++, and VB, and has experience with a wide variety of platforms, including
Windows, Linux, Pocket PC, and Game Boy Advance.
Jonathan has written six books on the subject of game programming. In addition to his
recent Game Programming All In One, 2nd Edition, he has also written Pocket PC Game
Programming, Microsoft Visual Basic Game Programming with DirectX, Microsoft Visual
Basic .NET Programming for the Absolute Beginner, Beginner’s Guide to DarkBASIC Game
Programming, and Programming the Game Boy Advance. He is currently working on his
next two books, Visual Basic Game Programming for Teens and The Black Art of Xbox Mods.
He maintains a Web site dedicated to game programming at www.jharbour.com.

v
TEAM LinG - Live, Informative, Non-cost and Genuine!
Contents

Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii

Part I: Windows Programming . . . . . . . . . . . . . . . . . . .1

Chapter 1 Getting Started with Windows and DirectX . . . . . . . . . . . . . 3


Welcome to the Adventure! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4
Let’s Talk about Compilers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
What’s Your Skill Level? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Where to Begin? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
An Overview of Windows Programming . . . . . . . . . . . . . . . . . . . . . . . .10
“Getting” Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Understanding Windows Messaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Multi-Tasking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Multi-Threading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Event Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
A Quick Overview of DirectX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17
What Is Direct3D? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
What You Have Learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .20

Chapter 2 Windows Programming Basics . . . . . . . . . . . . . . . . . . . . . . . 23


The Basics of a Windows Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24
Creating a Win32 Project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Understanding WinMain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
vi
TEAM LinG - Live, Informative, Non-cost and Genuine!
Contents vii

The Complete WinMain. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30


What You Have Learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33
On Your Own . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .34

Chapter 3 Windows Messaging and Event Handling . . . . . . . . . . . . . .35


Writing a Full-Blown Windows Program . . . . . . . . . . . . . . . . . . . . . . . .36
Understanding InitInstance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Understanding MyRegisterClass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Understanding WinProc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
What You Have Learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50
On Your Own . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .51

Chapter 4 The Real-Time Game Loop . . . . . . . . . . . . . . . . . . . . . . . . . . .53


What Is a Game Loop? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54
The Old WinMain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
WinMain and Looping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
The GameLoop Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .60
Source Code for the GameLoop Program. . . . . . . . . . . . . . . . . . . . . . . . . . . 61
What You Have Learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .68
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .68
On Your Own . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .69

Part II: DirectX Programming . . . . . . . . . . . . . . . . .71

Chapter 5 Your First DirectX Graphics Program . . . . . . . . . . . . . . . . . . .73


Getting Started with Direct3D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .74
The Direct3D Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Creating the Direct3D Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Taking Direct3D for a Spin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Direct3D in Fullscreen Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
What You Have Learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .89
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .89
On Your Own . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .90

Chapter 6 Bitmaps and Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .91


Surfaces and Bitmaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .92
The Primary Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94

TEAM LinG - Live, Informative, Non-cost and Genuine!


viii Contents

Secondary Offscreen Surfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95


The Create_Surface Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Loading Bitmaps from Disk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
The Load_Bitmap Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
What You Have Learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .109
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .110
On Your Own . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .110

Chapter 7 Drawing Animated Sprites . . . . . . . . . . . . . . . . . . . . . . . . .111


How to Draw Animated Sprites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .112
The Anim_Sprite Project. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Concept Art. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Animated Sprites Explained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
What You Have Learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .137
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .137
On Your Own . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .137

Chapter 8 Advanced Sprite Programming . . . . . . . . . . . . . . . . . . . . . .139


Drawing Transparent Sprites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .140
Creating a Sprite Handler Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Loading the Sprite Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
The Trans_Sprite Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Drawing a Tiled Sprite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .152
Capturing a Tile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
The Tiled_Sprite Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
What You Have Learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .158
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .158
On Your Own . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .158

Chapter 9 Jamming with DirectX Audio . . . . . . . . . . . . . . . . . . . . . . . .159


Using DirectSound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .160
Initializing DirectSound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Creating a Sound Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
Loading a Wave File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Playing a Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Testing DirectSound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .163
Creating the Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Creating the DirectX Audio Support Files . . . . . . . . . . . . . . . . . . . . . . . . . . 169
Tweaking the Framework Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
Adding the Game Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173

TEAM LinG - Live, Informative, Non-cost and Genuine!


Contents ix

Running the Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179


What You Have Learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .180
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .181
On Your Own . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .181

Chapter 10 Handling Input Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . .183


The Keyboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .184
DirectInput Object and Device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
Initializing the Keyboard. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Reading Key Presses. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
The Mouse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .188
Initializing the Mouse. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
Reading the Mouse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Paddle Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .190
The New Framework Code for DirectInput. . . . . . . . . . . . . . . . . . . . . . . . . 191
The Paddle Game Source Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Paddle Game Explained . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
What You Have Learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .206
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .206
On Your Own . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .207

Part III: 3D Programming . . . . . . . . . . . . . . . . . . . .209

Chapter 11 3D Graphics Fundamentals . . . . . . . . . . . . . . . . . . . . . . . . .211


Introduction to 3D Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . .212
The Three Steps to 3D Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
The 3D Scene . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Moving to the Third Dimension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
Grabbing Hold of the 3D Pipeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
The Vertex Buffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
Rendering the Vertex Buffer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
Creating a Quad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
The Textured Cube Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .226
Modifying the Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
The Cube_Demo Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
What’s Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
What You Have Learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .237
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .237
On Your Own . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .237

TEAM LinG - Live, Informative, Non-cost and Genuine!


x Contents

Chapter 12 Creating Your Own 3D Models with Anim8or . . . . . . . . . .239


Introducing Anim8or . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .240
Getting into 3D Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
The Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Installing Anim8or . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
Using Anim8or . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .247
Stock Primitives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
Manipulating Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
Manipulating the Entire Scene . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258
Creating the Car Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .263
The Wheels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
The Frame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
The Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
The Headlights and Taillights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
Creating a Scene . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .281
What You Have Learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .283
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .283
On Your Own . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .283

Chapter 13 Working with 3D Model Files . . . . . . . . . . . . . . . . . . . . . . .285


Converting 3D Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .286
Converting 3DS to X . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
Loading and Rendering a Model File . . . . . . . . . . . . . . . . . . . . . . . . .294
Loading an .X File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
Rendering a Complete Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
The Load_Mesh Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
What’s Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
What You Have Learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .304
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .304
On Your Own . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .305

Chapter 14 Complete Game Project . . . . . . . . . . . . . . . . . . . . . . . . . . . .307


Bash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .308
Playing the Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
Creating the Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
Printing Text Using a Bitmapped Font. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
Simple 3D Collision Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
Bash Source Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324

TEAM LinG - Live, Informative, Non-cost and Genuine!


Contents xi

What’s Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .325


What You Have Learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .325
Review Questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .325
On Your Own . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .325

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327

TEAM LinG - Live, Informative, Non-cost and Genuine!


Introduction

T his book will teach you everything you need to know to write games in C using
DirectX 9. Game programming is a challenge—it is difficult to learn and almost
impossible to fully master. This book takes away the mystery of game program-
ming using the tools of the trade: C and DirectX. You will learn how to harness the power
of Windows and DirectX to write both 2D and 3D games. And even though this is a begin-
ner’s book, I’ve placed an especially strong emphasis on some of the more advanced top-
ics in 3D programming.
In this book, you will learn how to write a simple Windows program. From there, you’ll
learn about the key DirectX components—Direct3D, DirectSound, and DirectInput—
and you’ll find out how to make use of these components while writing simple code at a
pace that will not leave you behind. Along the way, you will put the information you glean
from each chapter into a framework, or game library. After you have learned all you need
to know to write a simple game, you will do just that—write a game—and not just the
usual sprite-based game, either. You’ll write a complete, fully functional 3D game using
3D collision detection, with real 3D Studio models (converted to the .X format). You will
also learn how to create your own models using the popular and free Anim8or modeling
program (which is included on the CD-ROM).

What Will You Learn in This Book?


This book will teach you how to write a Windows program. You will also learn about
DirectX, and you will dive into Direct3D headfirst, learning all about surfaces, textures,
meshes, and 3D models. And that’s just the beginning!

xiii

TEAM LinG - Live, Informative, Non-cost and Genuine!


xiv Introduction

This book is dedicated to teaching the basics of game programming, and it will cover a lot
of subjects very quickly—you’ll need to be on your toes! I use a writing style that will
make the subjects easy to understand and I repeat key concepts and methods to nail the
points home. You will learn by practice, and will not struggle with any one subject because
you’ll use each tool and technique several times throughout the book.
Each chapter in this book can stand alone, so if you are particularly interested in a certain
subject, feel free to skip to the chapter that covers it. In order to build the game frame-
work, however, you really should read the chapters in order, as each chapter builds on the
information in the one before it. For example, in Chapter 7, you will learn about sprite
animation, and then in Chapter 8 you will learn about transparency.
In this book, I’ll spend a lot of time talking about 3D programming—in order to get to
the 3D material, a lot of information must be covered. I’ll cover the necessary advanced
topics in 3D programming fairly quickly. In order to load a 3D model, for instance, you
need to learn how to create a 3D model first, right? Well, you will learn just how to do that
in this book.
Anim8or is a powerful 3D modeling program; it is included on the CD-ROM that accom-
panies this book. You will learn how to use Anim8or in Chapter 12 to create a complete
model of a Hummer.
After you have learned the ropes of 3D modeling, you will need to learn how to convert
your 3D models to a format that Direct3D will understand. Chapter 13 explains how to
convert the models exported from Anim8or to the Direct3D format.

What Compiler Should You Use?


This book uses the C language and all examples are compiled with Microsoft Visual C++
6.0. You should be able to compile and run the programs using another Windows com-
piler, such as Borland C++Builder, or with another version of Visual C++ (5.0 and later
should work fine).

What about the Programming Language?


This book focuses on the C language, and you do need to know C in advance in order to
get along. This book is not a primer on C—I don't spend even a single paragraph trying
to teach you anything about the C language! Instead, I’ll make use of this very powerful,
low-level language to write games. If this is your first experience with the C language, you
will probably have a very hard time with the source code I’ll present. The examples and
source code are virtually all C. There is a small amount of C++ in some of the DirectX
chapters that require it, but you will not need to know anything about C++ in order to
follow along.

TEAM LinG - Live, Informative, Non-cost and Genuine!


Introduction xv

If you don’t have much experience with C, then I recommend that you read a C primer
before delving into this book, or keep one handy for those parts that confuse you. For a
good start in C, pick up C Programming for the Absolute Beginner, by Michael Vine
(Course PTR).

What about a Complete Game?


Beginning Game Programming is not a tutorial on how to program in C, and it is not a
DirectX reference. This book is all about game programming. You will learn the skills you
need to write complete 3D games in C and DirectX 9.
Bash demonstrates wireframe and solid rendering with Direct3D, and uses real 3D mod-
els created with Anim8or. Creating this game is not just a matter of typing in some source
code and compiling it, and then away you go. On the contrary—you need to create your
own 3D models for this game. I encourage this throughout the book because if you want
to master game programming, you must become proficient with a modeling package like
Anim8or (which is almost as feature-rich as 3ds max and Maya, for our purposes).
In this book you will actually see how the artwork for the Bash game is created. After
learning how to create your own models in Chapter 12, you will be able to enhance and
modify Bash to suit your own tastes by modifying the 3D models in Anim8or. How would
you like to add your own photos to be used as textures in the game? No problem—you
will learn how to do things like that, and much more, in this book.

Figure I.1 You will see how the models for Bash were created.

TEAM LinG - Live, Informative, Non-cost and Genuine!


PART I

Windows
Programming
Chapter 1
Getting Started with Windows and DirectX . . . . . . . . . . . . . . . . . . . . . . .3

Chapter 2
Windows Programming Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .23

Chapter 3
Windows Messaging and Event Handling . . . . . . . . . . . . . . . . . . . . . . . .35

Chapter 4
The Real-Time Game Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .53

TEAM LinG - Live, Informative, Non-cost and Genuine!


T his first part of the book provides an introduction to Windows programming,
which is the foundation you’ll need before heading into DirectX programming.
The four chapters in Part I will give you an overview of how Windows works,
explain how to write a simple Windows program, discuss the Windows messaging system,
and go over real-time programming by showing you how to create a non-interrupting
game loop.

TEAM LinG - Live, Informative, Non-cost and Genuine!


chapter 1

Getting Started with


Windows and DirectX

G ame programming is one of the most complicated forms of computer program-


ming you will ever endeavor to master. Games are as much works of art as they
are grand technical achievements. Many technically fantastic games go unno-
ticed and unappreciated, while less technically savvy games go on to widespread fame and
bring fortune to their makers. Regardless of your ultimate goals, game programming is
one of the most enjoyable hobbies that you could ever take up, and the results will frus-
trate and exhilarate you at the same time—I hope you’re ready for the adventure that is
about to begin! 3

TEAM LinG - Live, Informative, Non-cost and Genuine!


4 Chapter 1 ■ Getting Started with Windows and DirectX

This chapter provides the crucial information necessary to get started writing Windows
games; it leads into the next three chapters, which provide an overview of the mechanics
of a Windows program.
Here is what you will learn in this chapter:
■ How to put game programming into perspective.
■ How to choose the best compiler for your needs.
■ How to determine your skill level and realize what you need to learn.
■ How to get started learning about Windows programming.

Welcome to the Adventure!


Welcome to the adventure that is game programming! I have enjoyed playing and pro-
gramming games for many years, and probably share the same enthusiasm for this once-
esoteric subject that you do. Games—and by this I mean PC games—were once found
within the realm of Geek Land, where hardy adventurers would explore vast imaginary
worlds and then struggle to create similar worlds on their own. Meanwhile, out in the real
world, people were living normal lives: hanging out with friends, flirting, going to the
movies, cruising downtown.
Why did we gamers choose to miss out on all that fun? Because we thought it was more
fun to stare at pixels on the screen? Precisely! One man’s pixel is another man’s fantasy
world or outer space adventure. And the earliest games were little more than globs of pix-
els being shuffled around on the screen. Our imaginations filled in more details than we
often realized when we played the primitive games of the past.
So, what’s your passion? Or rather, what’s your favorite type of game? Is it a classic arcade
shoot-’em-up, a fantasy adventure, a real-time strategy game, a role-playing game, or a
sports-related game? I’d like to challenge you to design a game in your mind while read-
ing this book, and imagine how you might go about creating that game as you delve into
each chapter. This book was not written to give you a “warm fuzzy” feeling about game
development, with a few patchy code listings and directions on where to go next. I really
take the subject quite seriously, and prefer to give you a sense of completion upon finish-
ing the final chapter. This is a self-contained book to a certain degree, in that what you
will learn is applicable toward your own early game projects. What you will learn here will
allow you to write a complete game with enough quality that you may feel confident to
share it with others. What I will not do is give you a game engine or a sample game (per
se) and tell you to “go for it.”

TEAM LinG - Live, Informative, Non-cost and Genuine!


Welcome to the Adventure! 5

Let’s Talk about Compilers


The programs in this book will work with many compilers. For any particular program in
the chapters to follow, you can simply add the source code files into a project using what-
ever compiler and IDE (integrated development environment) that you prefer. Here are
some of the most popular Windows compilers that you may use to work through this
book (see Figures 1.1 and 1.2, also):
■ Microsoft Visual C++ (see Figure 1.1)
■ Borland C++ and C++Builder
■ Watcom C++
■ Bloodshed Dev-C++ (see Figure 1.2)
■ CodeWarrior C++
As is the case with most Windows compilers, more recent versions (for example, Visual
Studio .NET 2002 or 2003, or the free Visual C++ 2005 Express Edition) should work fine
with the source code in this book.

Figure 1.1 Microsoft Visual C++ 6.0

TEAM LinG - Live, Informative, Non-cost and Genuine!


Discovering Diverse Content Through
Random Scribd Documents
The Project Gutenberg eBook of
Fields, factories and workshops
This ebook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this ebook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

Title: Fields, factories and workshops


or, Industry combined with agriculture and brain work
with manual work

Author: kniaz Petr Alekseevich Kropotkin

Release date: January 20, 2021 [eBook #64353]


Most recently updated: October 18, 2024

Language: English

Credits: Turgut Dincer, John Campbell and the Online Distributed


Proofreading Team at https://www.pgdp.net (This file
was produced from images generously made available
by The Internet Archive)

*** START OF THE PROJECT GUTENBERG EBOOK FIELDS,


FACTORIES AND WORKSHOPS ***
TRANSCRIBER’S NOTE
Footnote anchors are denoted by [number], and the footnotes have been placed at the
end of each chapter.
The cover image was created by the transcriber and is placed in the public domain.
Some minor changes to the text are noted at the end of the book.
Fields, Factories
and
Workshops
OR

INDUSTRY COMBINED WITH AGRICULTURE


AND BRAIN WORK WITH MANUAL WORK

BY

P. KROPOTKIN

NEW, REVISED, AND ENLARGED EDITION

G. P. PUTNAM’S SONS
NEW YORK AND LONDON
1913
P R E FA C E .

Fourteen years have passed since the first edition of this book was
published, and in revising it for this new edition I found at my
disposal an immense mass of new materials, statistical and
descriptive, and a great number of new works dealing with the
different subjects that are treated in this book. I have thus had an
excellent opportunity to verify how far the previsions that I had
formulated when I first wrote this book have been confirmed by the
subsequent economical evolution of the different nations.
This verification permits me to affirm that the economical
tendencies that I had ventured to foreshadow then have only
become more and more definite since. Everywhere we see the same
decentralisation of industries going on, new nations continually
entering the ranks of those which manufacture for the world market.
Each of these new-comers endeavours to develop, and succeeds in
developing, on its own territory the principal industries, and thus
frees itself from being exploited by other nations, more advanced in
their technical evolution. All nations have made a remarkable
progress in this direction, as will be seen from the new data that are
given in this book.
On the other hand, one sees, with all the great industrial nations,
the growing tendency and need of developing at home a more
intensive agricultural productivity, either by improving the now
existing methods of extensive agriculture, by means of small
holdings, “inner colonisation,” agricultural education, and co-
operative work, or by introducing different new branches of intensive
agriculture. This country is especially offering us at this moment a
most instructive example of a movement in the said direction. And
this movement will certainly result, not only in a much-needed
increase of the productive forces of the nation, which will contribute
to free it from the international speculators in food produce, but also
in awakening in the nation a fuller appreciation of the immense
value of its soil, and the desire of repairing the error that has been
committed in leaving it in the hands of great land-owners and of
those who find it now more advantageous to rent the land to be
turned into shooting preserves. The different steps that are being
taken now for raising English agriculture and for obtaining from the
land a much greater amount of produce are briefly indicated in
Chapter V.
It is especially in revising the chapters dealing with the small
industries that I had to incorporate the results of a great number of
new researches. In so doing I was enabled to show that the growth
of an infinite variety of small enterprises by the side of the very
great centralised concerns is not showing any signs of abatement.
On the contrary, the distribution of electrical motive power has given
them a new impulse. In those places where water power was utilised
for distributing electric power in the villages, and in those cities
where the machinery used for producing electric light during the
night hours was utilised for supplying motive power during the day,
the small industries are taking a new development.
In this domain I am enabled to add to the present edition the
interesting results of a work about the small industries in the United
Kingdom that I made in 1900. Such a work was only possible when
the British Factory Inspectors had published (in 1898, in virtue of the
Factories Act of 1895) their first reports, from which I could
determine the hitherto unknown numerical relations between the
great and the small industries in the United Kingdom.
Until then no figures whatever as regards the distribution of
operatives in the large and small factories and workshops of Great
Britain were available; so that when economists spoke of the
“unavoidable” death of the small industries they merely expressed
hypotheses based upon a limited number of observations, which
were chiefly made upon part of the textile industry and metallurgy.
Only after Mr. Whitelegge had published the first figures from which
reliable conclusions could be drawn was it possible to see how little
such wide-reaching conclusions were confirmed by realities. In this
country, as everywhere, the small industries continue to exist, and
new ones continue to appear as a necessary growth, in many
important branches of national production, by the side of the very
great factories and huge centralised works. So I add to the chapter
on small industries a summary of the work that I had published in
the Nineteenth Century upon this subject.
As regards France, the most interesting observations made by M.
Ardouin Dumazet during his many years’ travels all over the country
give me the possibility of showing the remarkable development of
rural industries, and the advantages which were taken from them for
recent developments in agriculture and horticulture. Besides, the
publication of the statistical results of the French industrial census of
1896 permits me to give now, for France, most remarkable
numerical data, showing the real relative importance of the great
and the small industries.
And finally, the recent publication of the results of the third
industrial census made in Germany in 1907 gives me the data for
showing how the German small industries have been keeping their
ground for the last twenty-five years—a subject which I could touch
only in a general way in the first editions. The results of this census,
compared with the two preceding ones, as also some of the
conclusions arrived at by competent German writers, are indicated in
the Appendix. So also the results recently arrived at in Switzerland
concerning its home industries.
As to the need, generally felt at this moment, of an education
which would combine a wide scientific instruction with a sound
knowledge of manual work—a question which I treat in the last
chapter—it can be said that this cause has already been won in this
country during the last twenty years. The principle is generally
recognised by this time, although most nations, impoverished as
they are by their armaments, are much too slow in applying the
principle in life.
P. Kropotkin.
Brighton, October, 1912.
P R E FA C E TO F I R S T E D I T I O N .

Under the name of profits, rent, interest upon capital, surplus value,
and the like, economists have eagerly discussed the benefits which
the owners of land or capital, or some privileged nations, can derive,
either from the underpaid work of the wage-labourer, or from the
inferior position of one class of the community towards another
class, or from the inferior economical development of one nation
towards another nation. These profits being shared in a very
unequal proportion between the different individuals, classes and
nations engaged in production, considerable pains were taken to
study the present apportionment of the benefits, and its economical
and moral consequences, as well as the changes in the present
economical organisation of society which might bring about a more
equitable distribution of a rapidly accumulating wealth. It is upon
questions relating to the right to that increment of wealth that the
hottest battles are now fought between economists of different
schools.
In the meantime the great question—“What have we to produce,
and how?” necessarily remained in the background. Political
economy, as it gradually emerges from its semi-scientific stage,
tends more and more to become a science devoted to the study of
the needs of men and of the means of satisfying them with the least
possible waste of energy,—that is, a sort of physiology of society.
But few economists, as yet, have recognised that this is the proper
domain of economics, and have attempted to treat their science
from this point of view. The main subject of social economy—that is,
the economy of energy required for the satisfaction of human needs
—is consequently the last subject which one expects to find treated
in a concrete form in economical treatises.
The following pages are a contribution to a portion of this vast
subject. They contain a discussion of the advantages which civilised
societies could derive from a combination of industrial pursuits with
intensive agriculture, and of brain work with manual work.
The importance of such a combination has not escaped the
attention of a number of students of social science. It was eagerly
discussed some fifty years ago under the names of “harmonised
labour,” “integral education,” and so on. It was pointed out at that
time that the greatest sum total of well-being can be obtained when
a variety of agricultural, industrial and intellectual pursuits are
combined in each community; and that man shows his best when he
is in a position to apply his usually-varied capacities to several
pursuits in the farm, the workshop, the factory, the study or the
studio, instead of being riveted for life to one of these pursuits only.
At a much more recent date, in the ’seventies, Herbert Spencer’s
theory of evolution gave origin in Russia to a remarkable work, The
Theory of Progress, by M. M. Mikhailovsky. The part which belongs
in progressive evolution to differentiation, and the part which
belongs in it to an integration of aptitudes and activities, were
discussed by the Russian author with depth of thought, and
Spencer’s differentiation-formula was accordingly completed.
And, finally, out of a number of smaller monographs, I must
mention a suggestive little book by J. R. Dodge, the United States
statistician (Farm and Factory: Aids derived by Agriculture from
Industries, New York, 1886). The same question was discussed in it
from a practical American point of view.
Half a century ago a harmonious union between agricultural and
industrial pursuits, as also between brain work and manual work,
could only be a remote desideratum. The conditions under which the
factory system asserted itself, as well as the obsolete forms of
agriculture which prevailed at that time, prevented such a union
from being feasible. Synthetic production was impossible. However,
the wonderful simplification of the technical processes in both
industry and agriculture, partly due to an ever-increasing division of
labour—in analogy with what we see in biology—has rendered the
synthesis possible; and a distinct tendency towards a synthesis of
human activities becomes now apparent in modern economical
evolution. This tendency is analysed in the subsequent chapters—a
special weight being laid upon the present possibilities of agriculture,
which are illustrated by a number of examples borrowed from
different countries, and upon the small industries to which a new
impetus is being given by the new methods of transmission of
motive power.
The substance of these essays was published in 1888-1890 in the
Nineteenth Century, and of one of them in the Forum. However, the
tendencies indicated therein have been confirmed during the last ten
years by such a mass of evidence that a very considerable amount
of new matter had to be introduced, while the chapters on
agriculture and the small trades had to be written anew.
I take advantage of this opportunity to address my best thanks to
the editors of the Nineteenth Century and the Forum for their kind
permission of reproducing these essays in a new form, as also to
those friends and correspondents who have aided me in collecting
information about agriculture and the petty trades.
P. Kropotkin.
Bromley, Kent, 1898.
CONTENTS.
PAGE

Chapter I. The Decentralisation of Industries 17


Division of labour and integration—The spread of industrial skill—Each
nation its own producer of manufactured goods—The United
Kingdom—France—Germany—Russia—“German Competition.”

Chapter II. The Decentralisation of Industries (continued) 50


Italy and Spain—India—Japan—The United States—The cotton,
woollen, and silk trades—The growing necessity for each country
to rely chiefly upon home consumers.

Chapter III. The Possibilities of Agriculture 79


The development of agriculture—The over-population prejudice—Can
the soil of Great Britain feed its inhabitants?—British agriculture—
Compared with agriculture in France; in Belgium; in Denmark—
Market-gardening: its achievements—Is it profitable to grow wheat
in Great Britain?—American agriculture: intensive culture in the
States.

Chapter IV. The Possibilities of Agriculture (continued) 158


The doctrine of Malthus—Progress in wheat-growing—East Flanders—
Channel Islands—Potato crops, past and present—Irrigation—
Major Hallett’s experiments—Planted wheat.

Chapter V. The Possibilities of Agriculture (continued) 188


Extension of market-gardening and fruit-growing: in France; in the
United States—Culture under glass—Kitchen gardens under glass—
Hothouse culture: in Guernsey and Jersey; in Belgium—
Conclusion.

Chapter VI. Small Industries and Industrial Villages 241


Industry and agriculture—The small industries—Different types—Petty
trades in Great Britain: Sheffield, Leeds, Lake District, Birmingham
—Statistical data—Petty trades in France: weaving and various
other trades—The Lyons region—Paris, emporium of petty trades—
Results of the census of 1896.

Chapter VII. Small Industries and Industrial Villages (continued) 325


Petty trades in Germany: discussions upon the subject and conclusions
arrived at—Results of the census taken in 1882, 1895, and 1907—
Petty trades in Russia—Conclusions.

Chapter VIII. Brain Work and Manual Work 363


Divorce between science and handicraft—Technical education—
Complete education—The Moscow system; applied at Chicago,
Boston, Aberdeen—Concrete teaching—Present waste of time—
Science and technics—Advantages which science can derive from a
combination of brain work with manual work.

Chapter IX. Conclusion 410


APPENDIX.
A. British Investments Abroad 421
B. French Imports 422
C. Growth of Industry in Russia 423
D. Iron Industry in Germany 423
E. Machinery in Germany 424
F. Cotton Industry in Germany 425
G. Mining and Textiles in Austria 427
H. Cotton Manufacture in India 428
I. The Cotton Industry in the United States 430
J. Mr. Giffen’s and Mr. Flux’s Figures concerning the Position of
the United Kingdom in International Trade 432
K. Market-Gardening in Belgium 434
L. The Channel Islands—The Scilly Islands 435
M. Irrigated Meadows in Italy 444
N. Planted Wheat; the Rothamsted Challenge 444
O. Replanted Wheat 445
P. Imports of Vegetables to the United Kingdom 447
Q. Fruit Culture in Belgium 449
R. Culture under Glass in Holland 450
S. Prices obtained in London for Dessert Grapes cultivated under
Glass 451
T. The Use of Electricity in Agriculture 452
U. Petty Trades in the Lyons Region 454
V. Small Industries at Paris 460
W. Results of the Census of the French Industries in 1896 462
X. The Small Industries in Germany 468
Y. The Domestic Industries in Switzerland 475
FIELDS, FACTORIES, AND
WORKSHOPS.
CHAPTER I.
THE D E C E N T R A L I S AT I O N OF INDUSTRIES.

Division of labour and integration—The spread of industrial skill—Each nation its


own producer of manufactured goods—The United Kingdom—France—
Germany—Russia—“German competition.”

Who does not remember the remarkable chapter by which Adam


Smith opens his inquiry into the nature and causes of the wealth of
nations? Even those of our contemporary economists who seldom
revert to the works of the father of political economy, and often
forget the ideas which inspired them, know that chapter almost by
heart, so often has it been copied and recopied since. It has become
an article of faith; and the economical history of the century which
has elapsed since Adam Smith wrote has been, so to speak, an
actual commentary upon it.
“Division of labour” was its watchword. And the division and
subdivision—the permanent subdivision—of functions has been
pushed so far as to divide humanity into castes which are almost as
firmly established as those of old India. We have, first, the broad
division into producers and consumers: little-consuming producers
on the one hand, little-producing consumers on the other hand.
Then, amidst the former, a series of further subdivisions: the manual
worker and the intellectual worker, sharply separated from one
another to the detriment of both; the agricultural labourers and the
workers in the manufacture; and, amidst the mass of the latter,
numberless subdivisions again—so minute, indeed, that the modern
ideal of a workman seems to be a man or a woman, or even a girl or
a boy, without the knowledge of any handicraft, without any
conception whatever of the industry he or she is employed in, who is
only capable of making all day long and for a whole life the same
infinitesimal part of something: who from the age of thirteen to that
of sixty pushes the coal cart at a given spot of the mine or makes
the spring of a penknife, or “the eighteenth part of a pin.” Mere
servants to some machine of a given description; mere flesh-and-
bone parts of some immense machinery; having no idea how and
why the machinery performs its rhythmical movements.
Skilled artisanship is being swept away as a survival of a past
condemned to disappear. The artist who formerly found æsthetic
enjoyment in the work of his hands is substituted by the human
slave of an iron slave. Nay, even the agricultural labourer, who
formerly used to find a relief from the hardships of his life in the
home of his ancestors—the future home of his children—in his love
of the field and in a keen intercourse with nature, even he has been
doomed to disappear for the sake of division of labour. He is an
anachronism, we are told; he must be substituted, in a Bonanza
farm, by an occasional servant hired for the summer, and discharged
as the autumn comes: a tramp who will never again see the field he
has harvested once in his life. “An affair of a few years,” the
economists say, “to reform agriculture in accordance with the true
principles of division of labour and modern industrial organisation.”
Dazzled with the results obtained by a century of marvellous
inventions, especially in England, our economists and political men
went still farther in their dreams of division of labour. They
proclaimed the necessity of dividing the whole of humanity into
national workshops having each of them its own speciality. We were
taught, for instance, that Hungary and Russia are predestined by
nature to grow corn in order to feed the manufacturing countries;
that Britain had to provide the world-market with cottons, iron
goods, and coal; Belgium with woollen cloth; and so on. Nay, within
each nation, each region had to have its own speciality. So it has
been for some time since; so it ought to remain. Fortunes have been
made in this way, and will continue to be made in the same way. It
being proclaimed that the wealth of nations is measured by the
amount of profits made by the few, and that the largest profits are
made by means of a specialisation of labour, the question was not
conceived to exist as to whether human beings would always submit
to such a specialisation; whether nations could be specialised like
isolated workmen. The theory was good for to-day—why should we
care for to-morrow? To-morrow might bring its own theory!
And so it did. The narrow conception of life which consisted in
thinking that profits are the only leading motive of human society,
and the stubborn view which supposes that what has existed
yesterday would last for ever, proved in disaccordance with the
tendencies of human life; and life took another direction. Nobody will
deny the high pitch of production which may be attained by
specialisation. But, precisely in proportion as the work required from
the individual in modern production becomes simpler and easier to
be learned, and, therefore, also more monotonous and wearisome—
the requirements of the individual for varying his work, for exercising
all his capacities, become more and more prominent. Humanity
perceives that there is no advantage for the community in riveting a
human being for all his life to a given spot, in a workshop or a mine;
no gain in depriving him of such work as would bring him into free
intercourse with nature, make of him a conscious part of the grand
whole, a partner in the highest enjoyments of science and art, of
free work and creation.
Nations, too, refuse to be specialised. Each nation is a compound
aggregate of tastes and inclinations, of wants and resources, of
capacities and inventive powers. The territory occupied by each
nation is in its turn a most varied texture of soils and climates, of
hills and valleys, of slopes leading to a still greater variety of
territories and races. Variety is the distinctive feature, both of the
territory and its inhabitants; and that variety implies a variety of
occupations. Agriculture calls manufactures into existence, and
manufactures support agriculture. Both are inseparable; and the
combination, the integration of both brings about the grandest
results. In proportion as technical knowledge becomes everybody’s
virtual domain, in proportion as it becomes international, and can be
concealed no longer, each nation acquires the possibility of applying
the whole variety of her energies to the whole variety of industrial
and agricultural pursuits. Knowledge ignores artificial political
boundaries. So also do the industries; and the present tendency of
humanity is to have the greatest possible variety of industries
gathered in each country, in each separate region, side by side with
agriculture. The needs of human agglomerations correspond thus to
the needs of the individual; and while a temporary division of
functions remains the surest guarantee of success in each separate
undertaking, the permanent division is doomed to disappear, and to
be substituted by a variety of pursuits—intellectual, industrial, and
agricultural—corresponding to the different capacities of the
individual, as well as to the variety of capacities within every human
aggregate.
When we thus revert from the scholastics of our text-books, and
examine human life as a whole, we soon discover that, while all the
benefits of a temporary division of labour must be maintained, it is
high time to claim those of the integration of labour. Political
economy has hitherto insisted chiefly upon division. We proclaim
integration; and we maintain that the ideal of society—that is, the
state towards which society is already marching—is a society of
integrated, combined labour. A society where each individual is a
producer of both manual and intellectual work; where each able-
bodied human being is a worker, and where each worker works both
in the field and the industrial workshop; where every aggregation of
individuals, large enough to dispose of a certain variety of natural
resources—it may be a nation, or rather a region—produces and
itself consumes most of its own agricultural and manufactured
produce.
Of course, as long as society remains organised so as to permit
the owners of the land and capital to appropriate for themselves,
under the protection of the State and historical rights, the yearly
surplus of human production, no such change can be thoroughly
accomplished. But the present industrial system, based upon a
permanent specialisation of functions, already bears in itself the
germs of its proper ruin. The industrial crises, which grow more
acute and protracted, and are rendered still worse and still more
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

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.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookfinal.com

You might also like