0%

Book Description

"PHP Game Programming" offers you the introduction you need to begin creating your own online games. You'll be amazed at the games you can create with this powerful - and completely free - development tool! Dive right in as you begin with coverage of server configuration and the major features of PHP. Then you're off and running as you use PHP to create and manipulate graphics, develop a chess game using a non-relational database, and send and receive data through sockets. Put your new skills to use as you create your own massively multiplayer online game! From the basics of PHP and HTML to the exciting task of creating dynamic terrain and Flash movies, "PHP Game Programming" will help you turn your online game ideas into reality!

Table of Contents

  1. Dedication
  2. Acknowledgments
  3. About the Author
  4. About the Series Editor
  5. Letter from the Series Editor
  6. Introduction
  7. Introduction to the World of PHP
    1. So What Is All This Server Stuff?
      1. Understanding the Client/Server Relationship
      2. The Web Server
      3. Sessions and Session Variables
      4. TCP/IP
      5. Installing the IIS Web Server
      6. Installation on Windows 2000/XP Professional
      7. Installation on Windows 98
      8. Installing the Apache Web Server on Windows ME/XP
      9. Installing the Apache Web Server on UNIX
    2. Waging the Configuration War
      1. The Platforms
      2. Building and Installing PHP on UNIX
      3. Installation on Windows for IIS/Apache
      4. Testing Your Installation
    3. I Have Conquered the Server, Let Me at the Code!
      1. The Basics of the HTML Tag
      2. The Almighty HTML Document
      3. The HTML Body
      4. Graphics and HTML
      5. Creating Forms for Input
      6. Conclusion
  8. Enter the Language
    1. Say Hello to PHP
      1. Creating a PHP Page
      2. Data Types
      3. Type Casting
      4. Variable Variables
      5. Constants
      6. Naming Conventions
      7. Functions for Variables
      8. Functions for Strings
      9. Regular Expressions and Pattern Matching
      10. Processing Forms with PHP
      11. Conclusion
    2. Operators, Statements, and Functions
      1. Operators
      2. Statements
      3. Functions
      4. The Magic of Including Files
      5. Conclusion
  9. Arrays, Games, and Graphics
    1. Arrays!
      1. Initializing Arrays
      2. Using Strings for Indexes
      3. Looping through Sequential Arrays
      4. Looping through Non-Sequential Arrays
      5. Multi-Dimensional Arrays
      6. Sorting Arrays
      7. Your First PHP Game
      8. Conclusion
    2. Playing with Chess and Databases
      1. Non-Relational Databases
      2. Creating and Opening a Database
      3. Looping through the Database
      4. Inserting an Entry into Your Database
      5. Updating an Entry in Your Database
      6. Deleting an Entry from Your Database
      7. Chess Programming: A Quick Overview
      8. Starting the Chess Game
      9. Working with the Pieces
      10. Getting the User Input and Modifying the Database
      11. Conclusion
    3. GD Graphics Overview
      1. What Is GD?
      2. Installing GD
      3. Creating and Using a New Image
      4. How to Use Colors
      5. Drawing Basic Shapes on Your Empty Canvas
      6. Creating Images with Text
      7. Saving Your Images
      8. Using Existing Images
      9. Conclusion
    4. Creating Battle Tank and Using Dynamic Terrain
      1. Planning Battle Tank
      2. Creating the Graphics
      3. Creating the Game Logic
      4. Creating Dynamic Terrain
      5. Conclusion
  10. Extras and Final Projects
    1. PHP and Sockets
      1. Socket Basics
      2. Creating a Server
      3. Creating the Client
      4. Integrating Sockets with Battle Tank
      5. Conclusion
    2. Kiddy Cartel—Creating Your Own MMO
      1. Installing mySQL
      2. Relational Databases: A Quick Rundown
      3. Kiddy Cartel: The Rules and Specifications
      4. Creating Your Base Actions
      5. Creating a Command with Sub-Commands
      6. Creating a Command without Sub-Commands
      7. Look at All the Commands…Now What?
      8. Conclusion
    3. Building Your PHP Skills
      1. PHP and Ming
      2. How to Create a Flash Movie
      3. Drawing to Your Flash Movie
      4. Filling Objects with Ming
      5. Adding Animation to Your Flash Movie
      6. Adding ActionScript to Your Flash Piece
      7. Conclusion
  11. Appendixes
    1. HTML Language Reference
      1. <!-- and <--> Comment
      2. !DOCTYPE
      3. A
      4. ADDRESS
      5. APPLET
      6. AREA
      7. B
      8. BASE
      9. BASEFONT
      10. BDO
      11. BGSOUND
      12. BIG
      13. BLINK
      14. BLOCKQUOTE
      15. BODY
      16. BR
      17. BUTTON
      18. CAPTION
      19. CITE
      20. CODE
      21. COL
      22. COLGROUP
      23. DD
      24. DFN
      25. DIR
      26. DIV
      27. DL
      28. DT
      29. EM
      30. EMBED
      31. FIELDSET
      32. FONT
      33. FORM
      34. FRAME
      35. FRAMESET
      36. HEAD
      37. HN
      38. HR
      39. HTML
      40. I
      41. IFRAME
      42. IMG
      43. INPUT
      44. KBD
      45. LABEL
      46. LI
      47. LINK
      48. MAP
      49. MARQUEE
      50. META
      51. NOFRAMES
      52. OBJECT
      53. OL
      54. OPTION
      55. P
      56. PARAM
      57. PRE
      58. SAMP
      59. SCRIPT
      60. SELECT
      61. SMALL
      62. SPAN
      63. STRONG
      64. SUB
      65. SUP
      66. TABLE
      67. TD
      68. TEXTAREA
      69. TH
      70. TITLE
      71. TR
      72. U
      73. UL
    2. PHP Language Reference
      1. Apache Functions
      2. Array Functions
      3. Aspell Functions
      4. BCMath Functions
      5. Calendar Functions
      6. Date and Time Functions
      7. DBA Functions
      8. Directory Functions
      9. Dynamic Extension Loading
      10. Encryption Functions
      11. Execution Functions
      12. Forms Data Format Functions
      13. File System Functions
      14. General Math Functions
      15. HTTP Functions
      16. Image Functions
      17. IMAP Functions
      18. Informix Functions
      19. LDAP Functions
      20. Mail Function
      21. PHP Options
      22. Miscellaneous Functions
      23. Network Functions
      24. NIS Functions
      25. Perl-Compatible Regular Expression Functions
      26. Regular Expression Funcitons
      27. Semaphore and Shared Memory Functions
      28. Session Functions
      29. SNMP Functions
      30. String Functions
      31. URL Functions
      32. Variable Functions
      33. WDDX Functions
      34. Compression Functions
      35. XML Parser Functions
    3. Support—Debugging Applications
      1. Syntax Errors
      2. Semantic Errors
      3. Logic Errors
      4. PHP and Error Reporting
      5. Handling Errors
      6. Application and Installation Problems
    4. GD SDK Language Reference