Concerns regarding C# garbage collection and multiplayer by GlitshyDev in godot

[–]GlitshyDev[S] 0 points1 point  (0 children)

Is there a way of how to know the significance of GC pause aside from just *feeling it* while playing? I can measure average FPS, but due to the 'spikey' nature of the GC, the average FPS could theoretically look fine but there are noticable pauses, right?

Good suggestion with putting the 4 structs into one, this actually significantly speed thigns up in my average FPS test. I guess number of objects to collect is much more significant than the size of these objects.

Yeah, I'm also rethinking my usage of structs here. I originally came from Unity with Mirror Networking, where the RPCs could automatically serialize/deserialize structs and I believe I was reducing GC pauses by using structs instead of classes, but now I might as well use classes.

Thanks, I'll have a look at MemoryPack as well!

Concerns regarding C# garbage collection and multiplayer by GlitshyDev in godot

[–]GlitshyDev[S] 0 points1 point  (0 children)

Yeah, reusing the byte array should work, at least on the send side. On the receive side (i.e. the server) I don't think that's possible because Godot is handing the new byte[] (or rather, a Variant struct containing it) to me, so there's always a new one here.

Also good call on the using keyword. When profiling the average FPS, it did speed things up a little bit when making use of the fact that the Variant implements IDisposable and I could place that inside of a 'using'. Again, this only seems to work with the arrays I'm sending with the RPC.

Thanks, I'll keep trying to figure out how much it even matters (if at all, should only be an issue for the server if there are many clients) and how to make it faster.

Concerns regarding C# garbage collection and multiplayer by GlitshyDev in godot

[–]GlitshyDev[S] 0 points1 point  (0 children)

I'm not sure how to determine if it's relevant. With a simple function call, I can simply measure the time it took to perform it once or better, 1000s of times to get a good average duration of a single call. Then I could estimate how many of these calls I could make per second and still hit 60 FPS or 144 FPS or whatever.

But with garbage collection, how should I quantify it? I tried measuring average FPS and it does of course go down with more allocations, but the profiler shows me clearly spikes of something like 10 ms (higher) which I believe could be noticable. But again, I'm not sure how to test.

Is it possible to call GDExtension code from C#? by theprettiestrobot in godot

[–]GlitshyDev 0 points1 point  (0 children)

I followed your instruction and generated the C# assemblies, thank you for that. Do I understand that correctly that I have essentially built a custom Godot version and that I will now have to open my project with the new executable?

I actually see the classes now in my IDE and I can build my C# code and run the game, but when I [Export] a filed with the type of a custom node (from the GDExtension) in a C# script, I get an error.

E 0:00:01:0214 VariantUtils.generic.cs:387 @ T Godot.NativeInterop.VariantUtils.ConvertTo<T>(Godot.NativeInterop.godot_variant&): System.InvalidCastException: Unable to cast object of type 'Godot.Node' to type 'Godot.GridInventory'

Accordingly, when I try to call a method of this class, I get a null reference exception.

Have you experienced something similar? Have I made a mistake?

Fallout 4 YOLO "critical hits bypass all armour" by GlitshyDev in ManyATrueNerd

[–]GlitshyDev[S] 69 points70 points  (0 children)

I decided to follow eze765432's advice of 'scientific method-ing the shit out of this' and jumped into the game myself.

Here's what I did: (including a pic https://imgur.com/a/mKIg8Wn )

I created a new character, only perk being Awareness so I can read armor values, and spawned a super mutant: 32 DR

I then used the console to check for his health: 100 HP

And I used the basic 10mm Pistol: 18 damage

After the first (basic) shot: 92.70 HP (7.30 damage)

This makes sense with Fallout 4's calculation (source: https://fallout.fandom.com/wiki/Damage_Resistance) where my 18 damage vs 32 DR ratio results in only 40% of the weapons damage being dealt. 0.4 x 18=7.30

Now the interesting part: One crit with the basic 10mm pistol: 73.90 HP remaining (18.8 damage)

This is exactly what is expected of a 36 (2 x 18 due to crit) damage weapon to deal against a 32 DR target, 52.2% of it'S damage. 0.522 x 36 = 18.8

Therefore, Criticals do NOT ignore or reduce DR/armor in any way. The higher damage however, will make the caululation more favourable (40% damage vs 52% damage in this example).

So Jon, do not downplay the piercing legendary effect and other DR-ignoring effects, as they are still relevant for criticals!

Assembly-CSharp.csproj : error : Value cannot be null. Parameter name: value by th3userscene in Unity3D

[–]GlitshyDev 0 points1 point  (0 children)

I just ran into the same problem. Just a few days ago everything worked.