Network - a safe networking tool for bridging remote events, remote functions and more

API / READ ME

EDIT (PSA) So the performance of this module isnt as well compared to all the others i dont recomend using this anymore!

This is a remake of Tyridge77’s network because it is no longer in service and said not to be updated.

By: Flipitagainpls

My friend and I are both scripters and we’re creating a game and Tyridge’s Network was always our go-to. When we were scripting, we kept coming across this one error and neither of us could find out how to fix it, so my friend recommended we create our own instead of fixing a script that wasn’t made by us.

Features: if 1 single event gets fired more than 6 times it will stop all 6 of them and clear the queue,
unreliable events are added for cases where a regular event is not needed,
and all events are created on server when the game starts meaning you will need to have your bindevents function made or else you will get many errors lol.

This module also contains a system whereas each event has a queue that gets removed each time the event is fired. Since the queue ends so quickly, we also built in a second rapid firing system for exploiting or whatever that stops the event when the queue has over 6 attempts.

Recommended: For good performance use 1 event for one occasion as they stop and have debounces or use our fast fire events that don’t have debounces or stops!

NOTE: events cannot have the same name of any type, events also debounce for 2 seconds to prevent rapid firing

Here is the model: Network

Tutorials
-- bind events method
-- client
local Network = require(network location)

Network:FireServer('TestEvent', 'Any string')

-- server

Network:BindEvents({
  TestEvent = function(Player, myString)
        print(myString)
  end,
})

-- prints: 'Any string'
-- bind events method works with any events exept unreliable

-- bind functions method
-- client
local Network = require(network location)

local test = Network:InvokeServer('TestEvent', 'Any string')

if test then
     print('hi')
end

-- server

Network:BindFunctions({
  TestEvent = function(Player, myString)
       return true
  end,
})

-- prints: 'hi' if the server returns true
-- bind functions method works with any remotefunction 

-- Bind Unreliable Events method
-- client
local Network = require(network location)

Network:FireUnreliableEventServer('TestEvent', 'Any string')

-- server

Network:BindUnreliableEvents({
  TestEvent = function(Player, myString)
       print(myString)
  end,
})

-- prints: 'Any string'
-- Bind Unreliable Events method works with any unreliable event


Official API for this Module
Network:FireServer(Name, ...)
  
Network:InvokeServer(Name, ...)  
  
Network:FireUnreliableEventServer(Name, ...)  
  
Network:FireClient(Player, Name, ...)  
  
Network:InvokeClient(Name, ...)  
  
Network:FireAllClients(Name, ...) 
  
Network:FireAllClientsWithinDistance(Name, position, distance, ...) 
  
Network:FireUnreliableEventClient(Player, Name, ...)
  
  -- handlers
  
Network:BindEvents({eventName = function() end,}) 
  
Network:BindFunctions({eventName = function() end,}) 
  
Network:BindUnreliableEvents({eventName = function() end,})

Now, when i first started scripting there were cases where i needed to repeatedly fire an event but with our security you cant do that that is why we made FastFiring remote events and remote functions. These events are unprotected by our security and is handled like a basic
remote event.
  
Network:FastFireServer(...) 
  
Network:FastFireClient(Player, ...) 
  
Network:FastInvokeServer(...)
  
Network:FastInvokeClient(Player, ...)

Please update me on any errors so I can fix them fastly!

UPDATES

  • this will be the official Update pannel for this module
3 Likes

Great job! How recently has the original Network been out of service because I wonder if it’s causing issues in my game?

1 Like

it was causing issues for mine, i seen a post a few weeks ago from the developer that said he wasnt working on it cause he didnt have time

if u said this module is useful, might be for save time but sadly its not for peoples (typical) that cares about performance optimization, error handling safe & other benefits. and i did this real benchmark to comparing some networking modules with this, and here the result test:

(note: i use :FastFireServer already here with 1 argument only, already optimized method, rateLimits disabled & this is just speed performance benchmark comparison)

1 ns = 1000 us
1us = 1000ms
1s = 1000ms

Network: 2.65ms (0% faster, 181.06% slower)
Regular RemoteEvent: 1.33ms (66% faster, 164.05% slower)
Red2: 0.269ms (163.21% faster, 68.32% slower)
BridgeNet2: 0.235ms (167.48% faster, 56.13% slower)
FastNet2: 0.153ms (178.21% faster, 14.73% slower)
Warp: 0.132ms (181% faster, 0% slower)

Network is way more slower than regular remote-events (more than 1.5x).
Warp is 2.8x (almost 3x) faster than Network
Warp is the fastest on benchmark here.

3x = 200%
2x = 100%
1.5x = 50%
1.1x = 10%
1x = 0%

so whats your opinion?
you prefer to choose overall optimized or save time?

BridgeNet1 API functions is almost identic with this (but with way better performance & other benefits over Network & Regular)

so i dont recommended you to use this, its better using other instead but anyways its up to you again.

also this benchmark result might be different with yours due different specification.

Thanks for posting something like this, I remade it because i adored the design of Tyridge’s network and how easy accessible it is, but im definetly not gonna use it now, and im gonna recomend that people dont use it aswell!

Hey, can I get the template for benchmark?