Skip to content

Commit

Permalink
v0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ffrostfall committed Jun 8, 2023
1 parent 30a696d commit 50a7896
Show file tree
Hide file tree
Showing 43 changed files with 1,058 additions and 1,036 deletions.
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"robloxLsp.workspace.rojoProjectFile": "testing"
"robloxLsp.workspace.rojoProjectFile": "testing",
"luau-lsp.completion.imports.separateGroupsWithLine": true,
"luau-lsp.completion.imports.enabled": true,
"luau-lsp.sourcemap.rojoProjectFile": "testing.project.json",
"luau-lsp.completion.imports.requireStyle": "alwaysRelative"
}
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
# BridgeNet2

This project uses semver.
This project uses [semver](https://semver.org/spec/v2.0.0.html).

## version 0.3.0: 6/8/2023

- Added Hoarcekat support
- Massive internal re-structuring
- Renamed `FromIdentifier` and `FromCompressed` to `Serialize` and `Deserialize`
- NumberToBestForm removed (feature bloat)
- StartLogging and StopLogging have been removed in favor of `object.Logging =`
- Logging now displays the packet size in bytes (using @PysephWasntAvailable's [RemotePacketSizeCounter](https://github.com/PysephWasntAvailable/RemotePacketSizeCounter) package)
- Compliant with strict Luau typing
- Type improvements
- Internally commented the entire project
- Removed SetSecurity and SecurityEnums in favor of `HandleInvalidPlayer`
- Literally dozens of bugfixes

## version 0.2.2

Expand Down
10 changes: 8 additions & 2 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
# Setup

---

- Run `aftman install`
- Run `wally install`
- Start syncing `testing.project.json` for feature-related things, `stresstest.project.json` for performance-related things.

# Contributing

---
- Make sure you have selene, Roblox LSP, StyLua and wally (to prevent unnecessary lints / warns)

- **Do not publicly export functions directly.** There should always be something in the middle- preferably a file that returns a function.
- Make sure you format all edited files before finalizing a PR. I'll set up actions for this eventually.
- All new files must end in .luau if they are in the Luau lang. That being said- avoid creating new files. It clutters the source directory.

# What to look out for

---

- When fixing a bug, make sure to comment the bugfix if necessary- if it's an edge case for example, that requires a few extra lines, make comment that explains why that bug fix is there.
- Avoid placing anything remotely performance-intensive inside of things like callback runners, middleware, outbound bridges, etc.
- Never intrude on user code, never iterate over it, never touch it. This is one main selling point of BridgeNet2.
- Never intrude on user code, never iterate over it, never touch it. This is one main selling point of BridgeNet2.
153 changes: 146 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
"fs-extra": "^11.1.0",
"moonwave": "^1.0.1",
"path": "^0.12.7",
"rimraf": "^4.1.2"
"rimraf": "^4.4.1"
}
}
2 changes: 1 addition & 1 deletion sourcemap.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"name":"bridgenet2","className":"ModuleScript","filePaths":["src\\init.luau","default.project.json"],"children":[{"name":"ClientBridge","className":"ModuleScript","filePaths":["src\\ClientBridge.luau"]},{"name":"ClientProcess","className":"ModuleScript","filePaths":["src\\ClientProcess.luau"]},{"name":"Identifiers","className":"ModuleScript","filePaths":["src\\Identifiers.luau"]},{"name":"NetworkUtils","className":"ModuleScript","filePaths":["src\\NetworkUtils.luau"]},{"name":"Output","className":"ModuleScript","filePaths":["src\\Output.luau"]},{"name":"ServerBridge","className":"ModuleScript","filePaths":["src\\ServerBridge.luau"]},{"name":"ServerProcess","className":"ModuleScript","filePaths":["src\\ServerProcess.luau"]}]}
{"name":"bridgenet2-test","className":"DataModel","filePaths":["testing.project.json"],"children":[{"name":"ReplicatedStorage","className":"ReplicatedStorage","children":[{"name":"Packages","className":"Folder","children":[{"name":"RemotePacketSizeCounter","className":"ModuleScript","filePaths":["Packages\\RemotePacketSizeCounter.lua"]},{"name":"TableKit","className":"ModuleScript","filePaths":["Packages\\TableKit.lua"]},{"name":"_Index","className":"Folder","children":[{"name":"[email protected]","className":"Folder","children":[{"name":"tablekit","className":"ModuleScript","filePaths":["Packages\\_Index\\[email protected]\\tablekit\\src\\init.luau","Packages\\_Index\\[email protected]\\tablekit\\default.project.json"]}]},{"name":"[email protected]","className":"Folder","children":[{"name":"remotepacketsizecounter","className":"ModuleScript","filePaths":["Packages\\_Index\\[email protected]\\remotepacketsizecounter\\src\\init.luau","Packages\\_Index\\[email protected]\\remotepacketsizecounter\\default.project.json"]}]}]},{"name":"bridgenet2","className":"ModuleScript","filePaths":["src\\init.luau"],"children":[{"name":"BridgeNet2","className":"ModuleScript","filePaths":["src\\BridgeNet2.luau"]},{"name":"Client","className":"ModuleScript","filePaths":["src\\Client\\init.luau"],"children":[{"name":"ClientBridge","className":"ModuleScript","filePaths":["src\\Client\\ClientBridge.luau"]},{"name":"ClientIdentifiers","className":"ModuleScript","filePaths":["src\\Client\\ClientIdentifiers.luau"]},{"name":"ClientProcess","className":"ModuleScript","filePaths":["src\\Client\\ClientProcess.luau"]}]},{"name":"Constants","className":"ModuleScript","filePaths":["src\\Constants.luau"]},{"name":"Server","className":"ModuleScript","filePaths":["src\\Server\\init.luau"],"children":[{"name":"HandleInvalidPlayer","className":"ModuleScript","filePaths":["src\\Server\\HandleInvalidPlayer.luau"]},{"name":"PlayerContainers","className":"ModuleScript","filePaths":["src\\Server\\PlayerContainers\\init.luau"],"children":[{"name":"All","className":"ModuleScript","filePaths":["src\\Server\\PlayerContainers\\All.luau"]},{"name":"Except","className":"ModuleScript","filePaths":["src\\Server\\PlayerContainers\\Except.luau"]},{"name":"Players","className":"ModuleScript","filePaths":["src\\Server\\PlayerContainers\\Players.luau"]},{"name":"Single","className":"ModuleScript","filePaths":["src\\Server\\PlayerContainers\\Single.luau"]}]},{"name":"ServerBridge","className":"ModuleScript","filePaths":["src\\Server\\ServerBridge.luau"]},{"name":"ServerIdentifiers","className":"ModuleScript","filePaths":["src\\Server\\ServerIdentifiers.luau"]},{"name":"ServerProcess","className":"ModuleScript","filePaths":["src\\Server\\ServerProcess.luau"]}]},{"name":"Types","className":"ModuleScript","filePaths":["src\\Types.luau"]},{"name":"Utilities","className":"Folder","children":[{"name":"NetworkUtils","className":"ModuleScript","filePaths":["src\\Utilities\\NetworkUtils.luau"]},{"name":"Output","className":"ModuleScript","filePaths":["src\\Utilities\\Output.luau"]},{"name":"RecycledSpawn","className":"ModuleScript","filePaths":["src\\Utilities\\RecycledSpawn.luau"]}]}]}]},{"name":"benches","className":"Folder","children":[{"name":"Hex.bench","className":"ModuleScript","filePaths":["benchmarks\\Hex.bench.luau"]}]},{"name":"framework","className":"ModuleScript","filePaths":["testing/framework\\init.luau"],"children":[{"name":"bootstrapper","className":"ModuleScript","filePaths":["testing/framework\\bootstrapper.luau"]},{"name":"expect","className":"ModuleScript","filePaths":["testing/framework\\expect.luau"]}]}]},{"name":"ServerScriptService","className":"ServerScriptService","children":[{"name":"featureTests","className":"Script","filePaths":["testing/tests/server\\featureTests\\init.server.luau"]}]},{"name":"StarterPlayer","className":"StarterPlayer","children":[{"name":"StarterPlayerScripts","className":"StarterPlayerScripts","children":[{"name":"featureTests","className":"LocalScript","filePaths":["testing/tests/client\\featureTests\\init.client.luau"]}]}]}]}
40 changes: 40 additions & 0 deletions src/BridgeNet2.luau
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
--!strict
local Types = require(script.Parent.Types)

type ServerBridge = {
Fire: (self: ServerBridge, target: Player | Types.PlayerContainer, content: Types.Content) -> (),
Connect: (self: ServerBridge, callback: <T, K>(player: Player, content: Types.Content?) -> ()) -> (),
}
type ClientBridge = {
Fire: (self: ClientBridge, content: Types.Content) -> (),
Connect: (self: ClientBridge, callback: (content: Types.Content) -> ()) -> (),
}

type Connection = {
Disconnect: () -> (),
}

export type Bridge = ServerBridge & ClientBridge

export type BridgeNet2 = {
ReferenceBridge: (name: string) -> Bridge,

ReferenceIdentifier: (name: string, maxWaitTime: number) -> Types.Identifier,

Serialize: (identifierName: string) -> Types.Identifier,
Deserialize: (compressedIdentifier: string) -> Types.Identifier,

ToHex: (regularString: string) -> string,
ToReadableHex: (regularString: string) -> string,
FromHex: (hexadecimal: string) -> string,

Players: (players: Types.Array<Player>) -> Types.SetPlayerContainer,
AllPlayers: () -> Types.AllPlayerContainer,
PlayersExcept: (excludedPlayers: Types.Array<Player>) -> Types.ExceptPlayerContainer,

CreateUUID: () -> string,

HandleInvalidPlayer: (handler: (player: Player) -> ()) -> (),
}

return nil
Loading

0 comments on commit 50a7896

Please sign in to comment.