diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2021-07-30 15:28:05 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2021-07-30 15:29:52 +0200 |
commit | 7adf4cc9b5de6701a41e27690a69b9892d5eed85 (patch) | |
tree | 0019e6d1b7cd993b81d5bba268074cfc4e10a213 /modules/enet | |
parent | a1c19b9a1e53f78c75c13cb418270db80057b21a (diff) |
doc: Use self-closing tags for `return` and `argument`
For the time being we don't support writing a description for those, preferring
having all details in the method's description.
Using self-closing tags saves half the lines, and prevents contributors from
thinking that they should write the argument or return documentation there.
Diffstat (limited to 'modules/enet')
-rw-r--r-- | modules/enet/doc_classes/ENetConnection.xml | 138 | ||||
-rw-r--r-- | modules/enet/doc_classes/ENetMultiplayerPeer.xml | 72 | ||||
-rw-r--r-- | modules/enet/doc_classes/ENetPacketPeer.xml | 81 |
3 files changed, 97 insertions, 194 deletions
diff --git a/modules/enet/doc_classes/ENetConnection.xml b/modules/enet/doc_classes/ENetConnection.xml index 523f2ad165..c2a85ffdf8 100644 --- a/modules/enet/doc_classes/ENetConnection.xml +++ b/modules/enet/doc_classes/ENetConnection.xml @@ -11,182 +11,136 @@ </tutorials> <methods> <method name="bandwidth_limit"> - <return type="void"> - </return> - <argument index="0" name="in_bandwidth" type="int" default="0"> - </argument> - <argument index="1" name="out_bandwidth" type="int" default="0"> - </argument> + <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"> - </return> - <argument index="0" name="channel" type="int"> - </argument> - <argument index="1" name="packet" type="PackedByteArray"> - </argument> - <argument index="2" name="flags" type="int"> - </argument> + <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"> - </return> - <argument index="0" name="limit" type="int"> - </argument> + <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"> - </return> - <argument index="0" name="mode" type="int" enum="ENetConnection.CompressionMode"> - </argument> + <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"> - </return> - <argument index="0" name="address" type="String"> - </argument> - <argument index="1" name="port" type="int"> - </argument> - <argument index="2" name="channels" type="int" default="0"> - </argument> - <argument index="3" name="data" type="int" default="0"> - </argument> + <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"> - </return> - <argument index="0" name="max_peers" type="int" default="32"> - </argument> - <argument index="1" name="max_channels" type="int" default="0"> - </argument> - <argument index="2" name="in_bandwidth" type="int" default="0"> - </argument> - <argument index="3" name="out_bandwidth" type="int" default="0"> - </argument> + <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"> - </return> - <argument index="0" name="bind_address" type="String"> - </argument> - <argument index="1" name="bind_port" type="int"> - </argument> - <argument index="2" name="max_peers" type="int" default="32"> - </argument> - <argument index="3" name="max_channels" type="int" default="0"> - </argument> - <argument index="4" name="in_bandwidth" type="int" default="0"> - </argument> - <argument index="5" name="out_bandwidth" type="int" default="0"> - </argument> + <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"> - </return> + <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"> - </return> - <argument index="0" name="certificate" type="X509Certificate"> - </argument> - <argument index="1" name="hostname" type="String"> - </argument> - <argument index="2" name="verify" type="bool" default="true"> - </argument> + <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"> - </return> - <argument index="0" name="key" type="CryptoKey"> - </argument> - <argument index="1" name="certificate" type="X509Certificate"> - </argument> + <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"> - </return> + <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"> - </return> + <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"> - </return> + <return type="int" /> <description> Returns the maximum number of channels allowed for connected peers. </description> </method> <method name="get_peers"> - <return type="Array"> - </return> + <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"> - </return> - <argument index="0" name="statistic" type="int" enum="ENetConnection.HostStatistic"> - </argument> + <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"> - </return> - <argument index="0" name="refuse" type="bool"> - </argument> + <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"> - </return> - <argument index="0" name="timeout" type="int" default="0"> - </argument> + <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. diff --git a/modules/enet/doc_classes/ENetMultiplayerPeer.xml b/modules/enet/doc_classes/ENetMultiplayerPeer.xml index 574010a4a2..3a37b396a4 100644 --- a/modules/enet/doc_classes/ENetMultiplayerPeer.xml +++ b/modules/enet/doc_classes/ENetMultiplayerPeer.xml @@ -13,85 +13,61 @@ </tutorials> <methods> <method name="add_mesh_peer"> - <return type="int" enum="Error"> - </return> - <argument index="0" name="peer_id" type="int"> - </argument> - <argument index="1" name="host" type="ENetConnection"> - </argument> + <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"> - </return> - <argument index="0" name="wait_usec" type="int" default="100"> - </argument> + <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"> - </return> - <argument index="0" name="address" type="String"> - </argument> - <argument index="1" name="port" type="int"> - </argument> - <argument index="2" name="channel_count" type="int" default="0"> - </argument> - <argument index="3" name="in_bandwidth" type="int" default="0"> - </argument> - <argument index="4" name="out_bandwidth" type="int" default="0"> - </argument> - <argument index="5" name="local_port" type="int" default="0"> - </argument> + <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"> - </return> - <argument index="0" name="unique_id" type="int"> - </argument> + <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"> - </return> - <argument index="0" name="port" type="int"> - </argument> - <argument index="1" name="max_clients" type="int" default="32"> - </argument> - <argument index="2" name="max_channels" type="int" default="0"> - </argument> - <argument index="3" name="in_bandwidth" type="int" default="0"> - </argument> - <argument index="4" name="out_bandwidth" type="int" default="0"> - </argument> + <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"> - </return> - <argument index="0" name="id" type="int"> - </argument> + <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"> - </return> - <argument index="0" name="ip" type="String"> - </argument> + <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> diff --git a/modules/enet/doc_classes/ENetPacketPeer.xml b/modules/enet/doc_classes/ENetPacketPeer.xml index 5c9f692974..8f0693fb01 100644 --- a/modules/enet/doc_classes/ENetPacketPeer.xml +++ b/modules/enet/doc_classes/ENetPacketPeer.xml @@ -12,121 +12,94 @@ </tutorials> <methods> <method name="get_channels" qualifiers="const"> - <return type="int"> - </return> + <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"> - </return> + <return type="int" enum="ENetPacketPeer.PeerState" /> <description> Returns the current peer state. See [enum PeerState]. </description> </method> <method name="get_statistic"> - <return type="float"> - </return> - <argument index="0" name="statistic" type="int" enum="ENetPacketPeer.PeerStatistic"> - </argument> + <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"> - </return> + <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"> - </return> - <argument index="0" name="data" type="int" default="0"> - </argument> + <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"> - </return> - <argument index="0" name="data" type="int" default="0"> - </argument> + <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"> - </return> - <argument index="0" name="data" type="int" default="0"> - </argument> + <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"> - </return> + <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"> - </return> - <argument index="0" name="ping_interval" type="int"> - </argument> + <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"> - </return> + <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"> - </return> - <argument index="0" name="channel" type="int"> - </argument> - <argument index="1" name="packet" type="PackedByteArray"> - </argument> - <argument index="2" name="flags" type="int"> - </argument> + <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"> - </return> - <argument index="0" name="timeout" type="int"> - </argument> - <argument index="1" name="timeout_min" type="int"> - </argument> - <argument index="2" name="timeout_max" type="int"> - </argument> + <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"> - </return> - <argument index="0" name="interval" type="int"> - </argument> - <argument index="1" name="acceleration" type="int"> - </argument> - <argument index="2" name="deceleration" type="int"> - </argument> + <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]). |