diff options
Diffstat (limited to 'modules/enet/doc_classes')
-rw-r--r-- | modules/enet/doc_classes/ENetConnection.xml | 194 | ||||
-rw-r--r-- | modules/enet/doc_classes/ENetMultiplayerPeer.xml | 88 | ||||
-rw-r--r-- | modules/enet/doc_classes/ENetPacketPeer.xml | 183 | ||||
-rw-r--r-- | modules/enet/doc_classes/NetworkedMultiplayerENet.xml | 194 |
4 files changed, 465 insertions, 194 deletions
diff --git a/modules/enet/doc_classes/ENetConnection.xml b/modules/enet/doc_classes/ENetConnection.xml new file mode 100644 index 0000000000..c2a85ffdf8 --- /dev/null +++ b/modules/enet/doc_classes/ENetConnection.xml @@ -0,0 +1,194 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ENetConnection" inherits="RefCounted" version="4.0"> + <brief_description> + A wrapper class for an [url=http://enet.bespin.org/group__host.html]ENetHost[/url]. + </brief_description> + <description> + ENet's purpose is to provide a relatively thin, simple and robust network communication layer on top of UDP (User Datagram Protocol). + </description> + <tutorials> + <link title="API documentation on the ENet website">http://enet.bespin.org/usergroup0.html</link> + </tutorials> + <methods> + <method name="bandwidth_limit"> + <return type="void" /> + <argument index="0" name="in_bandwidth" type="int" default="0" /> + <argument index="1" name="out_bandwidth" type="int" default="0" /> + <description> + Adjusts the bandwidth limits of a host. + </description> + </method> + <method name="broadcast"> + <return type="void" /> + <argument index="0" name="channel" type="int" /> + <argument index="1" name="packet" type="PackedByteArray" /> + <argument index="2" name="flags" type="int" /> + <description> + Queues a [code]packet[/code] to be sent to all peers associated with the host over the specified [code]channel[/code]. See [ENetPacketPeer] [code]FLAG_*[/code] constants for available packet flags. + </description> + </method> + <method name="channel_limit"> + <return type="void" /> + <argument index="0" name="limit" type="int" /> + <description> + Limits the maximum allowed channels of future incoming connections. + </description> + </method> + <method name="compress"> + <return type="void" /> + <argument index="0" name="mode" type="int" enum="ENetConnection.CompressionMode" /> + <description> + Sets the compression method used for network packets. These have different tradeoffs of compression speed versus bandwidth, you may need to test which one works best for your use case if you use compression at all. + [b]Note:[/b] Most games' network design involve sending many small packets frequently (smaller than 4 KB each). If in doubt, it is recommended to keep the default compression algorithm as it works best on these small packets. + </description> + </method> + <method name="connect_to_host"> + <return type="ENetPacketPeer" /> + <argument index="0" name="address" type="String" /> + <argument index="1" name="port" type="int" /> + <argument index="2" name="channels" type="int" default="0" /> + <argument index="3" name="data" type="int" default="0" /> + <description> + Initiates a connection to a foreign [code]address[/code] using the specified [code]port[/code] and allocting the requested [code]channels[/code]. Optional [code]data[/code] can be passed during connection in the form of a 32 bit integer. + Note: You must call either [method create_host] or [method create_host_bound] before calling this method. + </description> + </method> + <method name="create_host"> + <return type="int" enum="Error" /> + <argument index="0" name="max_peers" type="int" default="32" /> + <argument index="1" name="max_channels" type="int" default="0" /> + <argument index="2" name="in_bandwidth" type="int" default="0" /> + <argument index="3" name="out_bandwidth" type="int" default="0" /> + <description> + Create an ENetHost that will allow up to [code]max_peers[/code] connected peers, each allocating up to [code]max_channels[/code] channels, optionally limiting bandwith to [code]in_bandwidth[/code] and [code]out_bandwidth[/code]. + </description> + </method> + <method name="create_host_bound"> + <return type="int" enum="Error" /> + <argument index="0" name="bind_address" type="String" /> + <argument index="1" name="bind_port" type="int" /> + <argument index="2" name="max_peers" type="int" default="32" /> + <argument index="3" name="max_channels" type="int" default="0" /> + <argument index="4" name="in_bandwidth" type="int" default="0" /> + <argument index="5" name="out_bandwidth" type="int" default="0" /> + <description> + Create an ENetHost like [method create_host] which is also bound to the given [code]bind_address[/code] and [code]bind_port[/code]. + </description> + </method> + <method name="destroy"> + <return type="void" /> + <description> + Destroys the host and all resources associated with it. + </description> + </method> + <method name="dtls_client_setup"> + <return type="int" enum="Error" /> + <argument index="0" name="certificate" type="X509Certificate" /> + <argument index="1" name="hostname" type="String" /> + <argument index="2" name="verify" type="bool" default="true" /> + <description> + Configure this ENetHost to use the custom Godot extension allowing DTLS encryption for ENet clients. Call this before [method connect_to_host] to have ENet connect using DTLS with [code]certificate[/code] and [code]hostname[/code] verification. Verification can be optionally turned off via the [code]verify[/code] parameter. + </description> + </method> + <method name="dtls_server_setup"> + <return type="int" enum="Error" /> + <argument index="0" name="key" type="CryptoKey" /> + <argument index="1" name="certificate" type="X509Certificate" /> + <description> + Configure this ENetHost to use the custom Godot extension allowing DTLS encryption for ENet servers. Call this right after [method create_host_bound] to have ENet expect peers to connect using DTLS. + </description> + </method> + <method name="flush"> + <return type="void" /> + <description> + Sends any queued packets on the host specified to its designated peers. + </description> + </method> + <method name="get_local_port" qualifiers="const"> + <return type="int" /> + <description> + Returns the local port to which this peer is bound. + </description> + </method> + <method name="get_max_channels" qualifiers="const"> + <return type="int" /> + <description> + Returns the maximum number of channels allowed for connected peers. + </description> + </method> + <method name="get_peers"> + <return type="Array" /> + <description> + Returns the list of peers associated with this host. + Note: This list might include some peers that are not fully connected or are still being disconnected. + </description> + </method> + <method name="pop_statistic"> + <return type="float" /> + <argument index="0" name="statistic" type="int" enum="ENetConnection.HostStatistic" /> + <description> + Returns and resets host statistics. See [enum HostStatistic] for more info. + </description> + </method> + <method name="refuse_new_connections"> + <return type="void" /> + <argument index="0" name="refuse" type="bool" /> + <description> + Configures the DTLS server to automatically drop new connections. + Note: This method is only relevant after calling [method dtls_server_setup]. + </description> + </method> + <method name="service"> + <return type="Array" /> + <argument index="0" name="timeout" type="int" default="0" /> + <description> + Waits for events on the host specified and shuttles packets between the host and its peers. The returned [Array] will have 4 elements. An [enum EventType], the [ENetPacketPeer] which generated the event, the event associated data (if any), the event associated channel (if any). If the generated event is [constant EVENT_RECEIVE], the received packet will be queued to the associated [ENetPacketPeer]. + Call this function regularly to handle connections, disconnections, and to receive new packets. + </description> + </method> + </methods> + <constants> + <constant name="COMPRESS_NONE" value="0" enum="CompressionMode"> + No compression. This uses the most bandwidth, but has the upside of requiring the fewest CPU resources. This option may also be used to make network debugging using tools like Wireshark easier. + </constant> + <constant name="COMPRESS_RANGE_CODER" value="1" enum="CompressionMode"> + ENet's built-in range encoding. Works well on small packets, but is not the most efficient algorithm on packets larger than 4 KB. + </constant> + <constant name="COMPRESS_FASTLZ" value="2" enum="CompressionMode"> + [url=http://fastlz.org/]FastLZ[/url] compression. This option uses less CPU resources compared to [constant COMPRESS_ZLIB], at the expense of using more bandwidth. + </constant> + <constant name="COMPRESS_ZLIB" value="3" enum="CompressionMode"> + [url=https://www.zlib.net/]Zlib[/url] compression. This option uses less bandwidth compared to [constant COMPRESS_FASTLZ], at the expense of using more CPU resources. + </constant> + <constant name="COMPRESS_ZSTD" value="4" enum="CompressionMode"> + [url=https://facebook.github.io/zstd/]Zstandard[/url] compression. Note that this algorithm is not very efficient on packets smaller than 4 KB. Therefore, it's recommended to use other compression algorithms in most cases. + </constant> + <constant name="EVENT_ERROR" value="-1" enum="EventType"> + An error occurred during [method service]. You will likely need to [method destroy] the host and recreate it. + </constant> + <constant name="EVENT_NONE" value="0" enum="EventType"> + No event occurred within the specified time limit. + </constant> + <constant name="EVENT_CONNECT" value="1" enum="EventType"> + A connection request initiated by enet_host_connect has completed. The array will contain the peer which successfully connected. + </constant> + <constant name="EVENT_DISCONNECT" value="2" enum="EventType"> + A peer has disconnected. This event is generated on a successful completion of a disconnect initiated by [method ENetPacketPeer.peer_disconnect], if a peer has timed out, or if a connection request intialized by [method connect_to_host] has timed out. The array will contain the peer which disconnected. The data field contains user supplied data describing the disconnection, or 0, if none is available. + </constant> + <constant name="EVENT_RECEIVE" value="3" enum="EventType"> + A packet has been received from a peer. The array will contain the peer which sent the packet, the channel number upon which the packet was received, and the received packet. + </constant> + <constant name="HOST_TOTAL_SENT_DATA" value="0" enum="HostStatistic"> + Total data sent. + </constant> + <constant name="HOST_TOTAL_SENT_PACKETS" value="1" enum="HostStatistic"> + Total UDP packets sent. + </constant> + <constant name="HOST_TOTAL_RECEIVED_DATA" value="2" enum="HostStatistic"> + Total data received. + </constant> + <constant name="HOST_TOTAL_RECEIVED_PACKETS" value="3" enum="HostStatistic"> + Total UDP packets received. + </constant> + </constants> +</class> diff --git a/modules/enet/doc_classes/ENetMultiplayerPeer.xml b/modules/enet/doc_classes/ENetMultiplayerPeer.xml new file mode 100644 index 0000000000..3a37b396a4 --- /dev/null +++ b/modules/enet/doc_classes/ENetMultiplayerPeer.xml @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ENetMultiplayerPeer" inherits="MultiplayerPeer" version="4.0"> + <brief_description> + A MultiplayerPeer implementation using the [url=http://enet.bespin.org/index.html]ENet[/url] library. + </brief_description> + <description> + A MultiplayerPeer implementation that should be passed to [member MultiplayerAPI.network_peer] after being initialized as either a client, server, or mesh. Events can then be handled by connecting to [MultiplayerAPI] signals. See [ENetConnection] for more information on the ENet library wrapper. + [b]Note:[/b] ENet only uses UDP, not TCP. When forwarding the server port to make your server accessible on the public Internet, you only need to forward the server port in UDP. You can use the [UPNP] class to try to forward the server port automatically when starting the server. + </description> + <tutorials> + <link title="High-level multiplayer">https://docs.godotengine.org/en/latest/tutorials/networking/high_level_multiplayer.html</link> + <link title="API documentation on the ENet website">http://enet.bespin.org/usergroup0.html</link> + </tutorials> + <methods> + <method name="add_mesh_peer"> + <return type="int" enum="Error" /> + <argument index="0" name="peer_id" type="int" /> + <argument index="1" name="host" type="ENetConnection" /> + <description> + Add a new remote peer with the given [code]peer_id[/code] connected to the given [code]host[/code]. + Note: The [code]host[/code] must have exactly one peer in the [constant ENetPacketPeer.STATE_CONNECTED] state. + </description> + </method> + <method name="close_connection"> + <return type="void" /> + <argument index="0" name="wait_usec" type="int" default="100" /> + <description> + Closes the connection. Ignored if no connection is currently established. If this is a server it tries to notify all clients before forcibly disconnecting them. If this is a client it simply closes the connection to the server. + </description> + </method> + <method name="create_client"> + <return type="int" enum="Error" /> + <argument index="0" name="address" type="String" /> + <argument index="1" name="port" type="int" /> + <argument index="2" name="channel_count" type="int" default="0" /> + <argument index="3" name="in_bandwidth" type="int" default="0" /> + <argument index="4" name="out_bandwidth" type="int" default="0" /> + <argument index="5" name="local_port" type="int" default="0" /> + <description> + Create client that connects to a server at [code]address[/code] using specified [code]port[/code]. The given address needs to be either a fully qualified domain name (e.g. [code]"www.example.com"[/code]) or an IP address in IPv4 or IPv6 format (e.g. [code]"192.168.1.1"[/code]). The [code]port[/code] is the port the server is listening on. The [code]channel_count[/code] parameter can be used to specify the number of ENet channels allocated for the connection. The [code]in_bandwidth[/code] and [code]out_bandwidth[/code] parameters can be used to limit the incoming and outgoing bandwidth to the given number of bytes per second. The default of 0 means unlimited bandwidth. Note that ENet will strategically drop packets on specific sides of a connection between peers to ensure the peer's bandwidth is not overwhelmed. The bandwidth parameters also determine the window size of a connection which limits the amount of reliable packets that may be in transit at any given time. Returns [constant OK] if a client was created, [constant ERR_ALREADY_IN_USE] if this ENetMultiplayerPeer instance already has an open connection (in which case you need to call [method close_connection] first) or [constant ERR_CANT_CREATE] if the client could not be created. If [code]local_port[/code] is specified, the client will also listen to the given port; this is useful for some NAT traversal techniques. + </description> + </method> + <method name="create_mesh"> + <return type="int" enum="Error" /> + <argument index="0" name="unique_id" type="int" /> + <description> + Initialize this [MultiplayerPeer] in mesh mode. The provided [code]unique_id[/code] will be used as the local peer network unique ID once assigned as the [member MultiplayerAPI.network_peer]. In the mesh configuration you will need to set up each new peer manually using [ENetConnection] before calling [method add_mesh_peer]. While this technique is more advanced, it allows for better control over the connection process (e.g. when dealing with NAT punch-through) and for better distribution of the network load (which would otherwise be more taxing on the server). + </description> + </method> + <method name="create_server"> + <return type="int" enum="Error" /> + <argument index="0" name="port" type="int" /> + <argument index="1" name="max_clients" type="int" default="32" /> + <argument index="2" name="max_channels" type="int" default="0" /> + <argument index="3" name="in_bandwidth" type="int" default="0" /> + <argument index="4" name="out_bandwidth" type="int" default="0" /> + <description> + Create server that listens to connections via [code]port[/code]. The port needs to be an available, unused port between 0 and 65535. Note that ports below 1024 are privileged and may require elevated permissions depending on the platform. To change the interface the server listens on, use [method set_bind_ip]. The default IP is the wildcard [code]"*"[/code], which listens on all available interfaces. [code]max_clients[/code] is the maximum number of clients that are allowed at once, any number up to 4095 may be used, although the achievable number of simultaneous clients may be far lower and depends on the application. For additional details on the bandwidth parameters, see [method create_client]. Returns [constant OK] if a server was created, [constant ERR_ALREADY_IN_USE] if this ENetMultiplayerPeer instance already has an open connection (in which case you need to call [method close_connection] first) or [constant ERR_CANT_CREATE] if the server could not be created. + </description> + </method> + <method name="get_peer" qualifiers="const"> + <return type="ENetPacketPeer" /> + <argument index="0" name="id" type="int" /> + <description> + Return the [ENetPacketPeer] associated to the given [code]id[/code]. + </description> + </method> + <method name="set_bind_ip"> + <return type="void" /> + <argument index="0" name="ip" type="String" /> + <description> + The IP used when creating a server. This is set to the wildcard [code]"*"[/code] by default, which binds to all available interfaces. The given IP needs to be in IPv4 or IPv6 address format, for example: [code]"192.168.1.1"[/code]. + </description> + </method> + </methods> + <members> + <member name="host" type="ENetConnection" setter="" getter="get_host"> + The underlying [ENetConnection] created after [method create_client] and [method create_server]. + </member> + <member name="refuse_new_connections" type="bool" setter="set_refuse_new_connections" getter="is_refusing_new_connections" override="true" default="false" /> + <member name="server_relay" type="bool" setter="set_server_relay_enabled" getter="is_server_relay_enabled" default="true"> + Enable or disable the server feature that notifies clients of other peers' connection/disconnection, and relays messages between them. When this option is [code]false[/code], clients won't be automatically notified of other peers and won't be able to send them packets through the server. + </member> + <member name="transfer_mode" type="int" setter="set_transfer_mode" getter="get_transfer_mode" override="true" enum="MultiplayerPeer.TransferMode" default="2" /> + </members> + <constants> + </constants> +</class> diff --git a/modules/enet/doc_classes/ENetPacketPeer.xml b/modules/enet/doc_classes/ENetPacketPeer.xml new file mode 100644 index 0000000000..8f0693fb01 --- /dev/null +++ b/modules/enet/doc_classes/ENetPacketPeer.xml @@ -0,0 +1,183 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ENetPacketPeer" inherits="PacketPeer" version="4.0"> + <brief_description> + A wrapper class for an [url=http://enet.bespin.org/group__peer.html]ENetPeer[/url]. + </brief_description> + <description> + A PacketPeer implementation representing a peer of an [ENetConnection]. + This class cannot be instantiated directly but can be retrieved during [method ENetConnection.service] or via [method ENetConnection.get_peers]. + </description> + <tutorials> + <link title="API documentation on the ENet website">http://enet.bespin.org/usergroup0.html</link> + </tutorials> + <methods> + <method name="get_channels" qualifiers="const"> + <return type="int" /> + <description> + Returns the number of channels allocated for communication with peer. + </description> + </method> + <method name="get_state" qualifiers="const"> + <return type="int" enum="ENetPacketPeer.PeerState" /> + <description> + Returns the current peer state. See [enum PeerState]. + </description> + </method> + <method name="get_statistic"> + <return type="float" /> + <argument index="0" name="statistic" type="int" enum="ENetPacketPeer.PeerStatistic" /> + <description> + Returns the requested [code]statistic[/code] for this peer. See [enum PeerStatistic]. + </description> + </method> + <method name="is_active" qualifiers="const"> + <return type="bool" /> + <description> + Returns [code]true[/code] if the peer is currently active (i.e. the associated [ENetConnection] is still valid). + </description> + </method> + <method name="peer_disconnect"> + <return type="void" /> + <argument index="0" name="data" type="int" default="0" /> + <description> + Request a disconnection from a peer. An [constant ENetConnection.EVENT_DISCONNECT] will be generated during [method ENetConnection.service] once the disconnection is complete. + </description> + </method> + <method name="peer_disconnect_later"> + <return type="void" /> + <argument index="0" name="data" type="int" default="0" /> + <description> + Request a disconnection from a peer, but only after all queued outgoing packets are sent. An [constant ENetConnection.EVENT_DISCONNECT] will be generated during [method ENetConnection.service] once the disconnection is complete. + </description> + </method> + <method name="peer_disconnect_now"> + <return type="void" /> + <argument index="0" name="data" type="int" default="0" /> + <description> + Force an immediate disconnection from a peer. No [constant ENetConnection.EVENT_DISCONNECT] will be generated. The foreign peer is not guaranteed to receive the disconnect notification, and is reset immediately upon return from this function. + </description> + </method> + <method name="ping"> + <return type="void" /> + <description> + Sends a ping request to a peer. ENet automatically pings all connected peers at regular intervals, however, this function may be called to ensure more frequent ping requests. + </description> + </method> + <method name="ping_interval"> + <return type="void" /> + <argument index="0" name="ping_interval" type="int" /> + <description> + Sets the [code]ping_interval[/code] in milliseconds at which pings will be sent to a peer. Pings are used both to monitor the liveness of the connection and also to dynamically adjust the throttle during periods of low traffic so that the throttle has reasonable responsiveness during traffic spikes. + </description> + </method> + <method name="reset"> + <return type="void" /> + <description> + Forcefully disconnects a peer. The foreign host represented by the peer is not notified of the disconnection and will timeout on its connection to the local host. + </description> + </method> + <method name="send"> + <return type="int" enum="Error" /> + <argument index="0" name="channel" type="int" /> + <argument index="1" name="packet" type="PackedByteArray" /> + <argument index="2" name="flags" type="int" /> + <description> + Queues a [code]packet[/code] to be sent over the specified [code]channel[/code]. See [code]FLAG_*[/code] constants for available packet flags. + </description> + </method> + <method name="set_timeout"> + <return type="void" /> + <argument index="0" name="timeout" type="int" /> + <argument index="1" name="timeout_min" type="int" /> + <argument index="2" name="timeout_max" type="int" /> + <description> + Sets the timeout parameters for a peer. The timeout parameters control how and when a peer will timeout from a failure to acknowledge reliable traffic. Timeout values are expressed in milliseconds. + The [code]timeout_limit[/code] is a factor that, multiplied by a value based on the average round trip time, will determine the timeout limit for a reliable packet. When that limit is reached, the timeout will be doubled, and the peer will be disconnected if that limit has reached [code]timeout_min[/code]. The [code]timeout_max[/code] parameter, on the other hand, defines a fixed timeout for which any packet must be acknowledged or the peer will be dropped. + </description> + </method> + <method name="throttle_configure"> + <return type="void" /> + <argument index="0" name="interval" type="int" /> + <argument index="1" name="acceleration" type="int" /> + <argument index="2" name="deceleration" type="int" /> + <description> + Configures throttle parameter for a peer. + Unreliable packets are dropped by ENet in response to the varying conditions of the Internet connection to the peer. The throttle represents a probability that an unreliable packet should not be dropped and thus sent by ENet to the peer. By measuring fluctuations in round trip times of reliable packets over the specified [code]interval[/code], ENet will either increase the probably by the amount specified in the [code]acceleration[/code] parameter, or decrease it by the amount specified in the [code]deceleration[/code] parameter (both are ratios to [constant PACKET_THROTTLE_SCALE]). + When the throttle has a value of [constant PACKET_THROTTLE_SCALE], no unreliable packets are dropped by ENet, and so 100% of all unreliable packets will be sent. + When the throttle has a value of 0, all unreliable packets are dropped by ENet, and so 0% of all unreliable packets will be sent. + Intermediate values for the throttle represent intermediate probabilities between 0% and 100% of unreliable packets being sent. The bandwidth limits of the local and foreign hosts are taken into account to determine a sensible limit for the throttle probability above which it should not raise even in the best of conditions. + </description> + </method> + </methods> + <constants> + <constant name="STATE_DISCONNECTED" value="0" enum="PeerState"> + </constant> + <constant name="STATE_CONNECTING" value="1" enum="PeerState"> + </constant> + <constant name="STATE_ACKNOWLEDGING_CONNECT" value="2" enum="PeerState"> + </constant> + <constant name="STATE_CONNECTION_PENDING" value="3" enum="PeerState"> + </constant> + <constant name="STATE_CONNECTION_SUCCEEDED" value="4" enum="PeerState"> + </constant> + <constant name="STATE_CONNECTED" value="5" enum="PeerState"> + </constant> + <constant name="STATE_DISCONNECT_LATER" value="6" enum="PeerState"> + </constant> + <constant name="STATE_DISCONNECTING" value="7" enum="PeerState"> + </constant> + <constant name="STATE_ACKNOWLEDGING_DISCONNECT" value="8" enum="PeerState"> + </constant> + <constant name="STATE_ZOMBIE" value="9" enum="PeerState"> + </constant> + <constant name="PEER_PACKET_LOSS" value="0" enum="PeerStatistic"> + Mean packet loss of reliable packets as a ratio with respect to the [constant PACKET_LOSS_SCALE]. + </constant> + <constant name="PEER_PACKET_LOSS_VARIANCE" value="1" enum="PeerStatistic"> + Packet loss variance. + </constant> + <constant name="PEER_PACKET_LOSS_EPOCH" value="2" enum="PeerStatistic"> + </constant> + <constant name="PEER_ROUND_TRIP_TIME" value="3" enum="PeerStatistic"> + Mean packet round trip time for reliable packets. + </constant> + <constant name="PEER_ROUND_TRIP_TIME_VARIANCE" value="4" enum="PeerStatistic"> + Variance of the mean round trip time. + </constant> + <constant name="PEER_LAST_ROUND_TRIP_TIME" value="5" enum="PeerStatistic"> + Last recorded round trip time for a reliable packet. + </constant> + <constant name="PEER_LAST_ROUND_TRIP_TIME_VARIANCE" value="6" enum="PeerStatistic"> + Variance of the last trip time recorded. + </constant> + <constant name="PEER_PACKET_THROTTLE" value="7" enum="PeerStatistic"> + </constant> + <constant name="PEER_PACKET_THROTTLE_LIMIT" value="8" enum="PeerStatistic"> + </constant> + <constant name="PEER_PACKET_THROTTLE_COUNTER" value="9" enum="PeerStatistic"> + </constant> + <constant name="PEER_PACKET_THROTTLE_EPOCH" value="10" enum="PeerStatistic"> + </constant> + <constant name="PEER_PACKET_THROTTLE_ACCELERATION" value="11" enum="PeerStatistic"> + </constant> + <constant name="PEER_PACKET_THROTTLE_DECELERATION" value="12" enum="PeerStatistic"> + </constant> + <constant name="PEER_PACKET_THROTTLE_INTERVAL" value="13" enum="PeerStatistic"> + </constant> + <constant name="PACKET_LOSS_SCALE" value="65536"> + The reference scale for packet loss. See [method get_statistic] and [constant PEER_PACKET_LOSS]. + </constant> + <constant name="PACKET_THROTTLE_SCALE" value="32"> + The reference value for throttle configuration. See [method throttle_configure]. + </constant> + <constant name="FLAG_RELIABLE" value="1"> + Mark the packet to be sent as reliable. + </constant> + <constant name="FLAG_UNSEQUENCED" value="2"> + Mark the packet to be sent unsequenced (unreliable). + </constant> + <constant name="FLAG_UNRELIABLE_FRAGMENT" value="8"> + Mark the packet to be sent unreliable even if the packet is too big and needs fragmentation (increasing the chance of it being dropped). + </constant> + </constants> +</class> diff --git a/modules/enet/doc_classes/NetworkedMultiplayerENet.xml b/modules/enet/doc_classes/NetworkedMultiplayerENet.xml deleted file mode 100644 index 271cb03c9f..0000000000 --- a/modules/enet/doc_classes/NetworkedMultiplayerENet.xml +++ /dev/null @@ -1,194 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="NetworkedMultiplayerENet" inherits="NetworkedMultiplayerPeer" version="4.0"> - <brief_description> - PacketPeer implementation using the [url=http://enet.bespin.org/index.html]ENet[/url] library. - </brief_description> - <description> - A PacketPeer implementation that should be passed to [member SceneTree.network_peer] after being initialized as either a client or server. Events can then be handled by connecting to [SceneTree] signals. - ENet's purpose is to provide a relatively thin, simple and robust network communication layer on top of UDP (User Datagram Protocol). - [b]Note:[/b] ENet only uses UDP, not TCP. When forwarding the server port to make your server accessible on the public Internet, you only need to forward the server port in UDP. You can use the [UPNP] class to try to forward the server port automatically when starting the server. - </description> - <tutorials> - <link title="High-level multiplayer">https://docs.godotengine.org/en/latest/tutorials/networking/high_level_multiplayer.html</link> - <link title="API documentation on the ENet website">http://enet.bespin.org/usergroup0.html</link> - </tutorials> - <methods> - <method name="close_connection"> - <return type="void"> - </return> - <argument index="0" name="wait_usec" type="int" default="100"> - </argument> - <description> - Closes the connection. Ignored if no connection is currently established. If this is a server it tries to notify all clients before forcibly disconnecting them. If this is a client it simply closes the connection to the server. - </description> - </method> - <method name="create_client"> - <return type="int" enum="Error"> - </return> - <argument index="0" name="address" type="String"> - </argument> - <argument index="1" name="port" type="int"> - </argument> - <argument index="2" name="in_bandwidth" type="int" default="0"> - </argument> - <argument index="3" name="out_bandwidth" type="int" default="0"> - </argument> - <argument index="4" name="local_port" type="int" default="0"> - </argument> - <description> - Create client that connects to a server at [code]address[/code] using specified [code]port[/code]. The given address needs to be either a fully qualified domain name (e.g. [code]"www.example.com"[/code]) or an IP address in IPv4 or IPv6 format (e.g. [code]"192.168.1.1"[/code]). The [code]port[/code] is the port the server is listening on. The [code]in_bandwidth[/code] and [code]out_bandwidth[/code] parameters can be used to limit the incoming and outgoing bandwidth to the given number of bytes per second. The default of 0 means unlimited bandwidth. Note that ENet will strategically drop packets on specific sides of a connection between peers to ensure the peer's bandwidth is not overwhelmed. The bandwidth parameters also determine the window size of a connection which limits the amount of reliable packets that may be in transit at any given time. Returns [constant OK] if a client was created, [constant ERR_ALREADY_IN_USE] if this NetworkedMultiplayerENet instance already has an open connection (in which case you need to call [method close_connection] first) or [constant ERR_CANT_CREATE] if the client could not be created. If [code]local_port[/code] is specified, the client will also listen to the given port; this is useful for some NAT traversal techniques. - </description> - </method> - <method name="create_server"> - <return type="int" enum="Error"> - </return> - <argument index="0" name="port" type="int"> - </argument> - <argument index="1" name="max_clients" type="int" default="32"> - </argument> - <argument index="2" name="in_bandwidth" type="int" default="0"> - </argument> - <argument index="3" name="out_bandwidth" type="int" default="0"> - </argument> - <description> - Create server that listens to connections via [code]port[/code]. The port needs to be an available, unused port between 0 and 65535. Note that ports below 1024 are privileged and may require elevated permissions depending on the platform. To change the interface the server listens on, use [method set_bind_ip]. The default IP is the wildcard [code]"*"[/code], which listens on all available interfaces. [code]max_clients[/code] is the maximum number of clients that are allowed at once, any number up to 4095 may be used, although the achievable number of simultaneous clients may be far lower and depends on the application. For additional details on the bandwidth parameters, see [method create_client]. Returns [constant OK] if a server was created, [constant ERR_ALREADY_IN_USE] if this NetworkedMultiplayerENet instance already has an open connection (in which case you need to call [method close_connection] first) or [constant ERR_CANT_CREATE] if the server could not be created. - </description> - </method> - <method name="disconnect_peer"> - <return type="void"> - </return> - <argument index="0" name="id" type="int"> - </argument> - <argument index="1" name="now" type="bool" default="false"> - </argument> - <description> - Disconnect the given peer. If "now" is set to [code]true[/code], the connection will be closed immediately without flushing queued messages. - </description> - </method> - <method name="get_last_packet_channel" qualifiers="const"> - <return type="int"> - </return> - <description> - Returns the channel of the last packet fetched via [method PacketPeer.get_packet]. - </description> - </method> - <method name="get_local_port" qualifiers="const"> - <return type="int"> - </return> - <description> - Returns the local port to which this peer is bound. - </description> - </method> - <method name="get_packet_channel" qualifiers="const"> - <return type="int"> - </return> - <description> - Returns the channel of the next packet that will be retrieved via [method PacketPeer.get_packet]. - </description> - </method> - <method name="get_peer_address" qualifiers="const"> - <return type="String"> - </return> - <argument index="0" name="id" type="int"> - </argument> - <description> - Returns the IP address of the given peer. - </description> - </method> - <method name="get_peer_port" qualifiers="const"> - <return type="int"> - </return> - <argument index="0" name="id" type="int"> - </argument> - <description> - Returns the remote port of the given peer. - </description> - </method> - <method name="set_bind_ip"> - <return type="void"> - </return> - <argument index="0" name="ip" type="String"> - </argument> - <description> - The IP used when creating a server. This is set to the wildcard [code]"*"[/code] by default, which binds to all available interfaces. The given IP needs to be in IPv4 or IPv6 address format, for example: [code]"192.168.1.1"[/code]. - </description> - </method> - <method name="set_dtls_certificate"> - <return type="void"> - </return> - <argument index="0" name="certificate" type="X509Certificate"> - </argument> - <description> - Configure the [X509Certificate] to use when [member use_dtls] is [code]true[/code]. For servers, you must also setup the [CryptoKey] via [method set_dtls_key]. - </description> - </method> - <method name="set_dtls_key"> - <return type="void"> - </return> - <argument index="0" name="key" type="CryptoKey"> - </argument> - <description> - Configure the [CryptoKey] to use when [member use_dtls] is [code]true[/code]. Remember to also call [method set_dtls_certificate] to setup your [X509Certificate]. - </description> - </method> - <method name="set_peer_timeout"> - <return type="void"> - </return> - <argument index="0" name="id" type="int"> - </argument> - <argument index="1" name="timeout_limit" type="int"> - </argument> - <argument index="2" name="timeout_min" type="int"> - </argument> - <argument index="3" name="timeout_max" type="int"> - </argument> - <description> - Sets the timeout parameters for a peer. The timeout parameters control how and when a peer will timeout from a failure to acknowledge reliable traffic. Timeout values are expressed in milliseconds. - The [code]timeout_limit[/code] is a factor that, multiplied by a value based on the average round trip time, will determine the timeout limit for a reliable packet. When that limit is reached, the timeout will be doubled, and the peer will be disconnected if that limit has reached [code]timeout_min[/code]. The [code]timeout_max[/code] parameter, on the other hand, defines a fixed timeout for which any packet must be acknowledged or the peer will be dropped. - </description> - </method> - </methods> - <members> - <member name="always_ordered" type="bool" setter="set_always_ordered" getter="is_always_ordered" default="false"> - Enforce ordered packets when using [constant NetworkedMultiplayerPeer.TRANSFER_MODE_UNRELIABLE] (thus behaving similarly to [constant NetworkedMultiplayerPeer.TRANSFER_MODE_UNRELIABLE_ORDERED]). This is the only way to use ordering with the RPC system. - </member> - <member name="channel_count" type="int" setter="set_channel_count" getter="get_channel_count" default="3"> - The number of channels to be used by ENet. Channels are used to separate different kinds of data. In reliable or ordered mode, for example, the packet delivery order is ensured on a per-channel basis. This is done to combat latency and reduces ordering restrictions on packets. The delivery status of a packet in one channel won't stall the delivery of other packets in another channel. - </member> - <member name="compression_mode" type="int" setter="set_compression_mode" getter="get_compression_mode" enum="NetworkedMultiplayerENet.CompressionMode" default="0"> - The compression method used for network packets. These have different tradeoffs of compression speed versus bandwidth, you may need to test which one works best for your use case if you use compression at all. - </member> - <member name="dtls_verify" type="bool" setter="set_dtls_verify_enabled" getter="is_dtls_verify_enabled" default="true"> - Enable or disable certificate verification when [member use_dtls] [code]true[/code]. - </member> - <member name="refuse_new_connections" type="bool" setter="set_refuse_new_connections" getter="is_refusing_new_connections" override="true" default="false" /> - <member name="server_relay" type="bool" setter="set_server_relay_enabled" getter="is_server_relay_enabled" default="true"> - Enable or disable the server feature that notifies clients of other peers' connection/disconnection, and relays messages between them. When this option is [code]false[/code], clients won't be automatically notified of other peers and won't be able to send them packets through the server. - </member> - <member name="transfer_channel" type="int" setter="set_transfer_channel" getter="get_transfer_channel" default="-1"> - Set the default channel to be used to transfer data. By default, this value is [code]-1[/code] which means that ENet will only use 2 channels: one for reliable packets, and one for unreliable packets. The channel [code]0[/code] is reserved and cannot be used. Setting this member to any value between [code]0[/code] and [member channel_count] (excluded) will force ENet to use that channel for sending data. See [member channel_count] for more information about ENet channels. - </member> - <member name="transfer_mode" type="int" setter="set_transfer_mode" getter="get_transfer_mode" override="true" enum="NetworkedMultiplayerPeer.TransferMode" default="2" /> - <member name="use_dtls" type="bool" setter="set_dtls_enabled" getter="is_dtls_enabled" default="false"> - When enabled, the client or server created by this peer, will use [PacketPeerDTLS] instead of raw UDP sockets for communicating with the remote peer. This will make the communication encrypted with DTLS at the cost of higher resource usage and potentially larger packet size. - Note: When creating a DTLS server, make sure you setup the key/certificate pair via [method set_dtls_key] and [method set_dtls_certificate]. For DTLS clients, have a look at the [member dtls_verify] option, and configure the certificate accordingly via [method set_dtls_certificate]. - </member> - </members> - <constants> - <constant name="COMPRESS_NONE" value="0" enum="CompressionMode"> - No compression. This uses the most bandwidth, but has the upside of requiring the fewest CPU resources. - </constant> - <constant name="COMPRESS_RANGE_CODER" value="1" enum="CompressionMode"> - ENet's built-in range encoding. - </constant> - <constant name="COMPRESS_FASTLZ" value="2" enum="CompressionMode"> - [url=http://fastlz.org/]FastLZ[/url] compression. This option uses less CPU resources compared to [constant COMPRESS_ZLIB], at the expense of using more bandwidth. - </constant> - <constant name="COMPRESS_ZLIB" value="3" enum="CompressionMode"> - [url=https://www.zlib.net/]Zlib[/url] compression. This option uses less bandwidth compared to [constant COMPRESS_FASTLZ], at the expense of using more CPU resources. - </constant> - <constant name="COMPRESS_ZSTD" value="4" enum="CompressionMode"> - [url=https://facebook.github.io/zstd/]Zstandard[/url] compression. - </constant> - </constants> -</class> |