With many of today's games being released simultaneously on all platforms, the need for a good cross-platform development strategy is essential. Cross-Platform Game Programming covers this rarely discussed area and provides the techniques needed to develop your games effectively. It explains the plethora of problems that exist within every cross-platform game, and gives you the understanding and ability needed to solve them. It also teaches you how to write code that behaves identically on all machines. In addition, the book explains why standard libraries are not standard enough, and covers the nuances between compilers, debuggers, and operating systems. Throughout the book, how-to guidelines are provided for using the same code to handle different hardware specifications without change for ported games, or those being build to work cross-platform from the ground up. It helps senior and lead programmers determine where the platform-specific features should start and end, and provides methods for achieving this. It also includes support for those using middleware by demonstrating how to write code that will run identically on different machines, despite the platform making use of the same APIs. Because this book teaches the methods, not the API, it scales well for future platforms and empowers you to create your own designs.
Author(s): Steven Goodwin
Series: Game Development
Edition: 1st
Publisher: Charles River Media
Year: 2005
Language: English
Pages: 481
Contents......Page 8
Dedication......Page 6
Acknowledgments......Page 18
Preface......Page 20
Background of Cross-Platform Programming......Page 22
History......Page 23
The Importance of Cross-Platform Development......Page 25
Overview of Cross-Platform Components......Page 28
Cross-Generation, Cross-Platform Game Programming......Page 30
The Theoretical Process......Page 31
Code Is Code......Page 33
Console Limitations......Page 35
Libraries......Page 36
Coding Style......Page 38
Notes to the Reader......Page 39
Endnotes......Page 40
The Basic Issues......Page 42
Abstraction......Page 43
Language Limitations......Page 45
Compiler Limitations......Page 48
Platform Limitations......Page 52
Modularization......Page 54
Resource Detail......Page 56
Granularity......Page 59
Audio Code......Page 60
Obvious Isolation......Page 61
Singletons......Page 62
Class Structures......Page 64
Divorcing Code......Page 65
Separation by Purpose......Page 67
Separation for the Present......Page 70
Separation for the Future......Page 71
Succession......Page 73
Programming-Based Bugs......Page 74
Compiler-Based Bugs......Page 75
Execution-Based Bugs......Page 76
Profiling......Page 80
Randomness......Page 81
Input Stimuli......Page 82
Turn-Around......Page 83
Endnotes......Page 86
The Specification......Page 88
The Issues–Datatypes......Page 92
The Issues–A Safety File......Page 95
The Issues–The Report......Page 97
Endian......Page 102
Alignment......Page 106
Fragmentation......Page 108
The Standard Library......Page 110
Our Own Memory Manager–Implementation......Page 111
Conceptual Design......Page 112
Allocating Memory......Page 115
Garbage Collection......Page 118
Releasing Memory......Page 119
Debugging Memory......Page 120
High-Level Memory Usage......Page 123
Application Memory Usage......Page 125
Using Allocation Within Subsystems......Page 136
Global versus Game......Page 138
The Stack......Page 139
Local Variabales......Page 141
Endnotes......Page 142
The CPU......Page 144
Timer Resolution......Page 145
Processor Yield......Page 147
Programming the Clock......Page 148
Programming Profilers......Page 151
Time Slicing......Page 153
Lowest Common Denominator......Page 159
Level of Detail (LOD)......Page 160
Extra Burn......Page 161
Parallel Determination......Page 162
Parallel Distribution......Page 164
Parallel Implementation......Page 170
Task Scheduling......Page 181
Avoiding the Whole Problem......Page 183
Endnotes......Page 184
The Four Corners of Storage......Page 186
The Problems......Page 187
The Data Conversion Process......Page 191
Serialization......Page 194
Endian Issues......Page 199
Extensibility and Future-Proofing......Page 205
Introducing Platform-Specific Data......Page 209
Introducing Platform-Specific Resources......Page 217
Serializing Class Hierarchies......Page 218
Object Creation......Page 220
Interdependent Objects......Page 221
Patching Pointers......Page 222
Designing a Filesystem......Page 226
Disc Size......Page 229
Layout......Page 230
Filesystem Implementation......Page 233
Filesystem Devices......Page 235
File Handling......Page 241
Filesystem Shortcuts......Page 245
Handling Physical Devices......Page 246
Asynchronous Loading......Page 247
Synchronous Loading......Page 252
Block Sizes and Caching......Page 254
Creating Back Doors......Page 257
A ZIP Warning......Page 258
Endnotes......Page 259
Basic Requirements......Page 262
Coding Style......Page 263
Debugging Methodologies......Page 269
Implementing Debugging Code......Page 271
Trace Messages......Page 272
Trace Levels......Page 273
Handling Errors......Page 282
Assertions......Page 283
Memory......Page 286
Output Targets......Page 292
Bugs in the Compiler......Page 293
Screen......Page 294
File......Page 295
Making Data Readable......Page 296
Multithreaded Output......Page 297
Isolating System Calls......Page 299
Tabulating Trigonometry......Page 303
Random Numbers......Page 308
Code Checking......Page 313
Endnotes......Page 314
Abstracting Basics......Page 316
Prepared Singleton......Page 317
Double Chance Functions......Page 318
Input Devices......Page 320
General Implementation......Page 321
Input Logging......Page 332
Gameplay Abstractions......Page 336
The Bottom Line......Page 339
Endnotes......Page 340
High-Level Parameters......Page 342
Playing Music......Page 343
MP3 and Ogg Vorbis......Page 344
MIDI......Page 345
Customized Formats......Page 346
Compressed Data......Page 347
Looped Sounds......Page 348
From a Stream......Page 349
Mixer Control......Page 351
UDE......Page 352
The Gameplay Mixer......Page 355
The Technology Mixer......Page 359
The User Mixer......Page 360
Endnote......Page 362
History......Page 364
Common Code......Page 365
Static Texture Changes......Page 367
Dynamic Texture Changes......Page 370
Translucent Textures......Page 373
State Changes......Page 374
Mode Changes......Page 377
Special Cases......Page 379
Textures......Page 380
Meshes......Page 383
Camera......Page 384
Viewports......Page 385
Lights......Page 386
The Scene......Page 387
Abstracted Features......Page 388
Texture Handling......Page 389
Meshes......Page 390
Sprites......Page 393
Fonts and 2D Overlays......Page 394
Special Effects......Page 395
Text......Page 396
Image Sizes......Page 397
Physical Testing......Page 398
Endnotes......Page 399
Packet Programming......Page 400
Networking Background......Page 401
The Conceptual Network Driver......Page 403
The Null Network......Page 412
Network Latency......Page 413
Dropped Packets......Page 414
The Two Modes......Page 415
Endnote......Page 416
The Environment......Page 418
Source Code......Page 422
PAL and NTSC......Page 424
Frontend Screens......Page 426
Foreign Language Versions......Page 427
Code Overlays......Page 430
Initializing the OS......Page 431
Title Screens......Page 434
Reset Buttons......Page 435
Memory Cards......Page 436
Disc Covers......Page 440
The Consequence of STL......Page 441
Exceptions......Page 443
Hacking It......Page 445
Endnotes......Page 446
Appendix A: About the CD-ROM......Page 448
Appendix B: PlayStation 2 Glossary......Page 452
Appendix C: Xbox Glossary......Page 456
Appendix D: GameCube Glossary......Page 460
Appendix E: Code Guidelines......Page 464
B......Page 466
C......Page 467
D......Page 469
E......Page 470
G......Page 471
I......Page 472
L......Page 473
M......Page 474
O......Page 475
P......Page 476
R......Page 477
S......Page 478
T......Page 479
V......Page 480
Z......Page 481