BeardedManStudios / ForgeNetworkingRemastered

See various forks, also please join the Forge Community fork of Forge Alloy! -> https://github.com/ForgeAlloyCommunity/ForgeAlloy
https://twitter.com/FarrisFaulds
Apache License 2.0
1.49k stars 309 forks source link

Proximity Checks when multiple objects are owned by the server #314

Open phalasz opened 5 years ago

phalasz commented 5 years ago

Version Number and Operating System(s):

Latest master and develop

Currently proximity checks are done based on the sending and receiving player's proximity location. This setup works fine if the server only owns one object. Eg. in a listen server setup where each client has one network object it owns.

This setup on the other-hand would not work if the server would own multiple objects as there is no easy way to set the correct proximity location in this case.

k77torpedo commented 4 years ago

This feature is usually used to reduce overall networking-load by reducing the amount of packets that need to be send based on proximity. From my perspective tho it clashes a bit with this Networking Library as Forge instantiates everything automatically so the client always will have at least ALL NetworkBehaviors instantiated fully and only after that does the current Proximity-Feature reduce the amount of packets.

This is hard to handle generally - moreso for people coming into networking. Even worse: those new people are tending to become confused when coding with Forge as they see the word "Proximity" in every corner of the library - even tho it is a specialized feature for a certain use-case.

My suggestion would be to take a different route:

  1. Remove the Proximity-Feature from the core-library altogether. It's simply clutter and creates too much confusion.
  2. Instead provide a new "Proximity Example" with simple ProximityReceiver- and ProximityEmitter-NetworkBehaviors that equally can do the job of the current system.

This would create less maintenance and dependencies for the core-library and with every new feature we wouldn't need to feel scared to "break that certain proximity-feature again". It also allows for more customization of Proximity - rather than dictate the feature via the core-library we can simply provide a "Proximity Example" that can be changed by the user/programmer.

phalasz commented 4 years ago

Happy for you to make those changes @k77torpedo 😉