summaryrefslogtreecommitdiffstats
path: root/core/io/multiplayer_api.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Core: Drop custom `copymem`/`zeromem` definesRémi Verschelde2021-04-271-1/+1
| | | | | | | | We've been using standard C library functions `memcpy`/`memset` for these since 2016 with 67f65f66391327b2967a20a89c3627e1dd6e84eb. There was still the possibility for third-party platform ports to override the definitions with a custom header, but this doesn't seem useful anymore.
* Fixes small typos and grammar correctionAnshul7sp12021-03-121-4/+4
|
* Update copyright statements to 2021Rémi Verschelde2021-01-011-2/+2
| | | | | | | | | | | | | | Happy new year to the wonderful Godot community! 2020 has been a tough year for most of us personally, but a good year for Godot development nonetheless with a huge amount of work done towards Godot 4.0 and great improvements backported to the long-lived 3.2 branch. We've had close to 400 contributors to engine code this year, authoring near 7,000 commit! (And that's only for the `master` branch and for the engine code, there's a lot more when counting docs, demos and other first-party repos.) Here's to a great year 2021 for all Godot users 🎆
* add root_node as property of MultiplayerAPIJummit2020-07-051-0/+6
|
* Style: Enforce braces around if blocks and loopsRémi Verschelde2020-05-141-19/+38
| | | | | Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
* Style: Enforce separation line between function definitionsRémi Verschelde2020-05-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027.
* Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde2020-05-141-44/+0
| | | | | | | | | | | | | | Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
* Port member initialization from constructor to declaration (C++11)Rémi Verschelde2020-05-141-4/+2
| | | | | | | | | | Using `clang-tidy`'s `modernize-use-default-member-init` check and manual review of the changes, and some extra manual changes that `clang-tidy` failed to do. Also went manually through all of `core` to find occurrences that `clang-tidy` couldn't handle, especially all initializations done in a constructor without using initializer lists.
* Style: clang-format: Disable AllowShortIfStatementsOnASingleLineRémi Verschelde2020-05-101-3/+5
| | | | | | | Part of #33027, also discussed in #29848. Enforcing the use of brackets even on single line statements would be preferred, but `clang-format` doesn't have this functionality yet.
* Replace NULL with nullptrlupoDharkael2020-04-021-14/+14
|
* Merge pull request #36599 from AndreaCatania/gen_rpc_data_exportRémi Verschelde2020-03-131-1/+2
|\ | | | | Generates the rpc and rset info for exported GDScript.
| * Generates the rpc and rset info for exported GDScript.Andrea Catania2020-02-281-1/+2
| | | | | | | | | | | | Improved the send rpc log message when fail. This work has been kindly sponsored by IMVU.
* | Refactor ScriptDebugger.Fabio Alessandrelli2020-03-081-122/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | EngineDebugger is the new interface to access the debugger. It tries to be as agnostic as possible on the data that various subsystems can expose. It allows 2 types of interactions: - Profilers: A subsystem can register a profiler, assigning it a unique name. That name can be used to activate the profiler or add data to it. The registered profiler can be composed of up to 3 functions: - Toggle: called when the profiler is activated/deactivated. - Add: called whenever data is added to the debugger (via `EngineDebugger::profiler_add_frame_data`) - Tick: called every frame (during idle), receives frame times. - Captures: (Only relevant in remote debugger for now) A subsystem can register a capture, assigning it a unique name. When receiving a message, the remote debugger will check if it starts with `[prefix]:` and call the associated capture with name `prefix`. Port MultiplayerAPI, Servers, Scripts, Visual, Performance to the new profiler system. Port SceneDebugger and RemoteDebugger to the new capture system. The LocalDebugger also uses the new profiler system for scripts profiling.
* | Signals: Port connect calls to use callable_mpRémi Verschelde2020-02-281-15/+10
|/ | | | | | | | | Remove now unnecessary bindings of signal callbacks in the public API. There might be some false positives that need rebinding if they were meant to be public. No regular expressions were harmed in the making of this commit. (Nah, just kidding.)
* Optimized rpc packet size when only the `PackedByteArray` is sent.Andrea Catania2020-02-271-28/+83
| | | | This work has been kindly sponsored by IMVU.
* Replace FALLTHROUGH macro by C++17 [[fallthrough]]Rémi Verschelde2020-02-231-1/+1
| | | | | | | | | | This attribute is now part of the standard we target so we no longer need compiler-specific hacks. Also enables -Wimplicit-fallthrough for Clang now that we can properly support it. It's already on by default for GCC's -Wextra. Fixes new warnings raised by Clang's -Wimplicit-fallthrough.
* Reworked signal connection system, added support for Callable and Signal ↵Juan Linietsky2020-02-201-17/+17
| | | | objects and made them default.
* PoolVector is gone, replaced by VectorJuan Linietsky2020-02-181-5/+5
| | | | | Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are sugar for `Vector<Type>`.
* Merge pull request #36144 from akien-mga/remove-deprecated-allow-decodingRémi Verschelde2020-02-131-2/+2
|\ | | | | Remove deprecated PacketPeer allow_object_decoding
| * Remove deprecated PacketPeer allow_object_decodingRémi Verschelde2020-02-131-2/+2
| | | | | | | | | | | | | | | | It was added for 3.2 in #27485 to preserve backwards compatibility, but we can now remove it. It is still needed in MultiplayerAPI as it's the only way to control it for the internal put_var calls.
* | Remove deprecated sync and slave networking keywordsRémi Verschelde2020-02-131-2/+0
|/ | | | | | Those keywords were deprecated for 3.1 in #22087. Also fix token name for `TK_REMOTE`, should be "remote" like the keyword.
* ObjectID converted to a structure, fixes many bugs where used incorrectly as ↵Juan Linietsky2020-02-121-1/+0
| | | | 32 bits.
* Optmized data sent during RPC and RSet calls.Andrea Catania2020-02-121-93/+403
| | | | | | | | | | - Now is sent the method ID rather the full function name. - The passed IDs (Node and Method) are compressed so to use less possible space. - The variant (INT and BOOL) is now encoded and compressed so to use much less data. - Optimized RPCMode retrieval for GDScript functions. - Added checksum to assert the methods are the same across peers. This work has been kindly sponsored by IMVU.
* Remove duplicate ERR_PRINT macro.Marcel Admiraal2020-02-051-8/+8
|
* Fix MultiplayerAPI crash when peer impl misbehave.Fabio Alessandrelli2020-01-211-0/+1
| | | | | Also fix WebSocketMultiplayer::get_available_packet_count() return value when peer is not configured to use the multiplayer API.
* MultiplayerAPI: Fix disconnect errors when passing invalid peerRémi Verschelde2020-01-031-2/+3
| | | | Fixes #34634.
* Update copyright statements to 2020Rémi Verschelde2020-01-011-2/+2
| | | | | | | | | | | Happy new year to the wonderful Godot community! We're starting a new decade with a well-established, non-profit, free and open source game engine, and tons of further improvements in the pipeline from hundreds of contributors. Godot will keep getting better, and we're looking forward to all the games that the community will keep developing and releasing with it.
* MultiplayerAPI cleanup cache when peer disconnectsFabio Alessandrelli2019-10-251-1/+10
| | | | | We used to only cleanup path_get_cache and not path_send_cache causing issues when a peer disconnects and then reconnects with the same ID.
* Added some obvious errors explanationsqarmin2019-09-251-2/+1
|
* Add network profilerjfons2019-09-051-0/+146
|
* Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in 'core/' and 'editor/'Braden Bodily2019-08-171-109/+53
| | | | | | | | | Condensed some if and ERR statements. Added dots to end of error messages Couldn't figure out EXPLAINC. These files gave me trouble: core/error_macros.h, core/io/file_access_buffered_fa.h (where is it?), core/os/memory.cpp, drivers/png/png_driver_common.cpp, drivers/xaudio2/audio_driver_xaudio2.cpp (where is it?)
* Add default values to the editor help, docs, and generated RSTBojidar Marinov2019-06-271-0/+1
| | | | | Also, make spacing of "=" in the editor help a bit more consistent. Closes #16086
* Better handle some self-RSET/RPC in MultiplayerAPIFabio Alessandrelli2019-05-121-6/+10
| | | | | Allow calling yourself via RPC/RSET if the mode allows it. Better error messages when you are not allowed to call yourself.
* Avoid _can_call_mode resetting error message in MultiplayerAPIFabio Alessandrelli2019-05-081-4/+6
|
* Sender network id is now set to local network id for local rpc calls.Daniel Eliasinski2019-04-161-0/+13
|
* Revert "Properly explain RPC/RSET mode failure."Rémi Verschelde2019-04-051-9/+7
| | | | | This reverts commit 95ad747deaa474b30c04b01f60634f2be9a5ea18. It introduced regressions, see #27655.
* Fix -Wimplicit-fallthrough warnings from GCC 8Rémi Verschelde2019-04-051-1/+2
| | | | | | | | | | | | Adds `FALLTHROUGH` macro to specify when a fallthrough is intentional. Can be replaced by `[[fallthrough]]` if/when we switch to C++17. The warning is now enabled by default for GCC on `extra` warnings level (part of GCC's `-Wextra`). It's not enabled in Clang's `-Wextra` yet, but we could enable it manually once we switch to C++11. There's no equivalent feature in MSVC for now. Fixes #26135.
* Properly explain RPC/RSET mode failure.Fabio Alessandrelli2019-04-031-7/+9
| | | | | | | | _can_call_mode used to call is_network_master/get_network_master internally. This would reset any potential last error set via ERR_EXPLAIN, preventing it from being displayed correctly. _can_call_mode now expects the node master ID to be passed instead.
* Add object encoding param to serialization methodsFabio Alessandrelli2019-04-011-7/+22
| | | | | | | | | Network peers get_var/put_var File get_var/store_var GDScript/Mono/VisualScript bytes2var/var2bytes Add MultiplayerAPI.allow_object_decoding member which deprecates PacketPeer.allow_object_decoding. Break ABI compatibaility (API compatibility for GDNative).
* Multiplayer API now respects allow_object_decodingFabio Alessandrelli2019-04-011-6/+6
| | | | Add doc about allow_object_decoding in PacketPeer
* Don't reset MultiplayerAPI when setting same peer.Fabio Alessandrelli2019-01-151-0/+2
| | | | | | | | | | | | | | A GDScript call to: `multiplayer.network_peer.some_prop = true` seems to transalte to: ``` var temp = multiplayer.network_peer temp.some_prop = true multiplayer.network_peer = temp ``` Which caused the MultiplayerAPI to be resetted. The call to set_network_peer is now ignored if the peer that's beeing set is the same as the currently set one.
* Fix MultiplayerAPI initialization, clear.Fabio Alessandrelli2019-01-151-0/+3
| | | | | | | | | rpc_sender_id is now correctly initialized to 0 so get_rpc_sender_id() work reliably even if called before receiving any RPC. root_node is initialized to NULL (fix crashes when incorrectly using the MultiplayerAPI). clear function now resets the packet cache size to free more memory when not running.
* Update copyright statements to 2019Rémi Verschelde2019-01-011-2/+2
| | | | Happy new year to the wonderful Godot community!
* Remove redundant "== false" codeAaron Franke2018-10-061-1/+1
| | | | | | Some of this code has been re-organized. f
* Remove redundant "== true" codeAaron Franke2018-10-061-1/+1
| | | If it can be compared to a boolean, it can be evaluated as one in-place.
* Better MultiplayerAPI error logs.Fabio Alessandrelli2018-09-251-54/+98
|
* Skip RPC/RSET when MASTERSYNC and we are master.Fabio Alessandrelli2018-09-251-5/+8
|
* doc: Sync classref with current sourceRémi Verschelde2018-09-151-2/+2
|
* Clearly deprecate sync too in favor of remotesync.Fabio Alessandrelli2018-09-151-7/+3
| | | | | NOTE: This changes the RPC_MODE_* enum values. Games should be re-exported. GDNative rebuilt.
* Rename slave keyword to puppetFabio Alessandrelli2018-09-151-5/+6
| | | | | The slave keyword will still be available as deprecated in 3.1 but will be dropped from future releases.