HexMob is universal gaming and messaging back-end platform providing user accounts, friend lists, leaderboards, achievements and turn-based multiplayer.
The platform is accessible as a HTTP web service. It uses WebSockets combined with native push notification for server-originating event delivery.
HexMob supports multiple application running on the same server setup, making it suitable for both service (BaaS) and product deployments on any cloud infrastructure (including, but not limited to Amazon AWS or Microsoft Azure) or hosting facility.
HexMob itself has very few basic concepts but it is powerful enough to cover most application needs.
Application, which is basically a namespace, where all objects live. This concept allows multiple products to co-exist within the same server deployments.
User is the main player identity. It contains user profile data and it is linked from sessions, leaderboards and other users’ friend lists. Each user account may have multiple login options like phone number, email or Facebook ID.
Session is the place where user communication happens. This is the core of multiplayer functionality we provide — users with abilities to create game sessions, invite others and post events there. Events are persisted in database which allows both online and offline interaction.
Leaderboards hold user scores and provide easy lookups. There is no limits on leaderboard count. The leaderboards can even be generated in run-time. This can be used for both classic leaderboard functionality and “friends progress”.
HexMob was designed to be suitable for as many applications as possible. Naturally we have decided to add scripting support, it means a developer can write custom server-side scripts and hook them to different events happening in system, such as:
We currently support Python as a server-side scripting language. Scripts have full access to relevant objects. Moreover, scripts are free to update them.
“If all you have is a hammer, everything looks like a nail”
— the golden hammer rule.
It turns out that most user communication can be expressed in terms of multiplayer sessions, especially if you add server-side scripting to the mix.
HexMob also includes a few supporting components which are not a part of the main functionality; however, they are useful while developing mobile applications. File upload service is useful to transfer media data between users. For example, we have used this to implement photo sharing in HeroChat application. Receipt validation service allows to check purchase validity easily in order to prevent unauthorized content access in mobile applications.
HexMob was designed to be scalable from the first day. It consists of the following components:
Web API service is stateless, handles user, which requests and performs “lightweight” actions. All complicated computations are scheduled for Core service to process. Stateless nature of the service allows easy scalability by simple instance duplication.
HexMob Core Service executes long-running tasks scheduled by API service or event scheduler. Tasks are pulled from queue and can run concurrently on as many instances as needed to provide optimal performance.
WebSocket service communicates with active users delivering them nearly real-time event notifications. Multiple nodes may be installed to handle growing user base.
Data storage is built on MongoDB for persistence and Redis is for caching and leaderboard ordering.
Cross-Component communication is based on Redis pub-sub and task lists.