Commit Graph

12 Commits

Author SHA1 Message Date
Fabio Alessandrelli 311a27281f [MP] Avoid unnecessary internal ref/unrefs
Access the various internal components (cache/replicator) via pointer,
to avoid unnecessary overhead.
2023-10-10 14:42:54 +02:00
Fabio Alessandrelli 9ce423914e [MP] Optimize internal authority checks
We already know which MultiplayerAPI a certain Node uses, so we don't
need to retrieve it via SceneTree every time.
2023-10-10 14:42:54 +02:00
Fabio Alessandrelli 61cf7d180c [MP] Optimize multiplayer NodePath caching
Only use paths during network transfer.
Use ObjectID instead of NodePaths for storing the Node <-> NetID
relations locally.
2023-10-10 14:42:48 +02:00
A Thousand Ships 517e9f8aef [Modules] Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable 2023-09-26 16:44:52 +02:00
Rémi Verschelde 25b2f1780a
Style: Harmonize header includes in modules
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
2023-06-15 14:35:45 +02:00
Rémi Verschelde d95794ec8a
One Copyright Update to rule them all
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".
2023-01-05 13:25:55 +01:00
rune-scape e79be6ce07 Unify String and StringName 2022-12-05 21:46:47 -05:00
Fabio Alessandrelli fdc4e73a2c [MP] RPC visibility.
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-20 14:11:43 +01:00
Fabio Alessandrelli f38e116026 [MP] Initial replication profiler.
Part of the current network profiler stack.
Tracks synchronizers, incoming/outgoing state sizes, and their
bandwidth usage.
2022-11-19 12:48:16 +01:00
Fabio Alessandrelli 92ed27d8f6 [MP] Improve network profiler.
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-17 03:14:21 +01:00
Fabio Alessandrelli 7536d15fe3 [MP] Let MultiplayerAPI handle packet relaying and peer signaling.
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-27 18:08:58 +02:00
Fabio Alessandrelli ca7d572908 [Net] Modularize multiplayer, expose MultiplayerAPI to extensions.
- 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.
2022-07-26 09:31:12 +02:00