Programming Multiplayer Games.pdf
(
6291 KB
)
Pobierz
Programming Multiplayer Games
Programming
Multiplayer
Games
Andrew Mulholland
and Teijo Hakala
Wordware Publishing, Inc.
Library of Congress Cataloging-in-Publication Data
Mulholland, Andrew.
Programming multiplayer games / by Andrew Mulholland and Teijo Hakala.
p. cm.
Includes index.
ISBN 1-55622-076-6 (pbk.; companion cd-rom)
1. Computer games--Programming. I. Hakala, Teijo. II. Title.
QA76.76.C672M855 2004
794.8'1711—dc22
2003027637
CIP
© 2004, Wordware Publishing, Inc.
All Rights Reserved
2320 Los Rios Boulevard
Plano, Texas 75074
No part of this book may be reproduced in any form or by any means
without permission in writing from Wordware Publishing, Inc.
Printed in the United States of America
ISBN 1-55622-076-6
10987654321
0403
UNIX is a registered trademark of The Open Group in the United States and other countries.
All brand names and product names mentioned in this book are trademarks or service marks of their respective
companies. Any omission or misuse (of any kind) of service marks or trademarks should not be regarded as intent to
infringe on the property of others. The publisher recognizes and respects all marks used by companies, manufacturers,
and developers as a means to distinguish their products.
This book is sold as is, without warranty of any kind, either express or implied, respecting the contents of this book and
any disks or programs that may accompany it, including but not limited to implied warranties for the book’s quality,
performance, merchantability, or fitness for any particular purpose. Neither Wordware Publishing, Inc. nor its dealers or
distributors shall be liable to the purchaser or any other person or entity with respect to any liability, loss, or damage
caused or alleged to have been caused directly or indirectly by this book.
All inquiries for volume purchases of this book should be addressed to Wordware Publishing,
Inc., at the above address. Telephone inquiries may be made by calling:
(972) 423-0090
Contents
About the Authors...............................xiv
Introduction ..................................xv
Part I — Theory
Chapter 1
Introduction to Windows Programming ..........3
Introduction ...................................3
Windows Messaging System ..........................3
Creating a Window ...............................4
Sending Information to Your Window .....................8
Static Link Libraries ..............................9
Creating a Static Link Library .....................10
Using a Static Link Library.......................13
Summary ....................................14
Chapter 2
Using Databases .....................15
Introduction ..................................15
What Is MySQL? ................................15
Installing MySQL ...............................16
SQL Statements ................................19
Data Definition Language ...........................19
Creating and Dropping Databases ...................19
Creating a Database .......................20
Dropping a Database .......................21
Column (Field) Types in MySQL ...................22
Adding, Modifying, and Dropping Tables ...............24
Creating Tables..........................24
Modifying Tables .........................26
Dropping (Removing) Tables ..................28
Data Manipulation Language (DML) .....................29
Inserting Data ..............................30
Modifying Data .............................32
Removing (Deleting) Data .......................34
Using Select Statements ........................35
Relational Databases..............................40
Data Import Methods .............................44
Importing from a Text File .......................44
iii
Contents
Importing from a Native Source ....................45
Backing Up and Restoring Data ........................47
Backing up a Database to a File ....................47
Restoring a Backed-Up Database ...................49
MySQL C++ Interface ............................50
Example 1 — Connecting and Retrieving Data from MySQL ....50
Example 2 — Updating Data in MySQL from an Application ....53
Summary ....................................55
Chapter 3
Creating Web-Based Server Interfaces .........57
Introduction ..................................57
Setting Up an Apache 1.3.x Web Server ...................57
Installing PHP4 for Apache 1.3.x .......................60
Using PHP: Hypertext Preprocessor .....................63
The Basics................................64
Example 1 — index.php .....................64
Variables .................................65
Example 2 — index2.php ....................65
Operators and Loops ..........................67
Example 3 — index3.php ....................67
Conditional Statements.........................68
Example 4 — index4.php ....................68
Arrays ..................................70
Functions ................................70
Example 5 — index5.php ....................70
User Input ................................71
Example 6a — input.php.....................71
Example 6b — output.php ....................72
The “Command” System ...........................73
Example 7a — core.php .....................74
Example 7b — welcome.php ..................74
Example 8a — core.php .....................76
Example 8b — welcome.php ..................76
Example 8c — page1.php ....................77
Example 8d — page2.php ....................77
Accessing MySQL ...............................78
MySQL Example 1 — Connecting and Disconnecting ........78
MySQL Example 2 — Storing and Retrieving Data .........79
MySQL Example 3 — Updating and Removing Data .........84
Using FastTemplate ..............................90
Multiple Templates ...........................93
Converting the Command Parser Example to FastTemplate ....95
Summary ...................................101
Chapter 4
Introduction to TCP/IP..................103
Introduction ..................................103
iv
Plik z chomika:
darekisap
Inne pliki z tego folderu:
DirectX 3D Graphics Programming Bible.pdf
(53946 KB)
GameProgrammingGems5-CDROM.rar
(113929 KB)
Game Physics.pdf
(70470 KB)
3D Geometry Tuts.rar
(11543 KB)
Cutting Edge Direct3D Programming.chm
(4949 KB)
Inne foldery tego chomika:
Biblioteka Informatyka
Courseware
Kurs Flash
Kurs MYSQL w PHP
Kurs_PHP
Zgłoś jeśli
naruszono regulamin