You are previewing Flash 10 Multiplayer Game Essentials.
O'Reilly logo
Flash 10 Multiplayer Game Essentials

Book Description

Create exciting real-time multiplayer games using Flash

  • A complete end-to-end guide for creating fully featured multiplayer games

  • The author's experience in the gaming industry enables him to share insights on multiplayer game development

  • Walk-though several real-time multiplayer game implementations

  • Packed with illustrations and code snippets with supporting explanations for ease of understanding

  • In Detail

    Multiplayer web-based games are more popular than any others, and developing your own is an exciting challenge. But developing multiplayer games is a complex task. There are few resources that explain how to build multiplayer games from the ground up.

    This comprehensive guide is packed with practical examples and insights into basic and fundamental knowledge for developing real-time multiplayer games in Flash.

    This book starts with the essential ingredients to develop Flash games using Flash Builder 4 and AS3, followed by the basic Flash programming that you need to know in order to write any Flash game. You will learn the basic features that a developer must implement for any multiplayer game. The chapters discuss the challenges you will face when developing a multiplayer game. You will learn to leverage the PulseUI framework to quickly develop a multiplayer game along with all the required screen management. The simple, but powerful, Pulse API model required for multiplayer game development is thoroughly explained as well. As you go through these concepts, you will learn to implement them using code examples.

    The last section takes you through four multiplayer game implementations of increasing complexity: first a simple turn-based TicTacToe, followed by a multi-player Jigsaw, a card-based racing game, and finally a complex space racing game.

    A development guide for all your multiplayer games

    Table of Contents

    1. Flash 10 Multiplayer Game Essentials
      1. Flash 10 Multiplayer Game Essentials
      2. Credits
      3. About the author
      4. About the reviewers
      5. Preface
        1. What this book covers
        2. Who this book is for
        3. Conventions
        4. Reader feedback
        5. Customer support
          1. Errata
          2. Piracy
          3. Questions
      6. 1. Getting Started
        1. Development environment
        2. Pulse SDK
        3. Installing Flash Builder 4
        4. Downloading the Pulse SDK
        5. Installing Pulse SDK
          1. Post-installation checks
          2. Running the samples
            1. Starting the server
            2. Starting the client
        6. A high-level architecture of multiplayer game server
          1. Simple deployment architecture
          2. Enterprise deployment architecture
            1. The session server process
            2. The balancer process
            3. Server game programming
            4. Zero server-side programming
          3. Network programming paradigm
          4. Client-to-client interaction
        7. The server modules
          1. Game server modules
            1. Persistence
            2. Session and session manager
            3. Avatar manager
              1. Lobby and room manager
            4. Friends
            5. Chat
            6. Object synchronization
            7. Object serialization
            8. Security
            9. Connection management and message dispatcher
            10. Message
        8. The game client
        9. The overall structure of a multiplayer game
          1. The main game loop
          2. Processing messages from the server
          3. The programming API
        10. Summary
      7. 2. Game Interface Design
        1. Overview of Pulse library components
        2. The Pulse API design
        3. Creating the Hello World sample
          1. Setting up the project
          2. The Hello World specification
          3. The schema file
          4. Code generator
          5. Project directory structure
        4. Introduction to PulseUI
          1. Screen management in PulseUI
          2. The PulseGame class
        5. Exploring the Hello World sample
          1. HelloGame.as
          2. The login screen
          3. The screen class
          4. The skinner class
          5. The outline class
          6. Player registration
        6. Exploring the game server deployment
          1. Registration and login
            1. Registration
            2. The login
            3. Dealing with multiple logins
            4. Guest logins
        7. Summary
      8. 3. Avatar and Chat
        1. Introduction to Pulse modeler
          1. Example schema
        2. Design of a game avatar
          1. Modeling the avatar
          2. Avatar display in Hello World
          3. Customizing Player Display
        3. Avatar-related APIs
          1. PulseGame client APIs
          2. Pulse game client callbacks
        4. Friends management
          1. Friends in Hello World
          2. The friends API
          3. Customizing friends display
        5. The chat feature
          1. The chat API
          2. Chatting in Hello World
          3. Customizing chat display
        6. Implementing high scores
          1. High scores in Hello World
        7. Skinning the user interface
          1. Skinning for Hello World
        8. Summary
      9. 4. Lobby and Room Management
        1. Introduction to lobby and room management
          1. Modeling game room
            1. Game room management
            2. Seating order
            3. Room states
            4. Player states
            5. Kicking out a player
            6. Room types
            7. Audience
            8. Room properties
        2. The lobby screen implementation
          1. Lobby screen in Hello World
          2. Customizing lobby screen
          3. Customizing game room display
          4. Filtering rooms to display
          5. Lobby and room-related API
        3. New game screen implementation
          1. New game screen in Hello World
          2. Customizing the new game screen
          3. New game room API
        4. Designing the game screen
          1. Implementing the game screen
          2. Customizing the game screen
        5. Summary
      10. 5. Game Logic
        1. Gameplay implementation
        2. Modeling game states
          1. Game states types
        3. Game states in Hello World
          1. Code walk-through
            1. GameStateSprite class
            2. General flow of events
            3. Game state schema
            4. Adding a new game state
            5. Updating game state
            6. Removing a game state
        4. Game state API
        5. Miscellaneous classes
          1. The Button Effect class
          2. The Slider class
          3. The ShakeEffect class
        6. Summary
      11. 6. Multiplayer Game Example: Tic-tac-toe
        1. Running the game from sample directory
        2. The Pulse UI framework
          1. Setting up the project
        3. Getting started: Modeling the game
          1. Project directory structure
          2. Code walk-through
          3. TictactoeGame
            1. Overriding the constructor
            2. Overriding the initNetClient method
            3. Implementing a turn-based game
            4. Sending and receiving player actions
          4. TictactoeSkinner
          5. TictactoeNewGameScreen
          6. TictactoeGameScreen
            1. Initializing the game screen
            2. Displaying player turn
            3. Letting the player make the move
            4. Who won?
            5. Finding the winner
        4. Other screens and features
          1. Lobby screen
          2. Chat
          3. TopTen
          4. Registration screen
        5. Summary
      12. 7. Multiplayer Game Example: Jigsaw
        1. Setting up the project
          1. Files in the project
        2. The game graphics
          1. DisplayManager
          2. Managing pieces—Group
          3. The PieceSprite class
          4. Creating a piece
          5. Dragging of pieces
          6. Checking for matches
        3. Multiplayer and networking
          1. Code generation
          2. Screen classes
          3. The JigsawGame class
            1. Overriding the constructor
            2. Overriding the initNetClient method
            3. Server communication
          4. The JigsawSkinner class
          5. The NewJigsawGameScreen class
          6. The JigsawGameScreen class
        4. Summary
      13. 8. Card-based Racing Game Tutorial
        1. Implementation
          1. Graphics
          2. The map and frog movement
            1. The step class
            2. The frog class
          3. Card management
          4. Screen management
          5. Class Skin
          6. Class JJF
          7. Class NewGame
        2. Multiplayer design
          1. Card distribution
          2. Frog position
          3. Assigning player color
          4. Schema
        3. Gameplay implementation
          1. Assigning colors
          2. Determining the initial frog positions
          3. Getting the initial three cards
          4. Playing the game
        4. Summary
      14. 9. Real-time Racing Game Tutorial
        1. Game design
        2. The game client
          1. The main game loop
          2. The spaceship class
            1. Controlling movement
            2. Skinning the ship
          3. The racetrack module
          4. Mapping coordinates
          5. Loading quadrants
          6. The mini-map class
          7. The Radar class
          8. Implementing items
            1. Detecting collisions
          9. Implementing the shield
          10. Finishing the race
        3. Multiplayer implementation
          1. Designing the schema
            1. The ShipMask class
            2. The ShipPos class
            3. The item class
            4. The ShipWin class
          2. Assigning ship color
          3. Putting items on the map
          4. Ship prediction and interpolation
          5. Winning the race
        4. Summary
      15. A. Introduction to FlashBuilder and AS3
        1. Installing Flash Builder 4
        2. AS2 versus AS3
        3. Exploring Flash Builder 4
        4. Hello World!
        5. Defining a class
        6. Classes—defining game objects
        7. Creating game objects
        8. Variables and properties
        9. Magic numbers and constants
        10. Methods
        11. Property and method access
        12. Taming the inheritance monster
        13. Interface class
        14. Static properties and methods
      16. B. Graphics Programming in AS3
        1. Flash object hierarchy
          1. Object
          2. EventDispatcher
          3. DisplayObject and DisplayObjectContainer
          4. InteractiveObject
        2. Sprite, in detail
          1. Which way is up?
        3. Let the fun begin
        4. Events
        5. Timers
        6. Trace
        7. Embedding pictures
        8. Mouse events
          1. What do we need to handle mouse events for?
          2. How to register for a mouse event
          3. What are the events we can handle in Flash?
          4. Handling mouse events in many objects
          5. Where is the Mouse?
        9. Drag-and-drop
        10. Keyboard events
          1. Arrow key handling: The basics
          2. Arrow key handling: The professional way
        11. Labels, text fields, and sprite buttons
        12. Filters: Adding effects to sprites
        13. Transparency: Playing with the alpha channel
          1. Cool fading screens
        14. Cutting up assets