class_networkedmultiplayercustom.rst 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/doc/classes/NetworkedMultiplayerCustom.xml.
  6. .. _class_NetworkedMultiplayerCustom:
  7. NetworkedMultiplayerCustom
  8. ==========================
  9. **Inherits:** :ref:`NetworkedMultiplayerPeer<class_NetworkedMultiplayerPeer>` **<** :ref:`PacketPeer<class_PacketPeer>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  10. A :ref:`NetworkedMultiplayerPeer<class_NetworkedMultiplayerPeer>` implementation that can be controlled from a script.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. A :ref:`NetworkedMultiplayerPeer<class_NetworkedMultiplayerPeer>` implementation that can be used as a :ref:`MultiplayerAPI.network_peer<class_MultiplayerAPI_property_network_peer>` and controlled from a script.
  15. Its purpose is to allow adding a new backend for the high-Level multiplayer API without needing to use GDNative.
  16. .. rst-class:: classref-reftable-group
  17. Methods
  18. -------
  19. .. table::
  20. :widths: auto
  21. +------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | void | :ref:`deliver_packet<class_NetworkedMultiplayerCustom_method_deliver_packet>` **(** :ref:`PoolByteArray<class_PoolByteArray>` buffer, :ref:`int<class_int>` from_peer_id **)** |
  23. +------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | void | :ref:`initialize<class_NetworkedMultiplayerCustom_method_initialize>` **(** :ref:`int<class_int>` self_peer_id **)** |
  25. +------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | void | :ref:`set_connection_status<class_NetworkedMultiplayerCustom_method_set_connection_status>` **(** :ref:`ConnectionStatus<enum_NetworkedMultiplayerPeer_ConnectionStatus>` connection_status **)** |
  27. +------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | void | :ref:`set_max_packet_size<class_NetworkedMultiplayerCustom_method_set_max_packet_size>` **(** :ref:`int<class_int>` max_packet_size **)** |
  29. +------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. .. rst-class:: classref-section-separator
  31. ----
  32. .. rst-class:: classref-descriptions-group
  33. Signals
  34. -------
  35. .. _class_NetworkedMultiplayerCustom_signal_packet_generated:
  36. .. rst-class:: classref-signal
  37. **packet_generated** **(** :ref:`int<class_int>` peer_id, :ref:`PoolByteArray<class_PoolByteArray>` buffer, :ref:`int<class_int>` transfer_mode **)**
  38. Emitted when the local :ref:`MultiplayerAPI<class_MultiplayerAPI>` generates a packet (e.g. when calling :ref:`Node.rpc<class_Node_method_rpc>`).
  39. Your script should take this packet and send it to the requested peer over the network (which should call :ref:`deliver_packet<class_NetworkedMultiplayerCustom_method_deliver_packet>` with the data when it's received).
  40. .. rst-class:: classref-section-separator
  41. ----
  42. .. rst-class:: classref-descriptions-group
  43. Method Descriptions
  44. -------------------
  45. .. _class_NetworkedMultiplayerCustom_method_deliver_packet:
  46. .. rst-class:: classref-method
  47. void **deliver_packet** **(** :ref:`PoolByteArray<class_PoolByteArray>` buffer, :ref:`int<class_int>` from_peer_id **)**
  48. Deliver a packet to the local :ref:`MultiplayerAPI<class_MultiplayerAPI>`.
  49. When your script receives a packet from other peers over the network (originating from the :ref:`packet_generated<class_NetworkedMultiplayerCustom_signal_packet_generated>` signal on the sending peer), passing it to this method will deliver it locally.
  50. .. rst-class:: classref-item-separator
  51. ----
  52. .. _class_NetworkedMultiplayerCustom_method_initialize:
  53. .. rst-class:: classref-method
  54. void **initialize** **(** :ref:`int<class_int>` self_peer_id **)**
  55. Initialize the peer with the given ``self_peer_id`` (must be between 1 and 2147483647).
  56. Can only be called if the connection status is :ref:`NetworkedMultiplayerPeer.CONNECTION_CONNECTING<class_NetworkedMultiplayerPeer_constant_CONNECTION_CONNECTING>`. See :ref:`set_connection_status<class_NetworkedMultiplayerCustom_method_set_connection_status>`.
  57. .. rst-class:: classref-item-separator
  58. ----
  59. .. _class_NetworkedMultiplayerCustom_method_set_connection_status:
  60. .. rst-class:: classref-method
  61. void **set_connection_status** **(** :ref:`ConnectionStatus<enum_NetworkedMultiplayerPeer_ConnectionStatus>` connection_status **)**
  62. Set the state of the connection. See :ref:`ConnectionStatus<enum_NetworkedMultiplayerPeer_ConnectionStatus>`.
  63. This will emit the :ref:`NetworkedMultiplayerPeer.connection_succeeded<class_NetworkedMultiplayerPeer_signal_connection_succeeded>`, :ref:`NetworkedMultiplayerPeer.connection_failed<class_NetworkedMultiplayerPeer_signal_connection_failed>` or :ref:`NetworkedMultiplayerPeer.server_disconnected<class_NetworkedMultiplayerPeer_signal_server_disconnected>` signals depending on the status and if the peer has the unique network id of ``1``.
  64. You can only change to :ref:`NetworkedMultiplayerPeer.CONNECTION_CONNECTING<class_NetworkedMultiplayerPeer_constant_CONNECTION_CONNECTING>` from :ref:`NetworkedMultiplayerPeer.CONNECTION_DISCONNECTED<class_NetworkedMultiplayerPeer_constant_CONNECTION_DISCONNECTED>` and to :ref:`NetworkedMultiplayerPeer.CONNECTION_CONNECTED<class_NetworkedMultiplayerPeer_constant_CONNECTION_CONNECTED>` from :ref:`NetworkedMultiplayerPeer.CONNECTION_CONNECTING<class_NetworkedMultiplayerPeer_constant_CONNECTION_CONNECTING>`.
  65. .. rst-class:: classref-item-separator
  66. ----
  67. .. _class_NetworkedMultiplayerCustom_method_set_max_packet_size:
  68. .. rst-class:: classref-method
  69. void **set_max_packet_size** **(** :ref:`int<class_int>` max_packet_size **)**
  70. Set the max packet size that this peer can handle.
  71. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  72. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  73. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  74. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`