This book was interesting back in 2001, but today DirectPlay is deprecated, so 80% of this book is now no longer useful. That isn't saying much though: I doubt if any programming book written 8 years ago is still relevant! But still, it was an interesting read at the time and I would like to see a new edition covering Winsock2. There's like nothing in print on this subject today... I would like to find a book that covers hardcore Winsock2 and threading, and builds a rudimentary MMO concept game with a dedicated server that the reader can play around with, and use to build a few small persistent game projects.
Author(s): Andre LaMothe
Series: Prima Tech's Game Development
Edition: 1
Publisher: Course Technology PTR
Year: 2002
Language: English
Commentary: +OCR
Pages: 577
Team DDU......Page 1
Contents......Page 4
About the Authors ......Page 15
Introduction ......Page 16
Part I - Theory......Page 18
Windows Messaging System ......Page 20
Creating a Window ......Page 21
Sending Information to Your Window ......Page 25
Static Link Libraries ......Page 26
Creating a Static Link Library ......Page 27
Using a Static Link Library ......Page 30
Summary ......Page 31
What Is MySQL? ......Page 32
Installing MySQL ......Page 33
Creating and Dropping Databases ......Page 36
Creating a Database ......Page 37
Dropping a Database ......Page 38
Column (Field) Types in MySQL ......Page 39
Creating Tables ......Page 41
Modifying Tables ......Page 43
Dropping (Removing) Tables ......Page 45
Data Manipulation Language (DML) ......Page 46
Inserting Data ......Page 47
Modifying Data ......Page 49
Removing (Deleting) Data ......Page 51
Using Select Statements ......Page 52
Relational Databases ......Page 57
Importing from a Text File ......Page 61
Importing from a Native Source ......Page 62
Backing up a Database to a File ......Page 64
Restoring a Backed-Up Database ......Page 66
Example 1 - Connecting and Retrieving Data from MySQL ......Page 67
Example 2 - Updating Data in MySQL from an Application ......Page 70
Summary ......Page 72
Setting Up an Apache 1.3.x Web Server ......Page 74
Installing PHP4 for Apache 1.3.x ......Page 77
Using PHP: Hypertext Preprocessor ......Page 80
Example 1 - index.php ......Page 81
Example 2 - index2.php ......Page 82
Example 3 - index3.php ......Page 84
Example 4 - index4.php ......Page 85
Example 5 - index5.php ......Page 87
Example 6a - input.php ......Page 88
Example 6b - output.php ......Page 89
The "Command" System ......Page 90
Example 7b - welcome.php ......Page 91
Example 8b - welcome.php ......Page 93
Example 8d - page2.php ......Page 94
MySQL Example 1 - Connecting and Disconnecting ......Page 95
MySQL Example 2 - Storing and Retrieving Data ......Page 96
MySQL Example 3 - Updating and Removing Data ......Page 101
Using FastTemplate ......Page 107
Multiple Templates ......Page 110
Converting the Command Parser Example to FastTemplate ......Page 112
Summary ......Page 118
What Is a Protocol? ......Page 120
OSI Model Layers ......Page 121
Internet Protocol ......Page 123
Transmission Control Protocol ......Page 125
Ports ......Page 126
Introduction to Sockets ......Page 127
Socket Types ......Page 128
Platforms ......Page 129
Summary ......Page 130
WSAStartup Function (Win32) ......Page 132
WSACleanup Function (Win32) ......Page 133
WinSock Initialization Function ......Page 134
WSAGetLastError Function (Win32) ......Page 137
IPv4 Address Structure ......Page 138
IPv6 Address Structure ......Page 139
Generic Address Structure ......Page 140
socket Function (Unix, Win32) ......Page 141
bind Function (Unix, Win32) ......Page 142
connect Function (Unix, Win32) ......Page 143
listen Function (Unix, Win32) ......Page 144
accept Function (Unix, Win32) ......Page 145
send Function (Unix, Win32) ......Page 146
recv Function (Unix, Win32) ......Page 148
sendto Function (Unix, Win32) ......Page 149
Address Data Conversion Functions ......Page 150
Server Methods ......Page 151
Clients ......Page 152
Creating a Server ......Page 153
TCP ......Page 154
UDP ......Page 155
Simple Echo TCP Server ......Page 156
InitSockets Function ......Page 159
ServerProcess Function ......Page 162
Simple Echo UDP Server ......Page 163
InitSockets Function ......Page 165
ServerProcess Function ......Page 166
TCP ......Page 167
Simple Echo TCP Client ......Page 168
main Function ......Page 170
InitSockets Function ......Page 171
ClientProcess Function ......Page 172
Simple Echo UDP Client ......Page 174
ClientProcess Function ......Page 176
Running the Simple Echo Application ......Page 177
Summary ......Page 178
select (Unix, Win32) ......Page 180
Macros ......Page 181
WSAEventSelect (Win32) ......Page 182
Event Object ......Page 183
What Is Multithreading? ......Page 184
CreateThread (Win32) ......Page 185
Blocking I/O ......Page 186
Signal-driven I/O ......Page 187
Multiplexing I/O ......Page 188
ioctl (Unix)/ioctlsocket (Win32) ......Page 189
setsockopt/getsockopt (Unix, Win32) ......Page 190
shutdown (Unix, Win32) ......Page 191
Searching for Servers ......Page 192
Broadcast Function ......Page 193
Summary ......Page 194
Part II - Tutorials......Page 196
Configuring Visual Studio ......Page 198
Creating the Workspace ......Page 199
Adding the Source File ......Page 200
The WinMain Function ......Page 201
The Windows Procedure ......Page 202
The Complete Code ......Page 204
Use of Colors ......Page 207
Drawing a Triangle/Filled Triangle ......Page 208
Graphics Display (Blitting) Function ......Page 209
Keyboard Input Method ......Page 210
2DLIB Example 1 - Moving Primitives with the Cursor Keys ......Page 212
Complete Code Listing for Example 1 ......Page 214
2DLIB Example 2 - Loading and Rotating Graphics ......Page 217
Complete Code Listing for Example 2 ......Page 218
Summary ......Page 220
Introduction ......Page 222
Planning the Structure ......Page 223
Identifying Hosts ......Page 224
Sending Data to Hosts ......Page 225
Building the Library ......Page 226
Windows ......Page 227
Unix/Linux ......Page 228
Creating Definitions for Data Types ......Page 229
Log System ......Page 230
StartLogConsole Function ......Page 231
println Function ......Page 232
StartLog Function ......Page 233
LogString Function ......Page 234
StopLog Function ......Page 235
Setting Up Source and Header Files ......Page 236
dreamSock.h File ......Page 237
dreamMessage Class ......Page 242
dreamClient Class ......Page 243
dreamServer Class ......Page 245
dreamSock_Initialize ......Page 246
dreamSock_InitializeWinSock ......Page 247
dreamSock_Shutdown ......Page 248
Global Socket Functions ......Page 249
dreamSock_Socket Function ......Page 255
dreamSock_SetBroadcasting Function ......Page 256
dreamSock_StringToSockaddr Function ......Page 257
dreamSock_OpenUDPSocket Function ......Page 258
dreamSock_GetPacket Function ......Page 260
dreamSock_SendPacket Function ......Page 261
dreamSock_Broadcast Function ......Page 262
dreamSock_Linux_GetCurrentSystemTime Function ......Page 263
dreamSock_Win_GetCurrentSystemTime Function ......Page 264
Creating dreamSock Network Library ......Page 265
dreamMessage Class Functionality ......Page 266
Clear Function ......Page 270
GetNewPoint Function ......Page 271
WriteByte Function ......Page 272
WriteFloat Function ......Page 273
Read Function ......Page 274
ReadShort Function ......Page 275
ReadString Function ......Page 276
dreamClient Class Member Variables ......Page 277
dreamClient Class Functionality ......Page 279
Initialize Function ......Page 285
Uninitialize Function ......Page 286
System Messages vs User Messages ......Page 287
SendConnect Function ......Page 288
SendPing Function ......Page 289
ParsePacket Function ......Page 290
GetPacket Function ......Page 292
SendPacket Function (Internal Message) ......Page 293
SendPacket Function (External Message) ......Page 295
dreamClient Summary ......Page 296
dreamServer Class Functionality ......Page 297
dreamServer Destructor ......Page 306
SendAddClient Function ......Page 307
SendRemoveClient Function ......Page 309
AddClient Function ......Page 310
RemoveClient Function ......Page 312
ParsePacket Function ......Page 314
CheckForTimeout Function ......Page 316
GetPacket Function ......Page 318
SendPackets Function ......Page 320
Summary ......Page 321
Introduction ......Page 322
Creating a Basic Client Application ......Page 323
signin.h File ......Page 324
CSignin Class ......Page 325
main.h File ......Page 326
main.cpp File ......Page 327
CreateAccountDialogProc Function ......Page 333
WinMain Function ......Page 336
signin.cpp File - CSignin Class Methods ......Page 340
ReadPackets Function ......Page 346
AddClient Function ......Page 350
RemoveClient Function ......Page 351
RemoveClients Function ......Page 352
SendKeepAlive Function ......Page 353
RunNetwork Function ......Page 354
signin.h File ......Page 355
CSigninServer Class ......Page 356
common.h File ......Page 357
main.cpp File ......Page 358
WinMain Function ......Page 364
daemonInit Function ......Page 368
keyPress Function ......Page 369
main Function ......Page 370
signin.cpp File - CSigninServer Class Methods ......Page 372
CSigninServer Destructor ......Page 378
ReadPackets Function ......Page 379
AddClient Function ......Page 383
RemoveClient Function ......Page 384
RemoveClients Function ......Page 385
Summary ......Page 386
Creating the Lobby Client Application ......Page 388
Lobby Dialog ......Page 389
Create Game Dialog ......Page 392
Join Game Dialog ......Page 393
lobby.h File ......Page 394
main.h File ......Page 396
CreateGameDialogProc Function ......Page 397
LoginDialogProc Function ......Page 399
LobbyDialogProc Function ......Page 401
WinMain Function ......Page 403
lobby.cpp File - CLobby Class Methods ......Page 406
RefreshPlayerList Function ......Page 415
ReadPackets Function ......Page 416
RequestGameData Function ......Page 418
SendRemoveGame Function ......Page 419
Disconnect Function ......Page 420
RunNetwork Function ......Page 421
Unimplemented Functions ......Page 422
lobby.h File ......Page 423
main.cpp File ......Page 424
lobby.cpp File - CLobbyServer Class Methods ......Page 425
ReadPackets Function ......Page 435
Summary ......Page 442
Introduction ......Page 444
Compressing Messages ......Page 445
Dead Reckoning ......Page 446
Game Server Code ......Page 447
server.hFile ......Page 448
main.cpp File ......Page 453
network.cpp File - CArmyWarServer Class Part 1 ......Page 454
ReadPackets Function ......Page 466
SendCommand Function ......Page 468
ReadDeltaMoveCommand Function ......Page 469
BuildMoveCommand Function ......Page 470
BuildDeltaMoveCommand Function ......Page 471
server.cpp File - CArmyWarServer Class Part 2 ......Page 475
GenerateRandomMap Function ......Page 484
CalculateVelocity Function ......Page 485
CalculateHeading Function ......Page 486
CalculateBulletVelocity Function ......Page 487
MovePlayer Function ......Page 489
CheckFlagCollisions Function ......Page 492
Frame Function ......Page 494
AddGame Function ......Page 495
RemoveGame Function ......Page 496
Game Client Code ......Page 498
client.h File ......Page 499
network.h File ......Page 504
VectorLength and VectorSubtract Functions ......Page 505
Main Loop ......Page 506
network.cpp File ......Page 507
SendCommand Function ......Page 519
Connect Function ......Page 521
ReadMoveCommand Function ......Page 522
ReadDeltaMoveCommand Function ......Page 523
BuildDeltaMoveCommand Function ......Page 525
RunNetwork Function ......Page 526
client.cpp File ......Page 528
CArmyWar Constructor and Destructor Functions ......Page 542
InitializeEngine Function ......Page 543
Shutdown Function ......Page 544
DrawMap Function ......Page 545
Frame Function ......Page 547
CheckVictory Function ......Page 548
CheckKeys Function ......Page 549
CheckPredictionError Function ......Page 550
CheckBulletPredictionError Function ......Page 551
CalculateVelocity Function ......Page 552
CalculateHeading Function ......Page 553
PredictMovement Function ......Page 554
MoveObjects Function ......Page 556
RefreshJoinedPlayersList Function ......Page 558
Summary ......Page 559
Index ......Page 560