Yantra, Mantra, Sutra

Yantra.gg Mantra.js Sutra.js

The purpose of these projects

Yantra.gg is a hosting platform for Serverless Physics. You can host high-performance multiplayer games built with Mantra on Yantra.

Mantra.js is a one-of-kind JavaScript game development framework. You can build your games with Mantra.

Sutra.js is a versatile and full-featured Behavior Tree library. You can write custom game logic in JavaScript using Sutra.js

A year of development

It's been about a year since I embarked on my five-year plan to build the AYYO game.

The initial AYYO Alpha has been live and in testing for a few months and generally holds up well. Our integration with cloud provider Hathora allows for low-latency globally available games, and we've spent a virtual lifetime learning and hand-rolling high-speed networking code.

One of the main goals of AYYO is to allow custom maps and level editing for players. We ran successful experiments with several solutions, including a GUI-based editor and the ability to authoritatively run game logic remotely to a globally available server.

With 70,000~ lines of JavaScript code written over a year, I got a better view of the feature matrix required to solve the domain problem of game development.

Lessons learned from the AYYO Alpha

Offline first

This one hurt the most. The initial versions of AYYO would not load any game content until an authoritative server was found. Our cloud provider can spin up a new instance in under 10 seconds. We also tried connecting bots to each region to keep the serverless instances online.

Neither solution was good enough. The game has to be able to load instantaneously and gracefully connect to an authoritative server. A significant segment of new players won't wait 300ms for your game to start. Mantra.js solves this problem with its offline-first approach.

Unification of entity management code on client-server

If you aren't intimately familiar with the domain, this would be a no-brainer; however, it's non-trivial to hand-roll high-performance networking using a shared entity library. The initial versions of AYYO split entity code into client/server folders. This approach works; however, it doubles the required code and can lead to hard-to-solve bugs. Mantra.js solves this problem with its Entity Plugin.

Everything is a Plugin

The game needs to load fast and react quickly. To support any amount of custom functionality or assets, the game itself needs to act as a container in which functionality can be dynamically added or removed in real time.

Mantra.js solves this by shipping as a minimal package available on a CDN. Mantra.js will load your game instantly and can dynamically inject more functionality from remote or local sources without recompiling.

Fluent Behavior Trees for custom game logic

Custom game logic in the initial versions of AYYO relied on semi-structured function signatures, run with context either remotely or locally.

This is the correct approach for custom games; however, without a formalized structure or state machine to manage custom game logic, the code base bloats to immense size, and iterating on game design and game logic can become difficult.

Sutra.js is a formalized and full-featured JavaScript behavior tree library. Sutra features a fluent API syntax and can export it's rules in plain English ( with `i18n` support ).

The Future of Yantra, Mantra, Sutra

Yantra.gg is used to host games developed with the Mantra.js framework. You can build games using Mantra.js and deploy them globally to Yantra.gg with one-line.

Mantra.js and Sutra.js are open-source projects. Mantra.js is the game development framework for creating games in Javascript.

Sutra.js is a stand-alone project focusing only on creating behavior trees in JavaScript. Sutra itself is available as a Plugin to Mantra.js. All custom worlds, entities, and movement systems in Mantra.js are defined using Sutras.

We are working on a vast library of common Sutras available to all Mantra developers. Developers using the Mantra game framework can build custom worlds using a fluent coding syntax or directly in-game utilizing the editor.

Contributing / Building a Game

If you are interested in contributing to these libraries or getting started with building a game with Yantra, Mantra, or Sutra, the best place to start is the Mantra.js Github project or joining our Discord

Be excellent to each other.