Running your own server

This page demonstrates on how to setup ones own Lurkers.io server, including scripting custom gamemodes.

Start a basic server
First, download the latest server.jar.

Then run it with:

Run a dedicated headless server
If you want to run a server all the time, it is useful to run your server as headless and setup a service so it will restart if it fails for some reason.

Download server_setup.sh - this is a bash script that will install a service which continuously runs your server. It requires systemd to be available.

Adding SSL
Simply add your "key.pem" and "cert.pem" adjacent to the "server.jar".

It will tell you that the certificate was found and SSL will automatically be enabled for your server.

Note that the client must be using HTTPS for this to work.

Writing a simple gamemode
Without any script loaded, any player who joins the game will only be allowed to spectate. Most of the game rules are all scripted with Lua.

Below is an example of a sandbox gamemode where you spawn as a human with 5000 coins. There isn't too much to it, but it is very easy to expand on.

Try saving it as sandbox.lua next to your server.jar, then running the server with: setup_default_game = dofile("scripts/modules/setup_default_game.lua") simple_shop = dofile("scripts/modules/simple_shop.lua") local shop = addSimpleShop

-- Sandbox gamemode Game:updateConfigs({   gameMode = "Sandbox",    gameDescription = [===[There is no specific aim with this gamemode. Press B to open the shop. You start with a lot of money!]===],    friendlyFire = "true",    spawnItems = "false", })

-- Spawn players when they join the game Event:addPeerOpenedListener(function(peer)   handleSpawnPeer(peer) end)

-- Just returns an inventory with 5000 coins function getHumanStartInventory local inventory = {}

table.insert(inventory, {   type = "coin",    quantity = 5000    })

return inventory end

-- Spawns a peer as a human function handleSpawnPeer(peer) local inventory = getHumanStartInventory

spawnPeerWithTimerAndCounter(peer, playerSpawnDelay, "Human", Level:getRandomSpawnPoint("playerSpawn"), "Respawning in" ,function(human)       spawnPeerHuman(peer, human)    end, inventory) end

-- When the player is spawned, add a death respawn listener and let the peer control the human function spawnPeerHuman(peer, human) human:addDeathListener(function       handleSpawnPeer(peer)    end)

peer:controlEntity(human) end

Lua Reference
It is possible to write your very own gamemodes for your server using Lua.

See the Lua Reference for a list of all the available commands.