summaryrefslogtreecommitdiff
path: root/modules/multiplayer
AgeCommit message (Collapse)Author
2023-02-14Fix multiplayer replication crash in on_sync_receive.baptr
A number of early continue cases applied the packet-provided `size` without validation, allowing large uint32_t values to be treated as negative offsets and leading to segfaults. Now, we validate `size` against the buffer length immediately to avoid a crash. This could be triggered by receiving sync data for a synchronizer who's root node had just been removed, since the code path that checked for unusable sync state failed to advance the offset. Thus the next read could interpret part of the payload as such an invalid `size`. Now, we properly advance the read offset in that case (and raise a better error).
2023-02-12[MP] Fix MultiplayerSpawner not connecting to child_entered_tree.Fabio Alessandrelli
The connection used to happen during enter_tree, but this was causing issues when setting the spawnable scenes from code. The spawner now connects/disconnects to the signal during add_spawnable_scene/clear_spawnable_scenes if the node is inside tree and has a valid spawn_path.
2023-02-09Improve some editor strings for localizationHaoyu Qiu
2023-01-23Convert en_GB spelling to en_US with codespellRémi Verschelde
2023-01-18Merge pull request #71379 from KoBeWi/destruction_of_compatibility_functionRémi Verschelde
Remove set_drag_forwarding_compat()
2023-01-17[MP] Fix nested spawning during "ready".Fabio Alessandrelli
We want our spawns to be notified after ready, but we need to notify them in the order they entered tree, so that nested spawners can be used during "ready" (instead of having to await a frame).
2023-01-16Add EditorUndoRedoManager singletonkobewi
2023-01-14Remove set_drag_forwarding_compat()kobewi
2023-01-11Merge pull request #71127 from reduz/drag-forward-to-callablesRémi Verschelde
Change set_drag_forwarding() to use callables.
2023-01-10Change set_drag_forwarding() to use callables.Juan Linietsky
* This solution is much cleaner than the one in 3.x thanks to the use of callables. * Works without issues in any language (no need to worry about camel or snake case). * Editor code uses a compatibility function (too much work to redo). Fixes #59899
2023-01-09Merge pull request #70721 from Faless/mp/4.x_fix_relay_optionRémi Verschelde
[MP] Fix server_relay being unsettable.
2023-01-09[MP] Convert _spawn_custom to a Callable property.Fabio Alessandrelli
Renamed to "spawn_function". Allow both custom spawn and auto spawn list to co-exist. This makes it possible to implement custom spawn without being forced to attach a script to MultiplayerSpawner directly.
2023-01-05One Copyright Update to rule them allRémi Verschelde
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".
2022-12-29[MP] Fix server_relay being unsettable.Fabio Alessandrelli
Clarify nuance in the docs.
2022-12-09Merge pull request #68747 from rune-scape/rune-stringname-unificationRémi Verschelde
GDScript: Unify StringName and String
2022-12-08Use capitalized ID in the docHaoyu Qiu
2022-12-05Unify String and StringNamerune-scape
2022-11-20Merge pull request #68689 from Faless/mp/4.x_offline_is_serverRémi Verschelde
[MP] New default multiplayer_peer acting as server.
2022-11-20[MP] New default multiplayer_peer acting as server.Fabio Alessandrelli
Adds a OfflineMultiplayerPeer class which behaves like a server with no connected peers. Use OfflineMultiplayerPeer as default for SceneMultiplayer. This means that the SceneTree will act as the multiplayer authority by default. Calls to is_server will return true, and calls to get_unique_id will return TARGET_PEER_SERVER.
2022-11-20[MP] RPC visibility.Fabio Alessandrelli
Implemented using MultiplayerSynchronizers. If you didn't use the synchronizer visibility features, nothing changes. If you were using visibility, RPCs to broadcast should now behave as expected in most configurations (i.e. by sending the RPC to _visible_ peers). If you want to limit the visibility of RPCs for a node, add a synchronizer for it, and configure the visibility via "set_visibility_for" or by adding a visibility filter.
2022-11-19[MP] Initial replication profiler.Fabio Alessandrelli
Part of the current network profiler stack. Tracks synchronizers, incoming/outgoing state sizes, and their bandwidth usage.
2022-11-17[MP] Improve network profiler.Fabio Alessandrelli
Fix RPC profiler and add average RPC size. Improve bandwidth debugger to account for all multiplayer traffic (excluding the lower level peer transformations).
2022-11-14Fix periods in editor strings and messagesHugo Locurcio
- Ensure all strings with ellipsis end with 3 periods instead of 2. - Fix extraneous period in "Error calling from signal '...' to callable" messages.
2022-11-14[MP] Move engine and editor profilers to a plugin.Fabio Alessandrelli
Also refactor the editor plugin out of the ReplicationEditor.
2022-11-11Use forward-declarations in EditorPlugin where possibletrollodel
2022-11-02Style: Misc docs and comment style and language fixesRémi Verschelde
- Removed empty paragraphs in XML. - Consistently use bold style for "Example:", on a new line. - Fix usage of `[code]` when hyperlinks could be used (`[member]`, `[constant]`). - Fix invalid usage of backticks for inline code in BBCode. - Fix some American/British English spelling inconsistencies. - Other minor fixes spotted along the way, including typo fixes with codespell. - Don't specify `@GlobalScope` for `enum` and `constant`.
2022-11-02Merge pull request #65062 from KoBeWi/RedoUndoRémi Verschelde
Unify usage of undo_redo in editor
2022-11-02Unify usage of undo_redo in editorkobewi
2022-11-02[MP] Remove connection state signals from MultiplayerPeer.Fabio Alessandrelli
Now handled directly by the MultiplayerAPI implementation.
2022-11-02[MP] Add optional authentication to SceneMultiplayer.Fabio Alessandrelli
Add few methods to allow peers to exchange authentication information. - `set_auth_callback(callback)`: Enable the authentication features. The callback is a `Callable` that accepts an `int` (the peer ID), and a `PackedByteArray` of data. - The `peer_authenticating(id)` signal will be emitted instead of `peer_connected` when a new peer connects. - Use `send_auth(id: int, data: PackedByteArray)` to exchange data. - Call `complete_auth(id: int)` when the authentication process is complete and you expect to start receiving game data. - The `peer_connected` signal will be emitted as soon as both parties complete the authentication. - Use `disconnect_peer(id)` to disconnect a connected peer. - If the `peer_connected` signal didn't fire for that peer (i.e. it was still in the authentication phase), the `peer_auth_failed` signal will be emitted instead of `peer_disconnected`.
2022-10-31Merge pull request #67445 from Zylann/rename_queue_deleteRémi Verschelde
Rename queue_delete => queue_free
2022-10-27[MP] Let MultiplayerAPI handle packet relaying and peer signaling.Fabio Alessandrelli
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.
2022-10-24Rename queue_delete => queue_freeMarc Gilleron
# Conflicts: # editor/plugins/tiles/tiles_editor_plugin.cpp
2022-10-23Fix MultiplayerSynchronizer::update_outbound_sync_time when ↵Wei Guo
replication_interval is not 0
2022-10-16Fix MultiplayerSynchronizer peer visibilityWei Guo
2022-10-07Fix MSVC warnings, rename shadowed variables, fix uninitialized values, ↵bruvzg
change warnings=all to use /W4.
2022-10-03[MP] Allow multiple synchronizers per node.Fabio Alessandrelli
The same node can now be controlled by multiple synchronizers at once. Spawn visibility is composed in OR across multiple synchronizers (i.e. if any synchronizer is visible to the peer, the object will be spawned). Synchronizers controlling spawned nodes can now have a different authority then the one spawning the node, in that case, the spawn variables for that specific synchronizer are simply ignored (other synchronizers with the same authority of the spawner will correctly synchronize variables on spawn). The SceneReplicationState class has been completly removed, since it was bloating the implementation, the state is now simply stored in the SceneReplicationInterface.
2022-09-30Merge pull request #65970 from GuilhermeGSousa/synchronizer-auth-changeRémi Verschelde
Add warning for synchronizer authority mismatch
2022-09-30Fix typos with codespellRémi Verschelde
Using codespell 2.3-dev from current git. And fix typo in `methods.py` for `vsproj=yes` option (still won't work though).
2022-09-30Add Error for synchronizer authority mismatchGuilherme Sousa
2022-09-26SCons: Unify tools/target build type configurationRémi Verschelde
Implements https://github.com/godotengine/godot-proposals/issues/3371. New `target` presets ==================== The `tools` option is removed and `target` changes to use three new presets, which match the builds users are familiar with. These targets control the default optimization level and enable editor-specific and debugging code: - `editor`: Replaces `tools=yes target=release_debug`. * Defines: `TOOLS_ENABLED`, `DEBUG_ENABLED`, `-O2`/`/O2` - `template_debug`: Replaces `tools=no target=release_debug`. * Defines: `DEBUG_ENABLED`, `-O2`/`/O2` - `template_release`: Replaces `tools=no target=release`. * Defines: `-O3`/`/O2` New `dev_build` option ====================== The previous `target=debug` is now replaced by a separate `dev_build=yes` option, which can be used in combination with either of the three targets, and changes the following: - `dev_build`: Defines `DEV_ENABLED`, disables optimization (`-O0`/`/0d`), enables generating debug symbols, does not define `NDEBUG` so `assert()` works in thirdparty libraries, adds a `.dev` suffix to the binary name. Note: Unlike previously, `dev_build` defaults to off so that users who compile Godot from source get an optimized and small build by default. Engine contributors should now set `dev_build=yes` in their build scripts or IDE configuration manually. Changed binary names ==================== The name of generated binaries and object files are changed too, to follow this format: `godot.<platform>.<target>[.dev][.double].<arch>[.<extra_suffix>][.<ext>]` For example: - `godot.linuxbsd.editor.dev.arm64` - `godot.windows.template_release.double.x86_64.mono.exe` Be sure to update your links/scripts/IDE config accordingly. More flexible `optimize` and `debug_symbols` options ==================================================== The optimization level and whether to generate debug symbols can be further specified with the `optimize` and `debug_symbols` options. So the default values listed above for the various `target` and `dev_build` combinations are indicative and can be replaced when compiling, e.g.: `scons p=linuxbsd target=template_debug dev_build=yes optimize=debug` will make a "debug" export template with dev-only code enabled, `-Og` optimization level for GCC/Clang, and debug symbols. Perfect for debugging complex crashes at runtime in an exported project.
2022-09-19Change return type of `get_configuration_warnings` to `PackedStringArray`Marc Gilleron
2022-09-17[MP] Add warnings to spawner and synchronizer.Fabio Alessandrelli
MultiplayerSpawner: - When spawn_path is invalid. - When the auto spawn list is empty and _spawn_custom is not overridden. Note: We remove the warning for placeholder scripts since there's no way of knowing if they have a certain method. MultiplayerSynchronizer: - When root_path is invalid.
2022-09-13do not load PackedScene from spawner until instantiatingNathan Franke
2022-09-12[Multiplayer] Fix crash in spawner get_spawnable_scene.Fabio Alessandrelli
2022-09-06Rename CONNECT_ONESHOT TO CONNECT_ONE_SHOTMicky
For consistency. Every other exposed `one_shot` is spaced out like this.
2022-08-22Add per-scene UndoRedokobewi
2022-08-08Rename the argument tag to param in XML documentationYuri Sizov
2022-08-07[MP] Cleanup and fixes for replication plugin.Fabio Alessandrelli
- Remove dead code. - Fix "Add from path" adding the wrong string when targeting root node.
2022-08-01Remove excessive `editor/property_editor.h` includesYuri Sizov