Skip to content

MMO Basics

Screenshot

The MMO Basics example offers an introduction to SmartFoxServer's MMO API and the MMORoom object, which extends the functionalities of the regular Room by introducing the concept of Area Of Interest to determine the spatial range of the events that will be received by users. This, in conjunction with the use of User Variables to track the coordinates, allows creating a virtual environment in which potentially thousands of players can move around without overloading clients with updates.

Of course, being a proof-of-concept, this example features a very small and simple virtual world, with a minimal Area of Interest. The purpose is to demonstrate the behavior of the MMORoom; this can then be applied to much bigger and complex 3D (or 2D) environments.

This example also features a server-side Room Extension, which accomplishes two tasks: (1) shows how to optimize the user positioning logic inside the MMORoom and (2) simulates any number of active users via the creation of automated Non-Player Characters (NPC) moving around the map randomly, entering and leaving the Area of Interest of players continuously.

In this tutorial we assume that you already went through the previous ones, where we explained the subdivision of the application into multiple scenes, and how to create a GlobalManager class to share the connection to SmartFoxServer among those scenes. The only difference here is that, for sake of simplicity, we removed the Lobby scene, making the user immediately join the game after the login.

Source code


The porting of this tutorial from the SmartFoxServer 2X documentation is still in progress. We apologize for the inconvenience.