roblox-aurora / rbx-net

Advanced multi-language networking framework for Roblox
https://rbxnet.australis.dev/
MIT License
94 stars 12 forks source link

Connecting a running game to a rojo server deletes events #85

Open xeqi opened 1 year ago

xeqi commented 1 year ago

Problem

When a game is running and calls Net.CreateDefinitions then Events are created under the net.out._NetManaged Instance

When starting a rojo server using a "$path" to load dependencies including rbx-net, the rojo server creates a DataModel with a net.out Instance without the events, as it only knows about what is on the filesystem.

If I attempt to connect a running game to that running rojo server using the rojo plugin, the plugin(?) will overwrite the runtime Instances currently in the game with the ones the server knows about. This removes the Events created by Net.CreateDefinitions.

Then event handlers in the game no longer work.

Workaround

When go into my dependency tree and add a file net/out/init.meta.json with contents

{"ignoreUnknownInstances": true}

the previous setup will keep the Events created by Net.CreateDefinitions, as rojo will ignore the _NetManaged Instance when updating. Then I can use the rewire library to hot reload code as desired.

Potential Fix

Adding this file to the repo might be a solution, but I have not given proper consideration to the ramifications of leaving old events around, and how such a choice could conflict with the intentional design decision mentioned in #78.

Vorlias commented 1 year ago

This'll be adjusted in 3.1, will end up moving the remotes back to ReplicatedStorage but under a versioned folder instead.