Flash Multiplayer Virtual Worlds

Flash Multiplayer Virtual Worlds
eBook: $29.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 30%!
Print + free eBook + free PacktLib access to the book: $79.98    Print cover: $49.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Build virtual worlds in Flash and enhance them with avatars, non player characters, quests, and by adding social network community
  • Design, present, and integrate the quests to the virtual worlds
  • Create a whiteboard that every connected user can draw on
  • A practical guide filled with real-world examples of building virtual worlds

Book Details

Language : English
Paperback : 412 pages [ 235mm x 191mm ]
Release Date : August 2010
ISBN : 1849690367
ISBN 13 : 9781849690362
Author(s) : Makzan
Topics and Technologies : All Books, Game Development, Flash

Table of Contents

Chapter 1: Developing Flash Virtual World
Chapter 2: Installing the Servers
Chapter 3: Getting Familiar with SmartFoxServer
Chapter 4: Creating Map and Ground in Isometric View
Chapter 5: Creating Avatars
Chapter 6: Walking Around the World
Chapter 7: Creating Buildings and Environments in the Virtual World
Chapter 8: Creating an Inventory System
Chapter 9: Communicating with Other Players
Chapter 10: Interacting with NPC
Chapter 11: Designing Quests
Chapter 12: Social Community
Chapter 13: Deploying and Maintaining Flash Virtual World
  • Chapter 1: Developing Flash Virtual World
    • What is a virtual world?
      • Using virtual world for business
      • Using virtual world for education
      • Using virtual world for game
    • Background
    • Benefit of using Flash to build virtual world
    • Connecting players in a virtual world
      • A brief introduction to transport protocols
      • Peer-to-peer
      • Client-server network
        • Polling
        • Socket-based connection
    • Socket server
    • Available socket servers for Flash
      • SmartFoxServer
      • ElectroServer
      • Flash Media Interactive Server
      • Red5
      • Writing your own socket server
      • Choosing the right server
    • Application architecture of a virtual world
    • The whole picture of virtual worlds
    • Common features in virtual world
      • Avatar
      • World to explore
      • Home
      • Items
      • Quests
      • Non-player characters
      • Social features
    • Casual game design versus MMOG
    • Existing virtual world games
      • Club Penguin
      • Mole
      • Dofus
      • World of Warcraft
    • Summary
  • Chapter 2: Installing the Servers
    • Comparing SmartFoxServer Lite, Basic, and Pro
      • SmartFoxServer Lite
      • SmartFoxServer Basic
      • SmartFoxServer Pro
        • Modifying the behavior of server
        • JSON/Raw data protocol
        • Accessing the database directly
      • Comparing different package options
    • Developing and deploying virtual world environment
      • Adjusting server setting for the deployment environment
        • Hosting SmartFoxServer, web server, and database in one server
        • Hosting SmartFoxServer in dedicated standalone server
        • Benefiting from setting up SmartFoxServer, web server, and database in different machines
      • Setting up the development environment
    • Installing Java Development Kit
      • Installing JDK On Windows
      • Installing JDK on Mac OSX
      • Installing JDK on Linux
        • Installing for General Linux
        • Installing for Ubuntu Linux
    • Downloading SmartFoxServer Pro
    • Installing SmartFoxServer Pro
      • Installing on Windows
      • Installing on Mac OSX
      • Installing on Linux
    • Running the SmartFoxServer
      • Starting SmartFoxServer on Windows
      • Starting SmartFoxServer on Mac OS
      • Starting SmartFoxServer on Linux
    • Using embedded web server and database
      • Running the embedded web server
      • Running the embedded database server
    • Downloading third-party HTTP and database server package
      • Installing WAMP on Windows
      • Installing MAMP on Mac OSX
      • Installing LAMP on Linux
    • Connecting SmartFoxServer and MySQL server
      • Downloading JDBC Driver for MySQL
      • Setting up the JDBC driver
    • Configuring the server settings
    • Configuring MySQL server connection in SmartFoxServer
      • Restarting the server
    • Running examples
      • Loading a simple chat application
    • Setting up the administration panel
    • Logging in to administration panel
    • Locating the Flash Client API
    • Summary
  • Chapter 3: Getting Familiar with SmartFoxServer
    • Configuring a basic SmartFoxServer
      • Overview of the configuration file structure
      • Configuring the server
        • Automatically binding all available IP addresses to server
        • Listening port for connections
        • Setting policy load data from machines in other domains
        • Setting timers for idle user logouts
        • Blocking bots connections
        • Setting administrator login and password
        • Limiting access of the administration panel to specific IP addresses
        • Displaying zone information before connecting to the server
        • Defining the information separator in raw protocol
      • Configuring the Zones and Rooms
        • Configuring a zone
        • Setting moderators for the zone
        • Creating rooms
        • Properties of a room
    • Introducing the events of rooms
    • Debugging in local machine
      • Downloading the latest debugger version of Flash player
      • Creating the mm.cfg file
      • Testing the debugger log
      • Locating the Flash log output file
      • Reading the Flash logfile
        • Open the flashlog.txt in web browser
        • Using a Firefox add-on to read the Flash logfile
        • "Tail" the trace log file in terminal
    • Flash Security Sandbox
      • Configuring master socket policy server
      • Configuring SmartFoxServer to send socket policy
      • Loading policy file from Flash client
      • Enabling the network access for the Flash document
      • Keeping updates to Flash player security policy
    • Creating a Flash document to connect to the server
      • Logging into a zone
    • Creating a cooperative drawing whiteboard
      • Testing the cooperative whiteboard
    • Summary
  • Chapter 4: Creating Map and Ground in Isometric View
    • Comparing different game views
      • Top-down perspective
      • Side-scrolling view
      • 3D view
      • Isometric game view
    • Getting an isometric projection view
      • Isometric coordination
    • Making an isometric map
      • Creating the base tile of an isometric map
      • Creating a basic isometric tile map
      • Drawing seamless shore border
      • Texturing an isometric map
      • Texturing a big map
    • Converting between screen coordination and isometric map coordination
    • Building a map editor
    • Summary
  • Chapter 5: Creating Avatars
    • Designing an avatar
      • Determining the direction numbers of avatars' views
      • Rendering avatars in Flash virtual world
        • Drawing an avatar using vector animation
        • Rendering avatars using bitmap sprite sheet
        • Rendering avatars using real-time 3D engine
        • Rendering avatars using 2D bone skeleton
      • Drawing an avatar in Flash
        • Drawing the idle and walking animation
      • Creating an avatar class
      • Logging in SmartFoxServer with avatar
      • Using user variables in virtual world
      • Adding name to the avatar
    • Customizing your avatar
      • Customizing different styles
      • Customizing the color
      • Adding customization to avatar class
      • Designing a customization panel
      • Making our customization panel
      • Integrating the customization into SmartFoxServer
    • Summary
  • Chapter 6: Walking Around the World
    • Creating the world
    • Holding states of the player
    • Moving the avatar
      • Movement synchronization
      • Making avatar able to walk
      • Walking by keyboard
    • Introducing path finding
      • Implementing A* search
      • Understanding the heuristic function
      • Balancing between accuracy and speed
    • Walking by mouse click
    • Broadcasting where you walked
    • Scrolling the world
    • Saving the position for next time
      • Creating an avatar database table
      • Creating a new zone in config.xml
      • Programming our first server-side extension
      • Saving and loading last position
    • Summary
  • Chapter 7: Creating Buildings and Environments in the Virtual World
    • Placing buildings on the map
      • Outputting building from 3D software
      • Loading the building map data
    • Ordering the buildings
      • Ordering the movie clips in Flash
      • Determining an object's location and view
      • Shaping the buildings
        • Rendering z-order for l-shaped buildings
        • Rendering z-order for rectangle buildings
        • Rendering z-order for square buildings
      • Creating a loop to sort the z-order
    • Designing a big virtual world
      • Dividing the big world
        • The pros and cons of the seamless world
      • Partitioning the world into rooms
      • Connecting rooms with portals
    • Adding sound to the virtual world
      • Mixing art-based background with tile-based map
    • Building map editor for buildings
    • Summary
  • Chapter 8: Creating an Inventory System
    • Classifying items in the virtual world
      • Different types of items
        • Items for avatar
        • Weapon
        • Tools
        • Riding
        • Entertainment
        • Material item
    • Collecting items
      • Collecting items that appear in the open
      • Collecting items that are hidden
      • Getting items after archiving some quests
      • Buying items in virtual shop
      • Trading items with other players
      • Buying from real shop
    • Displaying items in different forms
    • Defining the data structure of inventory items
      • Setting the item ID
    • Implementing inventory in the SmartFoxServer
      • Coding the server-side extension
    • Implementing the item panel
      • Loading the item definition
      • Loading the items list from the server
      • Moving items
      • Implementing the item operation in RAM
      • Creating items
    • Exchanging items with other players
    • Introducing the economy in virtual world
      • Balancing the items virtual economy
        • Setting the price of the items
        • Preventing the inflation
        • Hosting special event
        • Adding fatigue to items
        • Limiting the total amount of high-level items
      • Preventing the virtual economy from affecting the real world
        • Trading with real money
        • Government policy on virtual items
      • The responsibility to maintain a good economy system
    • Summary
  • Chapter 9: Communicating with Other Players
    • Communicating using several methods
      • Sending public messages
      • Sending private messages
      • Sending group messages
      • Communicating in real-time voice
        • Potential problems of using voice communication
    • Chatting with public messages
      • Showing chat bubble
        • Scaling the chat bubble
    • Implementing the buddy list
      • Creating buddy list panel
      • Knowing others with profile panel
      • Dispatching custom event in ActionScript 3
      • Creating an advanced buddy list
        • Adding buddy mutually
        • Introducing the buddy variables
      • Creating custom buddy list persistence class
      • Summarizing buddy list configuration setting
    • Sending private messages
      • Capturing private message in server-side with internal event
    • Sharing object data between players
      • Making the trading items system
    • Summary
  • Chapter 10: Interacting with NPC
    • Running virtual world smoothly with NPCs
      • Classifying different roles of NPC
    • Placing NPC in virtual world
      • Putting our first NPC in the virtual world
      • Preventing the NPC from disconnecting
      • Resolving a potential problem of using provided NPC feature
    • Advanced SmartFoxServer extension technique
    • Controlling NPC movement
      • Controlling NPC to walk in predefined path
      • Directing NPC to walk using path finding algorithm
    • Talking with NPC
      • Communicating with NPC using text parsing
        • The advantages of text parsing conversation
        • The disadvantages of text parsing conversation
      • Menu-driven conversation
        • The advantages of the menu-driven conversation
        • The disadvantages of the menu-driven conversation system
      • Keyword-based conversation
      • Choosing the right conversation system
      • Designing the characteristic of the NPC
    • Trading with NPC
      • Buying items from NPC
      • Selling items to NPC
    • Summary
  • Chapter 11: Designing Quests
    • Introducing quests
    • Triggering quests
      • Getting quests from NPC
      • Getting quests from reading documents
      • Getting quests from collecting items
      • Getting quests from the last quest
    • Setting up server environment for quests
      • Setting up database
    • Designing the quest panels
      • Displaying available quests
        • Getting available quests in server-side extension
        • Displaying the quests in different statuses
      • Displaying quests for the avatar
    • Running daemons for quests
      • Managing quest daemons
      • Creating our first quest—Tom's Question
    • Introducing achievement
    • Completing quests
    • Rewarding the players when finishing the quests
      • Rewarding gold
      • Rewarding items
      • Rewarding avatars advancement or experience
    • Extending the quests with mini games
      • Creating the duck shooting game
      • Implementing the duck shooting quest daemon
    • Making the quest system better
      • Avoiding linear quests
      • Indicating the availability of quests
    • Summary
  • Chapter 12: Social Community
    • The benefit of using social network features in virtual world
    • The complicated data flow
    • Integrating Facebook platform
      • Setting up Flash Facebook API
      • Registering the virtual world in Facebook
      • Putting the virtual world as a Facebook application
        • Using FBML rendering
        • Using iFrame rendering inside Facebook
    • Authorizing a Facebook account
      • Getting the profile name and picture from Facebook
    • Getting friends list from Facebook
    • Update the Facebook status
    • Sending news feed to Facebook
    • Reading news feed into the virtual world
    • Capture a screenshot and share to a Facebook album
    • Integrating the Twitter platform
      • Publish latest virtual world news in Twitter
    • Choosing the right social network service
    • Summary
  • Chapter 13: Deploying and Maintaining Flash Virtual World
    • Hosting the virtual world
      • Hosting that supports SmartFoxServer
      • Hosting SmartFoxServer in dedicated server
      • Hosting SmartFoxServer in cloud service
      • Comparing the hosting solution
    • Scaling up the virtual world
    • Earning money from the virtual world
      • Google AdSense
      • In-game advertisement
      • Monthly subscription
      • Point-based subscription
      • Selling virtual items and virtual currency
    • Operating the virtual world
      • Tracking the cost of maintaining a Flash virtual world
        • Paying the hosting fee
        • Licensing the Socket server
        • Hiring customer service
      • Losing players
        • Losing players at sign up process
        • Losing players at a certain level
        • Losing players after updates
        • Losing players due to the low quality
      • Product lining
    • Analyzing players actions on a virtual world
      • Tracking players actions with funnel analysis
      • Data mining
        • Gathering useful information
        • Logging the data
    • Rapid development with OpenSpace
      • Editing with advanced map editor
      • Raising the avatars from the flat platform
      • Creating custom tile events
    • Updating and patching the virtual world
    • Keeping an eye on the virtual world industry
    • Putting our virtual world in mobile
      • Small screen size
      • Low RAM
      • Relatively slow CPU
      • Limited network bandwidth
      • Benefit of porting virtual world into mobile
    • Extending the virtual world to other platforms
      • Apple iOS
      • .Net and Unity
      • Java and Android
      • Ajax
    • Summary


Makzan focuses on web development and game design. He has over 14 years of experience in building digital products. He has worked on real-time multiplayer interaction games, iOS applications, and rich interactive websites.

He has written two books and one video course on building a Flash virtual world and creating games with HTML5 and the latest web standards. He is currently teaching courses in Hong Kong and Macao SAR.

Sorry, we don't have any reviews for this title yet.

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


- 1 submitted: last submission 27 Aug 2013

Errata type: Code | Page number: 120-121

//book code:
sx:Number = localPoint.x;
sy:Number = localPoint.y;

//corrected code:
sx = localPoint.x;
sy = localPoint.y;

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Flash Multiplayer Virtual Worlds +    Learning Dart =
50% Off
the second eBook
Price for both: $45.60

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Create a whiteboard that every connected user can draw on
  • Create the map, basic map editor, and ground of the virtual world
  • Optimize graphic workload by selecting the appropriate method to render avatars
  • Move avatars using keyboard or mouse and synchronize their movementsCreate buildings and the environment for the virtual world
  • Create a basic item inventory system for an avatar and implement some basic item management with the server-side extensions
  • Create a basic chat system and a buddy list for your avatar
  • Control the Non-Player Characters to move around the world and interact with the players by chatting or trading items
  • Enhance your virtual worlds by integrating several key features of Facebook and Twitter


In Detail

Flash virtual worlds are some of the most exciting—and profitable—online business being built today. Using Flash, developers can build interactive environments where users can interact with the virtual world and one another, compete, and have fun. Creating a playful environment on an electronic network presents unique challenges as you combine a fun, upbeat frontend with some serious and complex server logic.

This handy book assists you in building amazing virtual worlds in no time by implementing ActionScripts in a Flash IDE. With this book in hand, you will build virtual worlds that have avatars walking around and interacting with non playing characters, completing challenging quests, and allowing users to link with real-world friends.

The fun begins with first exploring existing virtual world games such as Club Penguin, Mole, Dofus, and World of Warcraft. We will then design our virtual environment. Then we will create avatars and move the avatars in the virtual world. We will add some triggers to add amusement and life to the virtual world. We will allow the avatars to interact with other players and create a buddy list for each user. Then we will integrate buildings and other environment to the virtual world. We will also let the players interact with non-player characters to complete some tasks. Finally, we move on to add interesting quests to the virtual world, which need to be accomplished by the player to gear up to the next level of the game.

This example-rich, hands-on guide sequentially develops a multiplayer virtual world—the platform, the environment, quests, avatars, non-playing characters, and interaction between them.

A hands-on guide to building multiplayer virtual worlds in Flash


This is a step-by-step, hands-on guide that is filled with examples and screenshots of building a multiplayer virtual world. The virtual world is built gradually; each chapter in the book sequentially develops the virtual world. The author explains the fundamentals with examples from existing virtual worlds such as Club Penguin, Mole, Dofus, and World of Warcraft.

Who this book is for

If you are a Flash or an ActionScript developer who wants to build powerful and immersive multiplayer games, this book is for you. This book assumes that you have some experience with ActionScript 3.0.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software