Running a game from a local server
To facilitate development and testing of your game, you can run the game on your local server. To do this:
- Add your game's draft using the Yandex Games Console.
- Set up your
localhost
server. - Open the game in draft mode by adding the
?game_url=https://localhost
parameter to the URL.
Note
For security reasons, only the localhost
domain is supported in the game_url
parameter.
Setting up a local server
-
Install
npm
following the instructions on the Node.JS website. -
Use
npm
to install the @yandex-games/sdk-dev-proxy package:npm install -g @yandex-games/sdk-dev-proxy
-
Run your game. To do this, you can:
Proxy to your local serverSpecify the game source foldernpx @yandex-games/sdk-dev-proxy -h <Local server URL>
npx @yandex-games/sdk-dev-proxy -p <Path to the game folder>
The package proxies the requests to the SDK resources hosted on the same server as your game.
If you want to run your game at yandex.com/games, specify the --app-id
parameter:
npx @yandex-games/sdk-dev-proxy -p <Path to the game folder> --app-id=<Game ID>
If you omit the --app-id
parameter, the console shows the default link to your game on Yandex Games and the link to your local server.
After the game launches on the local server, you can use all the SDK features from it.
Launch parameters
Parameter |
Description |
|
Shows the help message. |
|
Hostname for your local game server (for example, this parameter is used for the |
|
Path to your game's source folder. |
|
Port to access the server (the default port is 8080). |
|
Game draft ID. |
|
Adds the meta tag with the |
|
Enables logging of requests to the console (enabled by default). |
|
Changes the extension in the |