Skip to content

blazium-engine/lobby-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lobby Documentation

This is a documentation for getting started with the Lobby Service.

  1. Server Config
  1. Scripting Backend
  1. Test Script

Check also:

LUA SCRIPTING ANGELSCRIPT SCRIPTING

1. Server Config

Run locally

In order to run it, you need to run the lobby_service binary from command line from this repo:

lobby_service -h

Will print:

Usage: ./lobby_server [--verbose] [--disable-metrics] [--skip-login] [--logout] [--generate-config]

Config file

The lobby_service uses a config.ini file and a games.ini file. The config.ini file contains configurations that are specific to the lobby_service. One notable setting is the:

[games]
scripts_folder=scripts

By overriding this, you can set the scripts_folder to any folder you want. This is the folder where you can script logic on the server side.

Game Config file

The games.ini config file contains a mapping between the scripts folder and the game_id. You also set there the scripting language you want to use, if any, for the game.

  • disband on leave (should the game disband when host leaves?):
lobby_control=true # Default is false
  • tickrate (If you enable this the _on_lobby_tick callback will be enabled):
tickrate=10 # Default is 0
  • sendrate (How often should messages be sent. If you enable this messages will be batched):
sendrate=10 # Default is 0
  • lua example
[19289469-294c-4ff7-89a3-78528d8e6c17]
lobby_control=lua
folder=draft
  • angelscript example
[b006a006-40b1-4ff0-87be-0aad85309bec]
lobby_control=angelscript
folder=draft
  • relay example (no scripting backend)
[19289469-294c-4ff7-89a3-78528d8e6c17]
lobby_control=relay

2. Scripting Backend

Lua Backend

See LUA_SCRIPTING.md for details on using Lua scripting with the Lobby Service.

AngelScript Backend

See ANGELSCRIPTING.md for details on using AngelScript scripting with the Lobby Service.

Relay Backend

If you set lobby_control as relay, then there is no scripting backend and you are not required to set the folder.

3. Test Script

There is also a test script that can be run in nodejs which tests the functionality of the draft project. It connects a user, creates a lobby and calls the function echo, then leaves the lobby. It exits after 3 seconds. (To run it you have to start the lobby server)

cd test
npm i
npm run test

It should print something like this:

[Lua] Open
[Lua] Message: [
  {
    command: 'peer_state',
    data: { peer: [Object] },
    message: 'Initial Message'
  },
  {
    command: 'lobby_created',
    data: { id: '', lobby: [Object], peers: [Array] },
    message: 'Lobby created'
  },
  {
    command: 'lobby_call',
    data: { id: 'echo', result: 'Lua test' },
    message: 'Lobby Call'
  },
  { command: 'lobby_left', data: { id: '' }, message: 'Lobby Left' }
]
[AngelScript] Open
[AngelScript] Message: [
  {
    command: 'peer_state',
    data: { peer: [Object] },
    message: 'Initial Message'
  },
  {
    command: 'lobby_created',
    data: { id: '', lobby: [Object], peers: [Array] },
    message: 'Lobby created'
  },
  {
    command: 'lobby_call',
    data: { id: 'echo', result: 'AngelScript test' },
    message: 'Lobby Call'
  },
  { command: 'lobby_left', data: { id: '' }, message: 'Lobby Left' }
]

About

A template for starting up with lobby

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published