Local Server - pogamesdk/POGAME-HTML5 GitHub Wiki
Running a game from a local server
To make development and testing easier, you can run your game from a local server.
To do this:
- Add the game draft using the Yandex Games Console.
- Configure the localhost server to serve content via SSL.
- Open the game draft by adding the
?game_url=https://localhost
parameter.
[!NOTE] For security reasons, only the
localhost
domain is supported in thegame_url
parameter.
Setting up a local server
There are several ways to set up a local server. One of them is described below:
- Install
npm
following the instructions on the Node.JS website. Usingnpm
, install thehttp-server
package:> $ npm install -g http-server
- Navigate to the game directory and create a certificate and private key via
openssl
:> $ cd path/to/game/ > $ openssl genrsa 2048 > key.pem > $ openssl req -x509 -days 365 -new -key key.pem -out cert.pem # fill in the required information
- Run the game:
> $ http-server --ssl -c-1 -p 8080 -a 127.0.0.1 Starting up http-server, serving ./ through https ... Available on: https://127.0.0.1:8080 Hit CTRL-C to stop the server
- Open the https://localhost:8080 page in your browser. When a security warning appears, click the confirmation button.
Running the game
Open the game draft page in the browser and add a ?game_url=
parameter with the game address on the local server. For example, for a game with the Slug connect-emoji-puzzle
, the link will look like this:
https://pogame.com/game/connect-emoji-puzzle?game_url=https://localhost:8080
After the game launches on the local server, you can use all the SDK features from it.