summaryrefslogtreecommitdiff
path: root/core/io
AgeCommit message (Collapse)Author
2021-08-09[Net] Basic extensible MultiplayerAPI spawn/despawn.Fabio Alessandrelli
`PackedScene`s can be configured to be spawnable via a new `MultiplayerAPI.spawnable_config` method. They can be configured either to be spawned automatically when coming from the server or to always require verification. Another method, `MultiplayerAPI.send_spawn` lets you request a spawn on the remote peers. When a peer receive a spawn request: - If it comes from the server and the scene is configured as `SPAWN_MODE_SERVER`: - Spawn the scene (instantiate it, add it to tree). - Emit signal `network_spawn`. - Else: - Emit signal `network_spawn_request`. In a similar way, `despawn`s are handled automatically in `SPAWN_MODE_SERVER`. In `SPAWN_MODE_SERVER`, when a new client connects it will also receive, from the server all the spawned (and not yet despawned) instances.
2021-08-06OS: Fix used resource debug printsRémi Verschelde
These methods were broken by 22419082d9bedbc9dc060ea5784bb0871f8710a3 5 years ago and nobody complained, so maybe they're not so useful... But at least this should restore them to a working state.
2021-08-06Merge pull request #51234 from akien-mga/tests-file-get_csv_lineRémi Verschelde
Tests: Improve coverage for `File::get_csv_line()`
2021-08-04Tests: Improve coverage for `File::get_csv_line()`Rémi Verschelde
Adds a few more complex edge cases which are supported. Also adds some documentation, simplifies the code a bit and forbids using double quotes as a delimiter.
2021-08-04Merge pull request #51005 from Faless/mp/4.x_channelsRémi Verschelde
[Net] Implement RPC channels in MultiplayerAPI.
2021-08-03Merge pull request #51199 from Faless/net/4.x_ip_lockRémi Verschelde
2021-08-02Merge pull request #51042 from nikitalita/fix_binary_res_load_saveK. S. Ernest (iFire) Lee
Fix binary resource loading and saving
2021-08-03[Net] Fix IP address resolution incorrectly locking the main thread.Fabio Alessandrelli
This seems to be a pretty old bug, older then originally reported (at least under certain circumstances). The IP singleton uses a resolve queue so developers can queue hostnames for resolution in a separate while keeping the main thread unlocked (address-resolution OS functions are blocking, and could block for a long time in case of network disruption). In most places though, the address resolution function was called with the mutex locked, causing other functions (querying status, queueing another hostname, ecc) to block until that resolution ended. This commit ensures that all calls to OS address resolution are done with the mutex unlocked.
2021-08-02[Marshalls] Fix Float64Array and Int64Array serialization.Fabio Alessandrelli
One was incorrectly reading the size (potentially causing out-of-buffer read), the other also potentially causing out-of-buffer write during encoding.
2021-07-30[Net] Implement RPC channels in MultiplayerAPI.Fabio Alessandrelli
2021-07-30[Net] Fix Marshalls infinite recursion crash.Fabio Alessandrelli
Variants like dictionaries and arrays can have cyclic references, which caused `encode_variant` to run an infinite recursion. Instead of keeping a stack and looking for cyclic references which would make serialization slower, this commit adds a `MAX_RECURSION_DEPTH` constant to Variant, and have `encode_variant` keep track of the current recursion depth, bailing when it's too high since this likely means a cyclic reference has been encountered.
2021-07-29skip uid field length in binary resource if not usednikitalita
2021-07-29Use constant for reserved field countnikitalita
2021-07-29Fix binary resource loading and savingnikitalita
2021-07-29[Net] Add generate_unique_id to MultiplayerPeer.Fabio Alessandrelli
Used by ENetMultiplayerPeer and WebSocketServer to generate network IDs, and exposed to the user for p2p networks (e.g. WebRTCMultiplayerPeer) and custom MultiplayerPeer implementations.
2021-07-29[Net] Fix RPC ID encoding/decoding for Node methods.Fabio Alessandrelli
2021-07-25Fix various typosluz paz
Follow-up typos found via `codespell -q 3 -S ./thirdparty,*.po,./DONORS.md -L ackward,ang,ans,ba,beng,cas,childs,childrens,dof,doubleclick,fave,findn,hist,inout,leapyear,lod,nd,numer,ois,ony,paket,seeked,sinc,switchs,te,uint`
2021-07-25Merge pull request #50809 from akien-mga/iterators-const-referencesRémi Verschelde
2021-07-25Merge pull request #50250 from luzpaz/typosRémi Verschelde
Fix various typos
2021-07-25Use const references where possible for List range iteratorsRémi Verschelde
2021-07-25ResourceUID: Fix `remove_id` bindingRémi Verschelde
Fixes #50833.
2021-07-25Fix various typos with codespellluz paz
Found via `codespell -q 3 -S ./thirdparty,*.po,./DONORS.md -L ackward,ang,ans,ba,beng,cas,childs,childrens,dof,doubleclick,fave,findn,hist,inout,leapyear,lod,nd,numer,ois,ony,paket,seeked,sinc,switchs,te,uint`
2021-07-24Fix check for the first key in JSON stringify from Dictionary codeAaron Franke
2021-07-24Merge pull request #50786 from reduz/implement-resource-uidsRémi Verschelde
Implement Resource UIDs
2021-07-24Implement Resource UIDsreduz
* Most resource types now have unique identifiers. * Applies to text, binary and imported resources. * File formats reference both by text and UID (when available). UID always has priority. * Resource UIDs are 64 bits for better compatibility with the engine. * Can be represented and used textually, example `uuid://dapwmgsmnl28u`. * A special binary cache file is used and exported, containing the mappings. Example of how it looks: ```GDScript [gd_scene load_steps=2 format=3 uid="uid://dw86wq31afig2"] [ext_resource type="PackedScene" uid="uid://bt36ojelx8q6c" path="res://subscene.scn" id="1_t56hs"] ``` GDScript, shaders and other special resource files can't currently provide UIDs, but this should be doable with special keywords on the files. This will be reserved for future PRs.
2021-07-23Use C++ iterators for Lists in many situationsAaron Franke
2021-07-23Expose an ImportOrder enum in ResourceImporterHugo Locurcio
This avoids using magic numbers in code.
2021-07-22Implement textual ext/subresource IDs.reduz
* Friendlier with version control. * Generates pseudo unique IDs, to minimize conflicts when merging, but still user readable (so, not UUID). * Eventually will also allow to have more precisely named sub-resources in imported files. * This will allow better reloading on changes (including resources already loaded) as well as better keeping track of changes on the DCC. * Keeps backward compatibility with the old formats. * Binary and text format version incremented to mark breakage in forward compatibility.
2021-07-20[Net] Single `rpc` annotation. "sync" no longer part of mode.Fabio Alessandrelli
- Move the "sync" property for RPCs to RPCConfig. - Unify GDScript annotations into a single one: - `@rpc(master)` # default - `@rpc(puppet)` - `@rpc(any)` # former `@remote` - Implement three additional `@rpc` options: - The second parameter is the "sync" option (which also calls the function locally when RPCing). One of "sync", "nosync". - The third parameter is the transfer mode (reliable, unreliable, ordered). - The third parameter is the channel (unused for now).
2021-07-18Optimize StringName usagereduz
* Added a new macro SNAME() that constructs and caches a local stringname. * Subsequent usages use the cached version. * Since these use a global static variable, a second refcounter of static usages need to be kept for cleanup time. * Replaced all theme usages by this new macro. * Replace all signal emission usages by this new macro. * Replace all call_deferred usages by this new macro. This is part of ongoing work to optimize GUI and the editor.
2021-07-16Merge pull request #46554 from likeich/is_server_quiet_failureFabio Alessandrelli
MultiplayerAPI is_network_server Fails Silently
2021-07-13Fix decompression with FastLZ when buffer size is less than 16 bytesHaoyu Qiu
2021-07-12[Net] Rename NetworkedMultiplayerPeer to MultiplayerPeer.Fabio Alessandrelli
2021-07-11[Net] Fix crash when receiving RPC on node without a script.Fabio Alessandrelli
2021-07-11Merge pull request #50362 from timothyqiu/http-eofRémi Verschelde
Fix unicode invalid skip error in AssetLib
2021-07-11Fix unicode invalid skip error in AssetLibHaoyu Qiu
2021-07-11Handle Z_BUF_ERROR in decompress_dynamicHaoyu Qiu
2021-06-30Network port comparison is always falseK. S. Ernest (iFire) Lee
error: comparison is always false due to limited range of data type [-Werror=type-limits] ERR_FAIL_COND_V_MSG(p_port < 0 || p_port > 65535, ERR_INVALID_PARAMETER, "The local port number must be between 0 and 65535 (inclusive).");
2021-06-28Validate image formats, check if resize_to_po2 failedPaweł Fertyk
2021-06-27Fix Image.adjust_bcs crash when image format is invalidHaoyu Qiu
2021-06-23[Net] Makes HTTPClient a custom instance class.Fabio Alessandrelli
2021-06-23[Net] Unify HTTPClient request and request_raw.Fabio Alessandrelli
2021-06-19Rename `instance()`->`instantiate()` when it's a verbLightning_A
2021-06-20Merge pull request #48080 from aaronfranke/real-serializationRémi Verschelde
Binary serialization for reals
2021-06-19Consolidate JSON, JSONParseResults and JSONParser into JSONMarcel Admiraal
Renames JSON.parse_string() to parse() Renames JSON.decode_data() to stringify()
2021-06-17Binary serialization for realsAaron Franke
Added new "encode_real" methods for handling real_t, and used them for vector types. Types are encoded based on compilation setting. But for decoding, always check how it was encoded. This way, serialized data is cross-compatible with Godot compiled with singles and Godot compiled with doubles. At least, in theory.
2021-06-17Add PROPERTY_USAGE_NONE and use itAaron Franke
2021-06-14Fix json dump and print of circular structureHaoyu Qiu
2021-06-12Merge pull request #48746 from KoBeWi/bane_of_all_virtual_compatibilityRémi Verschelde
Consistently prefix bound virtual methods with _
2021-06-12Merge pull request #49123 from aaronfranke/it-is-timeRémi Verschelde
Add a Time singleton