Commit graph

65 commits

Author SHA1 Message Date
Yuri Sizov
391eccca76 Validate code tags in documentation for potential params
Adds a check to make_rst to look for matches
between the text inside of the [code][/code] tag
and known param identifiers.
Fixes most of what was revealed.
2023-04-26 21:36:04 +02:00
Yuri Sizov
49d7041d34 Decouple EditorInterface from EditorPlugin
- Simplify some includes in the process.
- Also exposes EditorInterface.movie_maker_enabled as a property.
2023-04-17 21:59:09 +02:00
Yuri Sizov
4154039832 Improve includes of EditorNode (and everything else)
Also start organizing editor-specific GUI components
into a dedicated folder, `editor/gui`.
Also move `editor_file_server` next to the rest of debugger classes.
2023-04-07 18:59:49 +02:00
Yuri Sizov
9b500ab53c Fix premature theme item access in editor tools 2023-04-03 18:01:11 +02:00
Mai Lavelle
74edbdd4bc Fixups to list handling in SceneReplicationConfig
Wrong paths were being inserted leading to duplicates / missed properties.
2023-03-07 09:41:42 -05:00
Rémi Verschelde
1c1524a651
Bump version to 4.1-dev
Can't stop, won't stop, they said, huh?
2023-03-01 01:44:37 +01:00
Rémi Verschelde
491ded1898
Minor typo and docs URL fixes 2023-02-28 13:38:01 +01:00
Fabio Alessandrelli
72f5bbde82 [MP] Fix replication config not updating sync/spawn props from code. 2023-02-23 10:03:19 +01:00
Fabio Alessandrelli
522bddf63d [MP] Add a "synchronized" signal to MultiplayerSynchronized.
Emitted upon receiving a valid sync packet after setting the variables
state.
2023-02-20 14:46:39 +01:00
baptr
2eadbe7b78 Fix multiplayer replication crash in on_sync_receive.
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-14 02:46:32 -08:00
Fabio Alessandrelli
a77820ade0 [MP] Fix MultiplayerSpawner not connecting to child_entered_tree.
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-12 15:32:09 +01:00
Haoyu Qiu
a40ccc2d7e Improve some editor strings for localization 2023-02-09 19:32:02 +08:00
Rémi Verschelde
5b1df48c6c
Convert en_GB spelling to en_US with codespell 2023-01-23 11:02:20 +01:00
Rémi Verschelde
bcaf048f33
Merge pull request #71379 from KoBeWi/destruction_of_compatibility_function
Remove set_drag_forwarding_compat()
2023-01-18 17:40:13 +01:00
Fabio Alessandrelli
ad3a4214c5 [MP] Fix nested spawning during "ready".
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-17 04:22:07 +01:00
kobewi
b58111588a Add EditorUndoRedoManager singleton 2023-01-16 01:11:52 +01:00
kobewi
59ea36b87c Remove set_drag_forwarding_compat() 2023-01-14 15:16:51 +01:00
Rémi Verschelde
54688a7535
Merge pull request #71127 from reduz/drag-forward-to-callables
Change set_drag_forwarding() to use callables.
2023-01-11 01:14:58 +01:00
Juan Linietsky
e6a4debede Change set_drag_forwarding() to use callables.
* 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-10 14:09:24 +01:00
Rémi Verschelde
4d4fcd0a6f
Merge pull request #70721 from Faless/mp/4.x_fix_relay_option
[MP] Fix server_relay being unsettable.
2023-01-09 23:09:53 +01:00
Fabio Alessandrelli
566c48f193 [MP] Convert _spawn_custom to a Callable property.
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-09 21:04:40 +01: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
Fabio Alessandrelli
d123b01e86 [MP] Fix server_relay being unsettable.
Clarify nuance in the docs.
2022-12-29 23:15:26 +01:00
Rémi Verschelde
907298d673
Merge pull request #68747 from rune-scape/rune-stringname-unification
GDScript: Unify StringName and String
2022-12-09 18:06:48 +01:00
Haoyu Qiu
80ccd46dcd Use capitalized ID in the doc 2022-12-08 09:40:49 +08:00
rune-scape
e79be6ce07 Unify String and StringName 2022-12-05 21:46:47 -05:00
Rémi Verschelde
9dc2739c1f
Merge pull request #68689 from Faless/mp/4.x_offline_is_server
[MP] New default multiplayer_peer acting as server.
2022-11-20 15:37:26 +01:00
Fabio Alessandrelli
b19c1a2e4f [MP] New default multiplayer_peer acting as server.
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 14:17:20 +01: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
Hugo Locurcio
efe3220b2e
Fix periods in editor strings and messages
- 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 19:36:36 +01:00
Fabio Alessandrelli
67265d14f7 [MP] Move engine and editor profilers to a plugin.
Also refactor the editor plugin out of the ReplicationEditor.
2022-11-14 15:09:00 +01:00
trollodel
ba9e619b51 Use forward-declarations in EditorPlugin where possible 2022-11-11 20:25:51 +01:00
Rémi Verschelde
f7c611ab71
Style: Misc docs and comment style and language fixes
- 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-02 19:01:18 +01:00
Rémi Verschelde
eefba5bc33
Merge pull request #65062 from KoBeWi/RedoUndo
Unify usage of undo_redo in editor
2022-11-02 18:54:05 +01:00
kobewi
15831e381b Unify usage of undo_redo in editor 2022-11-02 17:51:58 +01:00
Fabio Alessandrelli
33dda2e68a [MP] Remove connection state signals from MultiplayerPeer.
Now handled directly by the MultiplayerAPI implementation.
2022-11-02 15:17:23 +01:00
Fabio Alessandrelli
9773803e4e [MP] Add optional authentication to SceneMultiplayer.
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-11-02 15:17:23 +01:00
Rémi Verschelde
420eb1aa34
Merge pull request #67445 from Zylann/rename_queue_delete
Rename queue_delete => queue_free
2022-10-31 10:51:18 +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
Marc Gilleron
7543a5e014 Rename queue_delete => queue_free
# Conflicts:
#	editor/plugins/tiles/tiles_editor_plugin.cpp
2022-10-24 22:07:02 +01:00
Wei Guo
95113a7cd5 Fix MultiplayerSynchronizer::update_outbound_sync_time when replication_interval is not 0 2022-10-23 14:01:51 +08:00
Wei Guo
972242d664 Fix MultiplayerSynchronizer peer visibility 2022-10-16 23:02:31 +08:00
bruvzg
0103af1ddd
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4. 2022-10-07 11:32:33 +03:00
Fabio Alessandrelli
32a62af648 [MP] Allow multiple synchronizers per node.
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-10-03 14:45:00 +02:00
Rémi Verschelde
539d21318f Merge pull request #65970 from GuilhermeGSousa/synchronizer-auth-change
Add warning for synchronizer authority mismatch
2022-09-30 17:44:19 +02:00
Rémi Verschelde
166df0896c Fix typos with codespell
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-30 14:23:36 +02:00
Guilherme Sousa
a6c201fa76 Add Error for synchronizer authority mismatch 2022-09-30 13:11:56 +02:00
Rémi Verschelde
39facb35a0 SCons: Unify tools/target build type configuration
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-26 16:31:46 +02:00