willnationsdev
willnationsdev.bsky.social
willnationsdev
@willnationsdev.bsky.social
Christian;Gamedev;Godot Engine;Full-stack web developer by day working at Baylor University. I foster/rescue dogs w/ my wife. Regularly have 10+ animals. He/Him
gdnative*
December 7, 2024 at 5:22 PM
I recently started a C# project and often find myself peeking at the definition of various Godot APIs to check if they are using genitive calls or if they are locally implemented. Lots of math and string things are local, but more complex objects go to Godot usually.
December 7, 2024 at 5:21 PM
Note however that if a lang's local impl of an API is absent, then it will induce expensive Godot calls. That's why the C# docs recommend converting Array to a local C# type (like List) if doing lots of mutations. Copy data into Array at end, all at once. Otherwise, each .Add is a Godot call.
December 7, 2024 at 5:20 PM
And there are cases where passing through that pipeline can be optimized away (depending on the language) when those mutations or accessors can be handled without needing to contact Godot (as in the case of C#. MAYBE some bits of GDScript too, like for the Z?).
December 7, 2024 at 5:08 PM
Yes, although, the "set z" portion happens without needing to pass through the Godot script bindings since the Variant wrapper only uses granularity up to Vector3. If you were to track this by the number of times you had to pass through the pipeline of the script bindings, it would be 3, not 4
December 7, 2024 at 5:06 PM
As HP said, it's syntactic sugar. As far as the core Godot API goes, all properties on objects are abstractions around a setter and a getter. ANY time you see something do more granular work, it should be syntactic sugar. Though, C# does bypass this via local impl of certain math APIs like Vector3.
December 7, 2024 at 4:51 PM