diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2022-07-09 20:45:30 +0200 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2022-07-20 19:08:35 +0200 |
commit | ddee5f605018c77e92378b525bd23ba32fb1263a (patch) | |
tree | 36e79bf39b76fab6f7ecc6ac47d68a24825d3ce1 /doc/classes | |
parent | 351197bfe406a226ff304712b97847bf51ce0abc (diff) |
Add peer visibility to MultiplayerSynchronizer.
MultiplayerSynchronizers can now be configured to limit their visibility
to a subset of the connected peers, if the synchronized node was spawned
by a MultiplayerSpawner (either automatically or via custom spawn) the
given node will also be despawned remotely.
The replication system doesn't have the logic to handle subspawn
directly, but it is possible to handle them appropriately by manually
updating the visibility of the parent before changing the one of the
nested spawns via the "update_visibility" function.
The visibility of each MultiplayerSynchronizer can be controlled by
adding or remove filters via "[add|remove]_visibility_filter(callable)".
To further optimize the network code, visibility filters can be configured
to be automatically updated during idle or physics frame, or set to always
require manual update (via the "update_visibility" function).
Diffstat (limited to 'doc/classes')
-rw-r--r-- | doc/classes/MultiplayerSpawner.xml | 2 | ||||
-rw-r--r-- | doc/classes/MultiplayerSynchronizer.xml | 52 |
2 files changed, 52 insertions, 2 deletions
diff --git a/doc/classes/MultiplayerSpawner.xml b/doc/classes/MultiplayerSpawner.xml index 4ca92728ff..9de67068eb 100644 --- a/doc/classes/MultiplayerSpawner.xml +++ b/doc/classes/MultiplayerSpawner.xml @@ -43,8 +43,6 @@ </method> </methods> <members> - <member name="auto_spawn" type="bool" setter="set_auto_spawning" getter="is_auto_spawning" default="false"> - </member> <member name="spawn_limit" type="int" setter="set_spawn_limit" getter="get_spawn_limit" default="0"> </member> <member name="spawn_path" type="NodePath" setter="set_spawn_path" getter="get_spawn_path" default="NodePath("")"> diff --git a/doc/classes/MultiplayerSynchronizer.xml b/doc/classes/MultiplayerSynchronizer.xml index ac067791e6..3766491a6c 100644 --- a/doc/classes/MultiplayerSynchronizer.xml +++ b/doc/classes/MultiplayerSynchronizer.xml @@ -6,12 +6,64 @@ </description> <tutorials> </tutorials> + <methods> + <method name="add_visibility_filter"> + <return type="void" /> + <argument index="0" name="filter" type="Callable" /> + <description> + </description> + </method> + <method name="get_visibility_for" qualifiers="const"> + <return type="bool" /> + <argument index="0" name="peer" type="int" /> + <description> + </description> + </method> + <method name="remove_visibility_filter"> + <return type="void" /> + <argument index="0" name="filter" type="Callable" /> + <description> + </description> + </method> + <method name="set_visibility_for"> + <return type="void" /> + <argument index="0" name="peer" type="int" /> + <argument index="1" name="visible" type="bool" /> + <description> + </description> + </method> + <method name="update_visibility"> + <return type="void" /> + <argument index="0" name="for_peer" type="int" default="0" /> + <description> + </description> + </method> + </methods> <members> + <member name="public_visibility" type="bool" setter="set_visibility_public" getter="is_visibility_public" default="true"> + </member> <member name="replication_config" type="SceneReplicationConfig" setter="set_replication_config" getter="get_replication_config"> </member> <member name="replication_interval" type="float" setter="set_replication_interval" getter="get_replication_interval" default="0.0"> </member> <member name="root_path" type="NodePath" setter="set_root_path" getter="get_root_path" default="NodePath("..")"> </member> + <member name="visibility_update_mode" type="int" setter="set_visibility_update_mode" getter="get_visibility_update_mode" enum="MultiplayerSynchronizer.VisibilityUpdateMode" default="0"> + </member> </members> + <signals> + <signal name="visibility_changed"> + <argument index="0" name="for_peer" type="int" /> + <description> + </description> + </signal> + </signals> + <constants> + <constant name="VISIBILITY_PROCESS_IDLE" value="0" enum="VisibilityUpdateMode"> + </constant> + <constant name="VISIBILITY_PROCESS_PHYSICS" value="1" enum="VisibilityUpdateMode"> + </constant> + <constant name="VISIBILITY_PROCESS_NONE" value="2" enum="VisibilityUpdateMode"> + </constant> + </constants> </class> |