Namespaces are the top-level organizational unit in ByteNet Max. Each namespace is a named container — created withDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Elitriare/ByteNet-Max/llms.txt
Use this file to discover all available pages before exploring further.
defineNamespace — that holds one or both of a packets table and a queries table. When your game starts, the server assigns sequential numeric IDs to every packet and query inside every namespace, then replicates that mapping to all clients so both sides can encode and decode the same data without you manually tracking any IDs.
Creating a namespace
CallByteNetMax.defineNamespace with a string name and a function that returns a table. The table can contain a packets key, a queries key, or both.
defineNamespace is a table with packets and queries sub-tables. You require this module anywhere you need to send or listen to messages under that namespace.
How ID assignment works
When the server first requires a namespace module, it increments a global counter for each packet and for each query, writes those IDs into a replicated value store, then makes them available to the packet and query objects. When a client later requires the same module, it reads the already-replicated IDs from the store and wires them to its local packet and query objects. This is why both sides must require the module: the client cannot encode or decode messages until it has read the server-assigned IDs.You must require the namespace ModuleScript on both the server and the client. Skipping the require on either side means that side cannot send or receive any packets or queries defined in that namespace, because the ID mapping will never be initialized.
Accessing packets and queries
After requiring the namespace, access its members through the.packets and .queries sub-tables:
Organizing namespaces
There is no limit on the number of namespaces you can define, and each namespace has its own independent ID counter for both packets and queries. A common pattern is one namespace per feature area — for example"Combat", "PlayerData", and "UI" — each living in its own ModuleScript under ReplicatedStorage.