Broadcasts should have code generation to make them simpler like RPCs #622
Closed
Pfhoenix
started this conversation in
Feature Request
Replies: 1 comment 2 replies
-
Broadcasts are consider low level and exist outside networking scripts. Codegen uses attributes and other things from networked scripts to create automatic handling of things. The intended behavior of broadcasts is as they are so I'm going to have to decline this. Let me know if you have any other questions about this. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, broadcasts require you to define a struct that extends IBroadcast, every method that handles the broadcast has to have a set signature (clients have [broadcasttype, channel] while servers have [networkconnection, broadcasttype, channel]), and the developer has to manually register methods to handle broadcasts by the broadcasttype.
This is a lot of manual work for something that can be done entirely via code-generation. Given the following methods (for the sake of an example) :
Now, I'm not entirely sure what the best way to do a broadcast to a single client would be, but the above is very straightforwards considering what Fish-Net already does for RPCs. Now, why would someone go through all that trouble instead of using RPCs? Simple - can't use RPCs when server and clients are in different scenes, or they want objects to be able to call on each other without requiring the objects be in sync between server and client.
Beta Was this translation helpful? Give feedback.
All reactions