NetworkedMultiplayerCustom.xml 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="NetworkedMultiplayerCustom" inherits="NetworkedMultiplayerPeer" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  3. <brief_description>
  4. A [NetworkedMultiplayerPeer] implementation that can be controlled from a script.
  5. </brief_description>
  6. <description>
  7. A [NetworkedMultiplayerPeer] implementation that can be used as a [member MultiplayerAPI.network_peer] and controlled from a script.
  8. Its purpose is to allow adding a new backend for the high-Level multiplayer API without needing to use GDNative.
  9. </description>
  10. <tutorials>
  11. </tutorials>
  12. <methods>
  13. <method name="deliver_packet">
  14. <return type="void" />
  15. <argument index="0" name="buffer" type="PoolByteArray" />
  16. <argument index="1" name="from_peer_id" type="int" />
  17. <description>
  18. Deliver a packet to the local [MultiplayerAPI].
  19. When your script receives a packet from other peers over the network (originating from the [signal packet_generated] signal on the sending peer), passing it to this method will deliver it locally.
  20. </description>
  21. </method>
  22. <method name="initialize">
  23. <return type="void" />
  24. <argument index="0" name="self_peer_id" type="int" />
  25. <description>
  26. Initialize the peer with the given [code]self_peer_id[/code] (must be between 1 and 2147483647).
  27. Can only be called if the connection status is [constant NetworkedMultiplayerPeer.CONNECTION_CONNECTING]. See [method set_connection_status].
  28. </description>
  29. </method>
  30. <method name="set_connection_status">
  31. <return type="void" />
  32. <argument index="0" name="connection_status" type="int" enum="NetworkedMultiplayerPeer.ConnectionStatus" />
  33. <description>
  34. Set the state of the connection. See [enum NetworkedMultiplayerPeer.ConnectionStatus].
  35. This will emit the [signal NetworkedMultiplayerPeer.connection_succeeded], [signal NetworkedMultiplayerPeer.connection_failed] or [signal NetworkedMultiplayerPeer.server_disconnected] signals depending on the status and if the peer has the unique network id of [code]1[/code].
  36. You can only change to [constant NetworkedMultiplayerPeer.CONNECTION_CONNECTING] from [constant NetworkedMultiplayerPeer.CONNECTION_DISCONNECTED] and to [constant NetworkedMultiplayerPeer.CONNECTION_CONNECTED] from [constant NetworkedMultiplayerPeer.CONNECTION_CONNECTING].
  37. </description>
  38. </method>
  39. <method name="set_max_packet_size">
  40. <return type="void" />
  41. <argument index="0" name="max_packet_size" type="int" />
  42. <description>
  43. Set the max packet size that this peer can handle.
  44. </description>
  45. </method>
  46. </methods>
  47. <signals>
  48. <signal name="packet_generated">
  49. <argument index="0" name="peer_id" type="int" />
  50. <argument index="1" name="buffer" type="PoolByteArray" />
  51. <argument index="2" name="transfer_mode" type="int" />
  52. <description>
  53. Emitted when the local [MultiplayerAPI] generates a packet (e.g. when calling [method Node.rpc]).
  54. Your script should take this packet and send it to the requested peer over the network (which should call [method deliver_packet] with the data when it's received).
  55. </description>
  56. </signal>
  57. </signals>
  58. <constants>
  59. </constants>
  60. </class>