The core server routing infrastructure for the NetworkLib ecosystem.
Reference version: A0.1.0 (use this for matching the client)
This backend processes incoming client messages, manages state, and routes data back to connected nodes based on the requested commands.
NetworkLib provides an ultra-simple, direct, and lightweight way to build multiplayer games or networked software using a single, unified file right in your directory.
NetworkLib is intended to work specially for self-hosted games.
Right now, this can be used for real projects. For instance, check my repository "RubidungLua", where I use this backend for the multiplayer games.
New commands and functionalities are under active development. The current alpha version supports:
SET <name> <value>: Initializes or updates a variable state.GET <name>: Retrieves and returns the specified variable's value.CONST <name> <value>: Declares an immutable, read-only constant.TEMP <name> <value>: Creates a temporary variable that self-destructs after the firstGETrequest.SIGNAL <value>: Broadcasts an immediate event notification to all connected clients.SUB <name>: Subscribes a client to receive real-time notifications whenever the target variable changes.
When sent and received, are transformed to opcodes for reducing bandwidth (soon the std signals will also be transformed)
Main/
| README.md
| go.mod
| client.go => basic test for the server, base for real clients
| client2.go => another client for testing basic interaction
| defs.go => global variables definition
| main.go => main file, calls and initialitzations
| manager.go => receives and sends values
Find this and more at github.com/Pacsfury/NetworkLib-Clients
- Lua: Lua is the first language receiving support
- RL: A small, cool and growing programming lanugage by Mohamed Gonem
Create a function nl:on_signal_received(signal, args), that makes an easier way to interact with signals instead of matching the server responses.
Stability and optimitzations.
A Signal is an asynchronous message pushed instantly to the client, triggering a predefined callback or action upon arrival. Signals can optionally carry arguments.
- Setup: Client B listens for the signal
#subscribed_var_changedwith the argumentpos_x. If received, Client B triggers aGETcommand to sync the player's X position.
Execution Flow:
- Client B sends:
SUB pos_x - Client A sends:
SET pos_x 10 - Server broadcasts to Client B:
#subscribed_var_changed pos_x 10 - Client B automatically updates the game state.