Skip to main content

Yantra Documentation

Let's learn all about developing your first serverless physics world on Yantra!

Getting Started

JUMP AHEAD TO GAME DEV QUICKSTART

What you'll need

  • Node.js version 16.14 or above:
    • When installing Node.js, you are recommended to check all checkboxes related to dependencies.

Install Yantra SDK

Install the SDK CLI (Command Line Tool) with npm:

npm install -g @yantra-core/cli

Now you can run the yantra command on your system.


__ __ _ _____ _ _____
\ \ / / | | / ____| | |_ _|
\ \_/ /_ _ _ __ | |_ _ __ __ _ | | | | | |
\ / _` | '_ \| __| '__/ _` | | | | | | |
| | (_| | | | | |_| | | (_| | | |____| |____ _| |_
|_|\__,_|_| |_|\__|_| \__,_| \_____|______|_____|


Usage: [options] [command]

Yantra Serverless Physics Platform CLI

Options:
-V, --version output the version number
-h, --help display help for command

Commands:
init Initialize a new world in the current directory
clone Clone a world from the Yantra library
deploy Deploy your physics world
list List your worlds
info Checks current directory for a Yantra world and displays information about it
rm Remove a world
whoami Display the current user
login Login to Yantra using OTP or create an account if it does not exist
logout Logs CLI client out of Yantra
recover Recover your account names by email address
help [command] display help for command

Developing your world locally

Yantra is a Serverless Physics Platform

At its core, Yantra provides a spatially zoned-based distributed physics world that allows developers to connect via Websocket connection to receive, mutate, and send back world state.

Your game will integrate Yantra SDK, create entities in the physics world, subscribe to the world's game state, and be able to send game state updates such as force, velocity, mass, rotation, position, etc.

Connect to Yantra with Websocket

During development, you will connect your local client code to the Yantra service via the Yantra SDK.

Receive, mutate, and send gamestate

Your game code will listen for the gamestate event, emitted from the Yantra server once per game tick. You may then construct new state updates to send back to the Yantra server for merging.

Jump to Code Examples

Deploy your world to production

Ready to deploy your code to production?

The yantra deploy command will publish your code globally into Yantra's autoscaling system.

yantra deploy

After a successful deployment, the CLI tool will output a link to your game that you can share with friends.

Once deployed, your physics world will be available globally on our low-latency servers. Each Yantra world will autoscale its instances based on the maxPlayers config setting, allowing thousands of simultaneous globally connected players.