personal fork of https://github.com/castle-xyz/share.lua for messing about with
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Nikhilesh Sigatapu 526e86aeaa use channel count in `host:connect` 3 years ago
README.md remove note that we use 'lua-marshal' -- cuz we don't anymore 3 years ago
cs.lua use channel count in `host:connect` 3 years ago
example_castle.lua have separate 'example_local.lua' and 'example_castle.lua' entry-points 4 years ago
example_client.lua rename castle-related API, allow disabling compression 4 years ago
example_local.lua have separate 'example_local.lua' and 'example_castle.lua' entry-points 4 years ago
example_server.lua flush on client kick, auto-kick on quit 4 years ago
state.lua do proper `nil` check 3 years ago
tests.lua add fix and test issue when `nil`-ing out an entire table w/ relevance 4 years ago

README.md

share.lua

share.lua is a set of modules that aims to make it easier to make multiplayer games with Lua, especially with LÖVE and Castle. LÖVE provides the lua-enet library that is used for network communication. Castle can also be used to automatically run a game server in the cloud.

Files in this repository:

  • state.lua -- A 'state' data structure that keeps track of changes to itself so that they can be sent over the network. Can store any serializable data. Every table in a state can only appear once (and thus cycles are not allowed either).
  • tests.lua -- Tests for the state data structure.
  • cs.lua -- 'client' and 'server' modules that allow setting up events to listen for on clients and servers and hook up state data structures for transferring data. The 'share' state can be written to by the server and read by all clients, and each client gets a 'home' state that it can write to and the server can read.
  • example_server.lua, example_client.lua -- Example usage of the 'cs' module. Start here to learn how to use these modules.
  • example_local.lua -- Run both the example client and the server locally in the same process for easy testing.
  • example_castle.lua -- Run the example client locally and the server in the cloud using Castle.