summaryrefslogtreecommitdiffstats
path: root/modules/enet/enet_multiplayer_peer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix copyright headers referring to GodotSpartan3222024-10-271-2/+2
|
* Rebrand preambles to RedotDubhghlas McLaughlin2024-10-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | Credits: Co-authored-by: Skogi <skogi.b@gmail.com> Co-authored-by: Spartan322 <Megacake1234@gmail.com> Co-authored-by: swashberry <swashdev@pm.me> Co-authored-by: Christoffer Sundbom <christoffer_karlsson@live.se> Co-authored-by: Dubhghlas McLaughlin <103212704+mcdubhghlas@users.noreply.github.com> Co-authored-by: McDubh <103212704+mcdubhghlas@users.noreply.github.com> Co-authored-by: Dubhghlas McLaughlin <103212704+mcdubhghlas@users.noreply.github.com> Co-authored-by: radenthefolf <radenthefolf@gmail.com> Co-authored-by: John Knight <80524176+Tekisasu-JohnK@users.noreply.github.com> Co-authored-by: Adam Vondersaar <adam.vondersaar@uphold.com> Co-authored-by: decryptedchaos <nixgod@gmail.com> Co-authored-by: zaftnotameni <122100803+zaftnotameni@users.noreply.github.com> Co-authored-by: Aaron Benjamin <lifeartstudios@gmail.com> Co-authored-by: wesam <108880473+wesamdev@users.noreply.github.com> Co-authored-by: Mister Puma <MisterPuma80@gmail.com> Co-authored-by: Aaron Benjamin <lifeartstudios@gmail.com> Co-authored-by: SingleError <isaaconeoneone@gmail.com> Co-authored-by: Bioblaze Payne <BioblazePayne@gmail.com>
* Reduce and prevent unnecessary random-access to `List`A Thousand Ships2024-05-041-2/+2
| | | | | | | | | Random-access access to `List` when iterating is `O(n^2)` (`O(n)` when accessing a single element) * Removed subscript operator, in favor of a more explicit `get` * Added conversion from `Iterator` to `ConstIterator` * Remade existing operations into other solutions when applicable
* Replace error checks against `size` with `is_empty`A Thousand Ships2024-02-091-4/+4
|
* [ENet] Properly set transfer flags when using custom channelsFabio Alessandrelli2023-08-051-15/+14
|
* Style: Harmonize header includes in modulesRémi Verschelde2023-06-151-0/+1
| | | | | | | | | | | | | | | | | | | | This applies our existing style guide, and adds a new rule to that style guide for modular components such as platform ports and modules: Includes from the platform port or module ("local" includes) should be listed first in their own block using relative paths, before Godot's "core" includes which use "absolute" (project folder relative) paths, and finally thirdparty includes. Includes in `#ifdef`s come after their relevant section, i.e. the overall structure is: - Local includes * Conditional local includes - Core includes * Conditional core includes - Thirdparty includes * Conditional thirdparty includes
* Fix various typos with codespellRémi Verschelde2023-01-301-1/+1
| | | | | | And include #72377. Co-authored-by: Wiktor Kocielski <withaust@gmail.com>
* One Copyright Update to rule them allRémi Verschelde2023-01-051-29/+29
| | | | | | | | | | | | | | | | | | | | As many open source projects have started doing it, we're removing the current year from the copyright notice, so that we don't need to bump it every year. It seems like only the first year of publication is technically relevant for copyright notices, and even that seems to be something that many companies stopped listing altogether (in a version controlled codebase, the commits are a much better source of date of publication than a hardcoded copyright statement). We also now list Godot Engine contributors first as we're collectively the current maintainers of the project, and we clarify that the "exclusive" copyright of the co-founders covers the timespan before opensourcing (their further contributions are included as part of Godot Engine contributors). Also fixed "cf." Frenchism - it's meant as "refer to / see".
* [MP] Remove connection state signals from MultiplayerPeer.Fabio Alessandrelli2022-11-021-8/+1
| | | | Now handled directly by the MultiplayerAPI implementation.
* [MP] Add MultiplayerPeer disconnect_peer, close.Fabio Alessandrelli2022-10-281-141/+106
| | | | | Update ENet, WebRTC, and WebSocket to support peer disconnection and unify the close function.
* [MP] Let MultiplayerAPI handle packet relaying and peer signaling.Fabio Alessandrelli2022-10-271-179/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | MultiplayerPeer changes: - Adds is_server_relay_supported virtual method Informs the upper MultiplayerAPI layer if it can signal peers connected to the server to other clients, and perform packet relaying among them. - Adds get_packet_channel and get_packet_mode virtual methods Allows the MultiplayerAPI to retrieve the channel and transfer modes to use when relaying the last received packet. SceneMultiplayerPeer changes: - Implement peer signaling and packet relaying when the MultiplayerPeer advertise they are supported. ENet, WebRTC, WebSocket changes: - Removed custom code for relaying from WebSocket and ENet, and let it be handled by the upper layer. - Update WebRTC to split create_client, create_server, and create_mesh, with the latter behaving like the old initialize with "server_compatibility = false", and the first two supporting the upper layer relaying protocol.
* Fix MSVC warnings, rename shadowed variables, fix uninitialized values, ↵bruvzg2022-10-071-3/+3
| | | | change warnings=all to use /W4.
* [Net] Modularize multiplayer, expose MultiplayerAPI to extensions.Fabio Alessandrelli2022-07-261-3/+3
| | | | | | | | | - RPC configurations are now dictionaries. - Script.get_rpc_methods renamed to Script.get_rpc_config. - Node.rpc[_id] and Callable.rpc now return an Error. - Refactor MultiplayerAPI to allow extension. - New MultiplayerAPI.rpc method with Array argument (for scripts). - Move the default MultiplayerAPI implementation to a module.
* Update copyright statements to 2022Rémi Verschelde2022-01-031-2/+2
| | | | Happy new year to the wonderful Godot community!
* Fix various typosluz paz2022-01-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Found via ` codespell -q 3 -S ./thirdparty,*.po,./DONORS.md -L ackward,ang,ans,ba,beng,cas,childs,childrens,dof,doubleclick,expct,fave,findn,gird,hist,inout,leapyear,lod,nd,numer,ois,ony,paket,seeked,sinc,switchs,te,uint,varn` Update editor/import/resource_importer_layered_texture.cpp Co-authored-by: Raul Santos <raulsntos@gmail.com> Update doc/classes/TileSetScenesCollectionSource.xml Co-authored-by: Raul Santos <raulsntos@gmail.com> Update scene/gui/graph_edit.cpp Co-authored-by: Raul Santos <raulsntos@gmail.com> Update scene/resources/animation.cpp Co-authored-by: Raul Santos <raulsntos@gmail.com> Update scene/resources/animation.cpp Co-authored-by: Raul Santos <raulsntos@gmail.com> Update scene/resources/animation.cpp Co-authored-by: Raul Santos <raulsntos@gmail.com> Update scene/gui/rich_text_label.cpp Co-authored-by: Raul Santos <raulsntos@gmail.com> Revert previously committed change
* [Net] ENet poll now only service the connection once.Jordan Schidlowsky2021-12-151-125/+126
| | | | | | | | | It used to call `enet_host_service` until all events were consumed, but that also meant constantly polling the connection leading to potentially unbounded processing time. It now only service the connection once, and instead consumes all the retrieved events via `enet_host_check_events`.
* [Net] ENetMultiplayerPeer now sends fragmented packets unreliably too.Jordan Schidlowsky2021-12-151-2/+8
| | | | | | | | | It used to always send them reliably when transfer mode was unreliable or ordered if the packet size was more then the enet host MTU (1400 bytes by default). This commit also adds a warning when debug is enabled to explain the effects of sending fragmented packets unreliably.
* [Net] Rename RPC constants and annotation arguments.Fabio Alessandrelli2021-10-011-1/+1
| | | | | | | | | any -> any_peer sync -> call_local ordered -> unreliable_ordered Multiplayer.RPC_MODE_ANY -> RPC_MODE_ANY_PEER Multiplayer.TRANSFER_MODE_ORDERED -> TRANSFER_MODE_UNRELIABLE_ORDERED
* Merge pull request #52481 from Faless/net/4.x_native_peersFabio Alessandrelli2021-09-281-28/+9
|\ | | | | [Net] Extension system for network peers, webrtc.
| * [Net] MultiplayerPeer cleanup, defaults.Fabio Alessandrelli2021-09-241-28/+9
| |
* | [ENet] Fix server not correctly relaying peer disconnects.Fabio Alessandrelli2021-09-271-1/+1
|/
* [Net] Move multiplayer to core subdir, split RPCManager.Fabio Alessandrelli2021-09-071-5/+5
| | | | | | | | | | | Move multiplayer classes to "core/multiplayer" subdir. Move the RPCConfig and enums (TransferMode, RPCMode) to a separate file (multiplayer.h), and bind them to the global namespace. Move the RPC handling code to its own class (RPCManager). Renames "get_rpc_sender_id" to "get_remote_sender_id".
* [Net] Silence ENetMultiplayerPeer close_connection.Fabio Alessandrelli2021-09-021-1/+3
| | | | | Used to print an error when it was not active, now it just returns immediately as per the documentation.
* [Net] Fix ENetMultiplayerPeer status during connection.Fabio Alessandrelli2021-08-061-1/+1
| | | | | While the client emitting "peer_connect" for the server, the status was still set to CONNECTION_CONNECTING, causing bugs in the upper layer.
* [Net] Implement RPC channels in MultiplayerAPI.Fabio Alessandrelli2021-07-301-14/+25
|
* [Net] Refactor ENetMultiplayerPeer to use ENet wrappers.Fabio Alessandrelli2021-07-291-646/+417
|
* [Net] Add generate_unique_id to MultiplayerPeer.Fabio Alessandrelli2021-07-291-22/+1
| | | | | | Used by ENetMultiplayerPeer and WebSocketServer to generate network IDs, and exposed to the user for p2p networks (e.g. WebRTCMultiplayerPeer) and custom MultiplayerPeer implementations.
* Optimize StringName usagereduz2021-07-181-8/+8
| | | | | | | | | | | * Added a new macro SNAME() that constructs and caches a local stringname. * Subsequent usages use the cached version. * Since these use a global static variable, a second refcounter of static usages need to be kept for cleanup time. * Replaced all theme usages by this new macro. * Replace all signal emission usages by this new macro. * Replace all call_deferred usages by this new macro. This is part of ongoing work to optimize GUI and the editor.
* [Net] Rename NetworkedMultiplayerENet to ENetMultiplayerPeer.Fabio Alessandrelli2021-07-121-0/+926