Commit Graph

105 Commits

Author SHA1 Message Date
A Thousand Ships 684752e75b
Replace error checks against `size` with `is_empty` 2024-02-09 12:50:15 +01:00
RedMser d3852deaa4 Update Node::get_configuration_warnings signature 2024-02-08 23:05:20 +01:00
Rémi Verschelde 8b0c5f2fca
Merge pull request #87186 from Faless/mp/fix_remote_sync_cleanup
[MP] Fix remote net ID cleanup
2024-02-03 23:18:35 +01:00
Rémi Verschelde f4fb4799ae
Merge pull request #87185 from Faless/mp/fix_reset
[MP] Fix spawned nodes not working after reset
2024-02-03 23:18:08 +01:00
Fabio Alessandrelli 853df2895a [MP] Handle cleanup of "scene cache" nodes
Make sure we delete the relevant ObjectID from the cache when the nodes
are removed from tree.
2024-01-18 21:18:54 +01:00
Yuri Sizov 95b27fe8c7 Reorganize code related to editor theming
This change introduces a new EditorThemeManager class
to abstract theme generatio and its subroutines.

Logic related to EditorTheme, EditorColorMap, and editor
icons has been extracted into their respective files with
includes cleaned up.

All related files have been moved to a separate folder to
better scope them in the project. This includes relevant
generated files as well.
2024-01-16 11:57:45 +01:00
Fabio Alessandrelli 89dacb88ec [MP] Fix remote net ID cleanup
Synchronizers for spawned nodes were not correctly keeping track of the
net ID assigned by the remote, preventing the replication from
performing the proper cleanup.

This resulted in errors being thrown when sync messages were received
after despawn (which is possible due to their unreliable nature).
2024-01-14 21:04:03 +01:00
Fabio Alessandrelli cb08f2a968 [MP] Fix spawned nodes not working after reset
Ensures that spawnable nodes (i.e. spawned nodes over which the local
instance has authority) always have a network ID, since they may lose it
after the multiplayer is reset (e.g. when changing the multiplayer peer).
2024-01-14 20:54:41 +01:00
Muller-Castro 96a95cb974 Add const lvalue ref to container parameters 2024-01-05 14:49:57 -03:00
Fabio Alessandrelli 4826c14d20 [MP] Fix complete_auth notifying the wrong peer
The SceneMultiplayer complete_auth method was not configuring the
multiplayer peer correctly, causing it to potentially send the
notification to the wrong peer, on the wrong channel, and/or with an
incorrect transfer mode.
2023-12-17 12:27:24 +01:00
Rémi Verschelde 325cc0178e
Merge pull request #83279 from Faless/mp/fix_delta_indexed
[MP] Fix "on change" indexed properties
2023-10-13 22:20:21 +02:00
Fabio Alessandrelli 9d44954a3f [MP] Fix "on change" indexed properties
Watchers were still using Object::get instead of Object::get_indexed.
2023-10-13 16:53:24 +02:00
Fabio Alessandrelli f79b90a6c0 [MP] Fix synchronizer init and reset
Fix set_multiplayer_authority not resetting the synchronizer.

Fix the reset function not clearing the watchers state.

Skip wrap around check for the first sync packet after reset.
2023-10-13 14:03:40 +02:00
Fabio Alessandrelli 5df7577a05 [MP] Optimize internal SceneReplicationConfig access
Use direct pointer addressing to avoid unnecessary refs/unrefs
2023-10-10 14:42:54 +02:00
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
Yuri Sizov 4bd569be95 Replace flat buttons with flat-styled buttons with a visible pressed state 2023-09-19 22:36:29 +02:00
Yuri Sizov 8ecc0c4f47 Fix accessing editor theme items throughout the UI
This also exposes `EditorInterface::get_editor_theme`.
2023-09-15 14:51:01 +02:00
Yuri Sizov d8ff69d53c Extract ScriptInstance to simplify includes
This allows to include script_instance.h directly in the
generated gdvirtual.gen.inc, and remove excessive includes
from the codebase.

This should also allow Resource to use GDVIRTUAL macros,
which wasn't possible previously due to a circular dependency.
2023-09-06 22:54:38 +02:00
kobewi 6de34fde27 Add EditorStringNames singleton 2023-09-03 19:58:18 +02:00
Fabio Alessandrelli c1c6911b5c [MP] Improve ReplicationEditor UX
Use an option button for the replication mode making sync and watch (now
"Always" and "On Change") mutually exclusive.
2023-08-30 15:37:42 +02:00
Fabio Alessandrelli 711e96edc4 [MP] Make replication mode an enum + optimizations
REPLICATION_MODE_ALWAYS (sync) and REPLICATION_MODE_ON_CHANGE (watch)
are now mutually exclusive.

Prevent invalid NodePath from being added to the config.

Optimize the replication config loading by composing the lists on
demand.
2023-08-30 15:00:39 +02:00
the-sink 8f80ebc035 Allow enter key to add properties to replication editor list 2023-08-29 19:29:01 -07:00
Fabio Alessandrelli 3860f2e366 [MP] Fix watch properties not being correctly removed 2023-08-27 10:53:04 +02:00
Fabio Alessandrelli b6dc799e64 [MP] Use get/set indexed in MultiplayerSynchronizer
Allows synchronizing (sub-)resource properties, transform components,
etc. by using subnames.

As an example, `.:transform.x` will only synchronize the `x` component
of the root transform instead of the whole transform.

This can also be used to synchronize a resource own properties, as long
as they are synchronizable (i.e. the property itself is not an Object,
RID, or Callable).
2023-07-14 20:50:55 +02:00
Rémi Verschelde 81064cc239
Doctool: Remove version attribute from XML header
We don't use that info for anything, and it generates unnecessary diffs
every time we bump the minor version (and CI failures if we forget to
sync some files from opt-in modules (mono, text_server_fb).
2023-07-06 10:08:21 +02:00
Rémi Verschelde 346f1ab86b
Bump version to 4.2-dev
Keep on waitin'
2023-07-05 22:07:03 +02:00
Fabio Alessandrelli 91004df875 [MP] Fix delta variables index decoding. 2023-06-26 12:33:30 +02:00
Ninni Pipping 982ca52e4c Fix `MultiplayerSpawner` documentation 2023-06-23 10:26:33 +02:00
Fabio Alessandrelli 2d19cec174
Merge pull request #78409 from AThousandShips/spawn_func_fix
Do not serialize `MultiplayerSpawner.spawn_function`
2023-06-23 10:13:11 +02:00
Ninni Pipping 9159208ed1 Ensure `RID`, `Callable`, and `Signal` are stored as strings
Prevents parser errors in `.tscn` and `.tres` files where the assignment
would otherwise be empty.
2023-06-22 17:01:08 +02:00
L4Vo5 01f887ee4f Clarify when things with _IDLE and _PHYSICS enums will run 2023-06-20 13:25:26 -03:00
Ninni Pipping 6f6999221d Do not serialize `MultiplayerSpawner.spawn_function` 2023-06-18 17:58:47 +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
Fabio Alessandrelli 45456f89a2 [MP] Fix crash when sending multiple delta variants. 2023-06-11 13:43:49 +02:00
RedworkDE 42ca35cfd7 Fix more issues with code tags in class reference 2023-05-29 15:46:34 +02:00
Ninni Pipping f69fba0d65 Add restrictions to MultiplayerSynchronizer editor and documentation 2023-05-24 09:37:11 +02:00
Fabio Alessandrelli f1e0d50841 [MP] Implement "watched" properties.
Checked at "delta_interval" (default = every frame), synchronized
(reliably) if changes are detected.
2023-05-24 05:21:41 +02:00
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