posted by Jeremy Friesner on Mon 12th Aug 2002 20:52 UTC
IconPrologue by the editor-in-chief: "A bit more than two years ago, while I was still serving at BeNews, I asked Jeremy Friesner to write an article and present his cross-platform client-server messaging system for dynamic distributed applications, MUSCLE. Two weeks later, he came back to me with a multi-page article, explaining MUSCLE. To demonstrate the power of MUSCLE, Jeremy created a demo application based on it. The result was BeShare.

BeShare quickly became one of the most favorite/influential and fun applications ever written for the BeOS. Years have passed, MUSCLE has become even more powerful and more feature-rich, and here I am again asking Jeremy to write another article about his creation. Jeremy created, exclusively for this article, a brand new application (a multiplayer networked game) to show the power of MUSCLE, and this time it can run on Unix, MacOSX and Windows. If you are a developer interested in any kind of networking programming under any major operating system, you should not pass this article without reading it! And if you are a simple user, you can always try out Jeremy's game, FoxRabbitCarrot. Jeremy, thank you for all your wonderful work! --Eugenia"

By Jeremy Friesner

The Internet is useful for many things, but one of its most compelling applications is gathering people from many locations together into a shared virtual environment, where they are able to interact with each other in interesting and entertaining ways. A good multiplayer game can be a lot of fun!

But multiplayer games are also a major challenge to create - as a game programmer, you have to somehow coordinate the activities of dozens or hundreds of computers, so that all the players share in the experience of a single well-ordered game universe. Implementing a communications architecture that can get the right information to the right computers at the right time is a major project in itself, requiring in-depth knowledge of network programming and data management techniques -- and this is all extra work that must be done in addition to the game itself. Because of this, many promising multiplayer game ideas never see the light of day.

But what if there were a way to outsource the networking headaches to someone else? Instead of groveling over which bytes need to go into which socket when, you could spend more of your time working on the game itself.

As it happens, there is such an option available -- the MUSCLE library, by Level Control Systems. MUSCLE is an open-source, general-purpose, client/server messaging system that has been developed and refined over the last several years, and is designed to quickly and conveniently handle many of the networking tasks that are required of multi-user network applications. In this article, I will present a simple multiplayer game implemented using MUSCLE, and discuss how it was implemented and how it works.

After reading this article, you should have a basic understanding of MUSCLE's features and how to use MUSCLE to create a networked game or application of your own. Please note that this article assumes you have a basic knowledge of C++ and object-oriented design. MUSCLE also includes APIs for the Java and Python languages, but the FoxRabbitCarrot client and server code were both written in C++, so that is what we will be looking at here.

Table of contents
  1. "Foxes, Rabbits, and Carrots"
  2. "The Game and How to Play it"
  3. "A Brief Review of the MUSCLE Networking Layer"
  4. "muscled, The basic MUSCLE server"
  5. "Customizing the MUSCLE server"
  6. "How to Set up the Custom Server Logic"
  7. "The FRCPlayerSession Class"
  8. "The FRCGameStateSession class"
  9. "Overview of the FRC server"
  10. "The FoxRabbitCarrot Client Program"
  11. "How the Client Handles Database Update Messages"
  12. "MUSCLE gaming Performance Issues"
e p (0)    8 Comment(s)

Technology White Papers

See More