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"
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.
- "Foxes, Rabbits, and Carrots"
- "The Game and How to Play it"
- "A Brief Review of the MUSCLE Networking Layer"
- "muscled, The basic MUSCLE server"
- "Customizing the MUSCLE server"
- "How to Set up the Custom Server Logic"
- "The FRCPlayerSession Class"
- "The FRCGameStateSession class"
- "Overview of the FRC server"
- "The FoxRabbitCarrot Client Program"
- "How the Client Handles Database Update Messages"
- "MUSCLE gaming Performance Issues"