red-blox / zap

A lightning fast networking solution for roblox.
https://zap.redblox.dev
MIT License
89 stars 14 forks source link

Add Vector2 type #102

Closed kalrnlo closed 2 months ago

kalrnlo commented 2 months ago

Closes https://github.com/red-blox/zap/issues/78, adds in a Vector2 type to zap, same as the Vector3 type except that it doesn't serialize the Z axis.

jackdotink commented 2 months ago

Roblox Vector2s are not actually useful for much of anything. In the cases where the API requires you to use them, you aren't really networking data. In the case where you want a vector with two components, they aren't useful because they're heap allocated and that comes with a lot of baggage.

Instead we should be using the Luau vector datatype, and let the user decide how many components to send. I've made some revisions to the Luau vector library RFC, so that should hopefully happen soon.

Additionally, the way I want to design this would only really work in the rewrite.