Repository navigation
Releases: getbraincloud/braincloud-lua
Release list
6.1.1
6.1.0
Beta Release : 6.1.0
Questions or feedback? Join the community forums on getbraincloud.com!
brainCloud Lua SDK 6.1.0 — Initial Release
The first release of the official brainCloud client for Lua games: authentication, cloud data, leaderboards, lobbies, chat, real-time events (RTT) and relay multiplayer.
Highlights
- LÖVE 11.4+ and LÖVE 12 (LuaJIT) on macOS, Windows and Linux.
- Plain LuaJIT / Lua 5.1 with LuaSocket + LuaSec, for servers, tools and other engines.
- Web builds through love.js: HTTP and WebSockets go through the page with the included
braincloud/web/braincloud-web.jsbridge. - Nothing blocks. Requests run in the background and callbacks fire from
bc:update()each frame. - Drop-in install. Copy the
braincloud/folder next tomain.lua. There are no extra dependencies to install for LÖVE.
Features
- Full service coverage, matching the other brainCloud client SDKs: Authentication, Identity, Entity / Global Entity / Custom Entity, Leaderboard, Tournament, Lobby, Matchmaking, Chat, Messaging, Presence, Friend, Group, Event, Gamification, Player State & Statistics, Global Statistics, Virtual Currency, App Store, Item Catalog, User Items, Mail, Push Notifications, File / Global File / Group File, Script, Async Match, One-Way Match, Playback Stream, Data Stream, Campaign, Redemption Codes, Profanity, Time, Blockchain and more.
- Same comms behaviour as the C#/C++ clients: calls made in one frame are bundled into a single request, with packet ids, auth timeouts, the kill switch, and caching and retry on network errors.
- Saved logins: profile and anonymous ids are kept in LÖVE's save directory, so
authenticateAnonymousreturns the same player on the next launch.smartSwitchAuthenticate*moves an anonymous player to a real login. - Real-time (RTT): lobby, chat, presence, messaging and event callbacks.
- Relay multiplayer: WebSocket (
ws/wss), TCP and UDP, with reliable and ordered channels. - Compression: gzip compression on LÖVE.
- Long sessions: automatic reconnect.
Native networking pack
braincloud/native/ provides LuaSec + OpenSSL builds for macOS (universal, Developer ID–signed and notarized), Windows x64 and Linux x64.
- LÖVE 12 uses its built-in
love.httpsfor REST and needs the pack only for secure WebSockets (RTT). - LÖVE 11.x needs the pack for both HTTPS and RTT.
- In a packaged
.loveor a fused executable, the SDK copies the natives to the save directory on first run, because LÖVE can't load them from inside an archive. - Leave
braincloud/native/out of web builds.
| REST | RTT / secure WebSocket | Relay | |
|---|---|---|---|
| LÖVE 12 | built in (love.https) |
native pack | built in |
| LÖVE 11.4 / 11.5 | native pack | native pack | built in |
| Web (love.js) | web bridge | web bridge | wss only |
| Plain LuaJIT | LuaSec | LuaSec | LuaSocket |
Setup tool
tools/braincloud-setup.love signs you in to brainCloud in your browser, lets you pick or create an app, and writes braincloud_config.lua, which it also adds to .gitignore. Your game then calls bc:init() with no app id or secret in code:
love path/to/braincloud-lua/tools/braincloud-setup.love .For CI, run luajit tools/setup/cli.lua --refresh with BRAINCLOUD_APP_ID, BRAINCLOUD_BUILDER_EMAIL, BRAINCLOUD_BUILDER_API_KEY and BRAINCLOUD_TEAM_ID set. To initialize manually instead, call bc:initialize(appId, appSecret, appVersion, serverUrl).
Quick start
local BrainCloud = require("braincloud")
local bc = BrainCloud.new()
function love.load()
bc:init()
bc:authenticateAnonymous(function(ok, response)
print(ok and response.data.profileId or response.status_message)
end)
end
function love.update()
bc:update()
endInstall
- LÖVE: download
braincloud-lua-6.1.0.zipbelow and copy thebraincloud/folder into your game. - LuaRocks:
luarocks install braincloud
Example
lua-examples contains CursorParty, a complete lobby → relay multiplayer game. It runs in the same lobbies as the CursorParty apps for the other brainCloud SDKs.
License
Apache 2.0. Bundled third-party code (LuaSec, OpenSSL, lua-https) is listed in THIRD_PARTY_NOTICES.md.