red-blox / zap

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

[FEAT] Support multiple instances of zap within one place #106

Closed EncodedVenom closed 2 months ago

EncodedVenom commented 2 months ago

Describe your feature

I'm suggesting there is a new opt parameter to allow segmenting multiple zap net codes:

opt remote_scope = "name"

where this option will modify the remote emits from:

ZAP_UNRELIABLE ZAP_RELIABLE

to:

name_UNRELIABLE name_RELIABLE

or some other reasonable naming convention.

That way any conflicts between packages and place net code can be resolved.

Alternatives

There is no known alternatives as of writing that would allow this functionality.

Implementation Details

Implementation should change the emit of the remote name based on whether or not this option is set. The implementation is relatively simple as it involves just adding a condition to check if an option is set and changing the remote name in emits.

Additional context

Right now, zap can only be used once within a given place file. While this is useful enough for many people, this implementation, especially as a package writer, this is not enough. Zap should be able to segment net code in packages away from other net code in other places.