Skip to content

YetAnotherNet v0.10.0-alpha.2

Latest
Compare
Choose a tag to compare
@YetAnotherClown YetAnotherClown released this 29 Aug 17:20
· 7 commits to main since this release

Version 0.10.0-alpha.2

The changes in this version are important enough to receive an alpha version and its own release.

This version fixes three critical issues in YetAnotherNet, one preventing packets from being queried in some cases, and two others which caused unexpected frame delays due to flaws in the design of the scheduling code. In order to fix these issues, breaking changes have been make to the Hooks API and the Bridge API, a detailed migration guide can be found below.

It is important to note that the Hooks API should be stable, but the Bridge API may at any point change and should be considered unstable. The breaking changes made in this version were necessary in order to address a flaw in the API design.

Migration Guide

Hooks API

If you previously used the YetAnotherNet.createHook() function, it still behaves the same except it now returns two new functions instead of one: beginFrame and endFrame.

These functions will respectively call scheduling code that is meant for the beginning and end of a frame, instead of one function that would call it at the same time.

The following is an example of how to use the updated Hooks API:

local RunService = game:GetService("RunService")

local YetAnotherNet = require("@packages/YetAnotherNet")
local routes = require("@shared/routes")

local myRoute = routes.myRoute

local beginFrame, endFrame = YetAnotherNet.createHook({ Route })
RunService.Heartbeat:Connect(function()
	beginFrame()

	myRoute:send(...)
	for i, player, data in myRoute:query() do
		-- Do something
	end

	endFrame()
end)

Note

The behavior of YetAnotherNet.start() has changed, the API itself has not. This function will now run the respective scheduling code at the beginning AND the end of a frame instead of just at the end of a frame.

Bridge API

The Bridge:step() method has been removed and replaced with new Bridge:beginFrame() and Bridge:endFrame() methods which will run the respective scheduling code at the beginning AND the end of a frame instead of just at the end of a frame.

Warning

The Bridge API is unstable and may change in future versions, it is not guaranteed that any of the API for the Bridge will remain constant.


Installing the New Version

Wally

Add YetAnotherNet to your project with Wally by adding the following to your wally.toml file:

[dependencies]
YetAnotherNet = "yetanotherclown/yetanothernet@0.10.0-alpha.2"

Note

Wally does not export types automatically, if you wish to use Strict Typing with YetAnotherNet, install Wally Package Types with Foreman.

NPM for Roblox Typescript

You can find YetAnotherNet on NPM, or install it with the command line:

npm i @rbxts/yetanothernet@0.10.0-alpha.2

Change Log

Tip

See the CHANGELOG.md for future and past changes.

Changed

  • Bridge:step() has been replaced by Bridge:beginFrame and Bridge:endFrame which separates the logic behind the Incoming and Outgoing queues
  • YetAnotherNet.createHook() now returns two functions, a beginFrame and a endFrame function which separates scheduling logic

Fixed

  • A critical bug that resulted in the unexpected termination of query iterators