A lightning fast networking solution for roblox.

Related tags

Command-line zap
Overview

Zap

Zap is a blazingly fast networking solution for Roblox.

Features

  • Zap packs data into buffers with no overhead. The same data can be sent using a fraction of the bandwidth.
  • Zap doesn't compromise on performance. Zap's packing and unpacking is typically faster than Roblox's generic encoding.
  • For both the IDL and API, Zap is a joy to use. It's easy to learn, easy to use, and easy to debug. It's the best DX you'll find.
  • Zap is fully secure. Buffers make reverse engineering your game's networking much harder and Zap validates all data received.

Here There be Dragons!

Zap is currently in a early pre-release state. The API may change over time and there are likely bugs. Please report any issues you find through github issues.

Documentation

Documentation can be found here.

Contributing

Contributions are welcome! Please open an issue before you start working on a feature or bug fix so we can discuss it.

Logo

Zap Logo sourced from Twitter and is under the CC BY 4.0 license.

Comments
  • [FEAT] Remove Instance Overhead

    [FEAT] Remove Instance Overhead

    Describe your feature

    Currently instances are placed into a single large array, and then the index of the instance in that array is written to the buffer. This wastes the two bytes written to the buffer. As Zap serializes and deserializes in the same order, instances will be written to the array in the same order.

    A type like this: Instance(BasePart) is currently outputted as the following:

    function types.write_basePart(value: basePart)
    	local pos = alloc(2)
    	buffer.writeu16(outgoing_buff, pos, alloc_inst(value))
    end
    function types.read_basePart()
    	local value;
    	value = incoming_inst[buffer.readu16(incoming_buff, read(2))]
    	assert(value ~= nil)
    	return value
    end
    

    With this change implemented this will be changed to this:

    function types.write_basePart(value: basePart)
    	table.insert(outgoing_inst, value)
    end
    function types.read_basePart()
    	local value;
    	value = table.remove(incoming_inst)
    	assert(value ~= nil)
    	return value
    end
    

    Again, this is possible because we serialize and deserialize in the same order - so instances will be written and read from the inst buffer in the same order.

    Alternatives

    I have not considered any alternatives at this moment.

    Implementation Details

    This could cause issues if we ever have non-deterministic serialization or deserialization order in the future.

    Additional context

    N/A

    enhancement 
    opened by jackdotink 2
  • [FEAT] Support for CFrames

    [FEAT] Support for CFrames

    Describe your feature

    Zap should support the CFrame datatype.

    Alternatives

    The alternative is not supporting CFrames.

    Implementation Details

    The slowest way we can impliment it is by sending i32[12] from CFrame:GetComponents. This is expensive and wastes network bandwidth.

    The challenge with CFrames is that Roblox uses a lot of compression methods for sending CFrames. We also should do this - we just need to research how it is done to avoid sending 12 i32s.

    enhancement 
    opened by sasial-dev 2
  • [FEAT] Trim dead code in codegen

    [FEAT] Trim dead code in codegen

    Describe your feature

    Codegen currently has a lot of dead code if network definition files don't define enough variations of events. This makes linters upset because they flag unused functions and variables.

    Alternatives

    A simple workaround for this issue would be to include comments at the top of the generated code to silence Selene and the Luau linter. However, this isn't ideal and the better solution is to actually trim dead code.

    enhancement 
    opened by grilme99 2
  • [BUG] Luau reports typechecking error on strict

    [BUG] Luau reports typechecking error on strict

    Describe the bug

    Luau currently reports a type error in strict mode for code generated for the client. This is due to when using :WaitForChild, the return value is Instance while we know that it's a RemoteEvent. The function FireServer does not exist on type Instance thus correctly reporting an error.

    Reproduction

    Just generate any code for the client. It should cause a type error in strict mode.

    Expected behavior

    The generated code should not give off any type error.

    Potential Fix

    Typecast the resulting return value to be RemoteEvent / UnreliableRemoteEvent

    bug 
    opened by Aloroid 1
  • Delay event connection 5 frames on client

    Delay event connection 5 frames on client

    This change is important to support events that are fired the frame the client joins the game. Without the delay, the client won't have enough time to connect to the events.

    opened by nezuo 1
  • [FEAT] Clarify output FS errors

    [FEAT] Clarify output FS errors

    Describe your feature

    While using the CLI, you can run into filesystem errors which don't clearly describe what the issue is.

    These error messages should be more descriptive, pointing users to solutions. As a quality of life feature for output directories, any nonexistent directories should be created during execution.

    Examples

    For instance, a config that looks like this

    opt output_client = ./network/client.luau
    opt output_server = ./network/server.luau
    

    ...will cause the following generic and unclear filesystem error on Windows if no ./network directory exists:

    Error: The system cannot find the path specified. (os error 3)
    

    A similar error,

    Error: The system cannot find the file specified. (os error 2)
    

    ...is output if the path provided to the config file is invalid.

    Alternatives

    Both of these are minor issues, so creating the directories in question and/or ensuring file paths are correct both work. The docs could also cover these common mistakes.

    enhancement 
    opened by Crystalflxme 1
  • [BUG] des ranges aren't max inclusive

    [BUG] des ranges aren't max inclusive

    Describe the bug

    Ranges aren't max inclusive, the value is 1, but it's checking if it's < 1

    Reproduction

    Link to playground with accurate reproduction https://zap.redblox.dev/playground.html?code=ZXZlbnQgcm91bmQgPSB7Cglmcm9tOiBTZXJ2ZXIsCgl0eXBlOiBSZWxpYWJsZSwKCWNhbGw6IFNpbmdsZVN5bmMsCglkYXRhOiBTdHJpbmdbNF0KfQoKZXZlbnQgY29tbWFuZCA9IHsKCWZyb206IENsaWVudCwKCXR5cGU6IFVucmVsaWFibGUsCgljYWxsOiBTaW5nbGVTeW5jLAoJZGF0YTogewoJCWRlbHRhVGltZTogZjMyLAoJCVg6IGk4ICgtMS4uMSksCgkJWjogaTggKC0xLi4xKQoJfSwKfQo=

    Expected behavior

    That ranges are max inclusive, so that this bug doesn't happen

    bug 
    opened by As8D 1
  • Fix fire in player added

    Fix fire in player added

    Firing a remote on the server inside PlayerAdded is not guaranteed to exist because the user's connection can run before zap's. This fixes the issue by initializing the player inside of fire functions instead of PlayerAdded.

    opened by nezuo 0
  • [FEAT] Support for Color3s

    [FEAT] Support for Color3s

    Describe your feature

    Zap should support the Color3 datatype.

    Alternatives

    Sending 3 doubles is less efficient than sending a single Color3.

    Implementation Details

    I think most people only need 8 bits of accuracy per color channel, but for HDR colors I guess you need to bump it to the next largest size which is 16 bits of accuracy per color channel. I would assume a Color3 channel range of [0, 1].

    enhancement 
    opened by ArchLand64 0
  • Add the `unknown` type

    Add the `unknown` type

    Docs are left to write.

    The unknown type is an escape from when we do not know the structure of the data and must instead get Roblox to serialise it. This can be a footgun and only should be used in specific circumstances.

    opened by sasial-dev 0
  • remove local spam

    remove local spam

    At the moment Zap generated code is at risk of hitting the local limit. This change removes the creation of a local for each write and instead uses a single local.

    opened by jackdotink 0
  • [BUG] Luau reports typechecking error in strict mode on Server Output

    [BUG] Luau reports typechecking error in strict mode on Server Output

    Describe the bug

    Luau reports a type checking error on the server output since variables reliable and unreliable are of type Instance?.

    Reproduction

    Any server output with an event

    Expected behavior

    Not produce a type error

    image

    bug 
    opened by Aloroid 0
  • [FEAT] Support RemoteFunctions

    [FEAT] Support RemoteFunctions

    Describe your feature

    Events should be able to return a value

    Alternatives

    Creating two events (one for each way)

    Implementation Details

    Careful decision will have to be made as to if we use RemoteEvents under-the-hood and then create a mock remotefunction-like interface in zap (so we don't yield the thread!).

    enhancement 
    opened by sasial-dev 0
  • [FEAT] Make data field in events optional

    [FEAT] Make data field in events optional

    Describe your feature

    Making data optional would enable sending remotes without any data.

    Alternatives

    Adding a void type. This adds another type that isn't necessary and it's more difficult to maintain because you need to make sure it's being used correctly.

    enhancement 
    opened by nezuo 0
  • Add manual event loop option

    Add manual event loop option

    Adds a manual_event_loop option which exports a send_events function when true. This is useful when the user can schedule send_events after all their other code that runs in the frame.

    opened by nezuo 2
  • [FEAT] Addition of an `OR` operator for types

    [FEAT] Addition of an `OR` operator for types

    Describe your feature

    The addition of an OR operator for types will create better data definitions with less overhead, compared to tagged enum alternatives. The operator can function similar to Luau i.e. type bool_or_u8 = boolean | u8

    Alternatives

    Using tagged enums will in essence function as an OR, however there is more overhead. i.e.

    enum "Type" {
        Number {
            Value: f64,
        },
    
        String {
            Value: string,
        },
    }
    

    WILL CREATE -->

    ({
    	Type: "Number",
    	Value: (number),
    } | {
    	Type: "String",
    	Value: (string),
    })
    

    meaning that there is now an overhead of both a string and the value's type.

    enhancement 
    opened by Calamixy 2
  • [FEAT] Support for Namespaces

    [FEAT] Support for Namespaces

    Describe your feature

    In a large complex game, the remotes used can generally be grouped into categories. Zap should support a namespace under the event struct, and when a namespace is specified, you should be able to access it through remotes.namespace.remote_name.

    Alternatives

    • Do not organise the events
    • Use mutiple zap config files

    Implementation Details

    This should be implimented under the event struct with an optional namespace field.

    enhancement 
    opened by sasial-dev 1
Releases(v0.5.1)
An eye that keeps track of your Roblox status and shares it with others

Roblox presence for Discord with only one native standalone executable that relies on zero external dependencies, and doesn't need to be installed.

null 7 Dec 25, 2022
⚡️ Lightning-fast and minimal calendar command line. Written in Rust 🦀

⚡️ Lightning-fast and minimal calendar command line. It's similar to cal. Written in Rust ??

Arthur Henrique 36 Jan 1, 2023
🌳 A lightning-fast system fetch tool made with Rust.

?? treefetch A lightning-fast minimalist system fetch tool made in Rust. Even faster than neofetch and pfetch. Made to practice my new Rust skills ??

Angelo-F 134 Dec 14, 2022
My solution for the advent of code 2021, mainly written in Rust

Advent-of-Code-2021 My solution for the advent of code 2021, written in Rust Error Handle NOPE!!! unwrap() everything everywhere Use To run all of the

Nguyen Le Duy 0 Jan 8, 2022
A simple solution for scoped styles in Leptos

Styled: Easy Styling for Leptos Components If you're looking for an easy way to apply scoped styles to your Leptos components, Styled is the Leptos ma

Eran Boodnero 8 Mar 5, 2023
A light-as-air client/server networking library for Rust

aeronet A light-as-air client/server networking library with first-class support for Bevy, providing a consistent API which can be implemented by diff

null 10 Nov 2, 2023
Core Lightning plugin for sending zap (NIP-57) notes

Core Lightning plugin for sending zap events You can add the plugin by copying it to CLN's plugin directory or by adding the following line to your co

null 8 Mar 13, 2023
A GPT-3 access point through Nostr, powered by lightning

Geppeto A Nostr based API for GPT-3, powered on Lightning. The bot listens for event kind 29000 (inspired by NIP-9000) and will query the prompt to th

null 5 May 24, 2023
Core lightning (CLN) plugin to watch channel health, gossip health and ping amboss for online status

vitality Core lightning (CLN) plugin to watch channel health, gossip health and ping amboss for online status Installation Building Usage Telegram Opt

null 4 Oct 6, 2023
PyO3 bindings and Python interface to skani, a method for fast fast genomic identity calculation using sparse chaining.

?? ⛓️ ?? Pyskani PyO3 bindings and Python interface to skani, a method for fast fast genomic identity calculation using sparse chaining. ??️ Overview

Martin Larralde 13 Mar 21, 2023
A blazingly fast rust-based bionic reader for blazingly fast reading within a terminal console 🦀

This Rust-based CLI tool reads text and returns it back in bionic reading format for blazingly fast loading and even faster reading! Bionic reading is

Ismet Handzic 5 Aug 5, 2023
A full featured, fast Command Line Argument Parser for Rust

clap Command Line Argument Parser for Rust It is a simple-to-use, efficient, and full-featured library for parsing command line arguments and subcomma

null 10.4k Jan 10, 2023
Alacritty - A fast, cross-platform, OpenGL terminal emulator

Alacritty is a modern terminal emulator that comes with sensible defaults, but allows for extensive configuration. By integrating with other applications, rather than reimplementing their functionality, it manages to provide a flexible set of features with high performance. The supported platforms currently consist of BSD, Linux, macOS and Windows.

Alacritty 43.8k Dec 31, 2022
A hackable, minimal, fast TUI file explorer, stealing ideas from nnn and fzf.

xplr A hackable, minimal, fast TUI file explorer, stealing ideas from nnn and fzf. [Quickstart] [Features] [Plugins] [Documentation] [Upgrade Guide] [

Arijit Basu 2.6k Jan 1, 2023
zoxide is a blazing fast replacement for your cd command

zoxide A smarter cd command for your terminal zoxide is a blazing fast replacement for your cd command, inspired by z and z.lua. It keeps track of the

Ajeet D'Souza 8.7k Dec 31, 2022
This is choose, a human-friendly and fast alternative to cut and (sometimes) awk

Choose This is choose, a human-friendly and fast alternative to cut and (sometimes) awk Features terse field selection syntax similar to Python's list

Ryan Geary 1.4k Jan 7, 2023
fd is a program to find entries in your filesystem. It is a simple, fast and user-friendly alternative to find

fd is a program to find entries in your filesystem. It is a simple, fast and user-friendly alternative to find. While it does not aim to support all of find's powerful functionality, it provides sensible (opinionated) defaults for a majority of use cases.

David Peter 25.9k Jan 9, 2023
A very fast implementation of tldr in Rust

A very fast implementation of tldr in Rust: Simplified, example based and community-driven man pages.

Danilo Bargen 2.9k Dec 31, 2022
fastmod is a fast partial replacement for the codemod tool

fastmod is a fast partial replacement for codemod. Like codemod, it is a tool to assist you with large-scale codebase refactors, and it supports most of codemod's options.

Facebook Incubator 1.4k Dec 29, 2022