online.module
This package holds more than this page lists. See all of its files in its world.
README.md
net/online
Online with friends for Bola na Rede, built on Table Codes (net.roomsKit).
Rooms of six seats (three a side) joined by a short letter code; the host
picks clubs, AI difficulty and length and starts; empty seats are AI and a
guest who leaves (or goes silent for a second) is handed to the AI at once.
The host runs the only sim (sim.match); guests send raw input at 30 Hz,
the host broadcasts snapshots with events at 20 Hz; guests draw everyone
100 ms behind (interpolated), predict their own player (input replay from the
host's position, error eased out) and replay the host's events through the
sim's emit, so sounds, callouts and goals match on every screen.
Called by ui.BolaShell: setHooks, tick(dt) every frame, beginMatch /
endMatch, and the lobby calls (create, join, leave, sit, lobby,
setSetting, stepClub, startMatch). corrections() reports the size of
the guest's own-player corrections.
local Online = require("net.online")
Online.create() -- host a room; Online.lobby().code is the code to share
Online.join("KP7X") -- a friend joins