camchenry / Sock.lua
Licence: mit
A Lua networking library for LÖVE games.
Stars: ✭ 121
Programming Languages
lua
6591 projects
Projects that are alternatives of or similar to Sock.lua
Game Networking Resources
A Curated List of Game Network Programming Resources
Stars: ✭ 4,208 (+3377.69%)
Mutual labels: gamedev, networking
Librg
🚀 Making multi-player gamedev simpler since 2017
Stars: ✭ 813 (+571.9%)
Mutual labels: gamedev, networking
Enet Csharp
Reliable UDP networking library
Stars: ✭ 464 (+283.47%)
Mutual labels: gamedev, networking
Noobhub
🌐🔥 Network multiplayer and messaging for CoronaSDK, Moai, Gideros, LÖVE & Defold
Stars: ✭ 259 (+114.05%)
Mutual labels: love2d, networking
Netdynamics
Data-oriented networking playground for the reliable UDP transports
Stars: ✭ 65 (-46.28%)
Mutual labels: gamedev, networking
Valvesockets Csharp
Managed C# abstraction of GameNetworkingSockets library by Valve Software
Stars: ✭ 273 (+125.62%)
Mutual labels: gamedev, networking
Bytepath
A replayable arcade shooter with a focus on build theorycrafting made using Lua and LÖVE.
Stars: ✭ 1,119 (+824.79%)
Mutual labels: gamedev, love2d
superfeather
SNES game engine in 65816 assembly, focusing on performance, flexibility, convenience
Stars: ✭ 31 (-74.38%)
Mutual labels: gamedev, love2d
Love
LÖVE is an awesome 2D game framework for Lua.
Stars: ✭ 1,305 (+978.51%)
Mutual labels: gamedev, love2d
awesome-playdate
A list of awesome resources for Playdate (https://play.date) game development and the Playdate SDK (https://play.date/dev/)
Stars: ✭ 149 (+23.14%)
Mutual labels: gamedev, love2d
Laminar
A simple semi-reliable UDP protocol for multiplayer games
Stars: ✭ 530 (+338.02%)
Mutual labels: gamedev, networking
Enet
⚡️ ENet reliable UDP networking library
Stars: ✭ 202 (+66.94%)
Mutual labels: gamedev, networking
Lance
Multiplayer game server based on Node.JS
Stars: ✭ 1,161 (+859.5%)
Mutual labels: gamedev, networking
sock.lua
sock.lua is a networking library for LÖVE games. Its goal is to make getting started with networking as easy as possible.
sock requires enet (which comes with LÖVE 0.9 and up.)
Features
- Event trigger system makes it easy to add behavior to network events.
- Can send images and files over the network.
- Can use a custom serialization library.
- Logs events, errors, and warnings that occur.
Installation
- Clone or download sock.lua.
- Clone or download bitser.*
- Place bitser.lua in the same directory as sock.lua.
- Require the library and start using it.
sock = require 'sock'
* If custom serialization support is needed, look at setSerialization.
Example
local sock = require "sock"
-- client.lua
function love.load()
-- Creating a new client on localhost:22122
client = sock.newClient("localhost", 22122)
-- Creating a client to connect to some ip address
client = sock.newClient("198.51.100.0", 22122)
-- Called when a connection is made to the server
client:on("connect", function(data)
print("Client connected to the server.")
end)
-- Called when the client disconnects from the server
client:on("disconnect", function(data)
print("Client disconnected from the server.")
end)
-- Custom callback, called whenever you send the event from the server
client:on("hello", function(msg)
print("The server replied: " .. msg)
end)
client:connect()
-- You can send different types of data
client:send("greeting", "Hello, my name is Inigo Montoya.")
client:send("isShooting", true)
client:send("bulletsLeft", 1)
client:send("position", {
x = 465.3,
y = 50,
})
end
function love.update(dt)
client:update()
end
-- server.lua
function love.load()
-- Creating a server on any IP, port 22122
server = sock.newServer("*", 22122)
-- Called when someone connects to the server
server:on("connect", function(data, client)
-- Send a message back to the connected client
local msg = "Hello from the server!"
client:send("hello", msg)
end)
end
function love.update(dt)
server:update()
end
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].