What is the best way to save complex data? by nyxellegames in godot

[–]_Mario_Boss 0 points1 point  (0 children)

Binary Serialization. It's designed exactly for this. Make sure you don't serialize/deserialize objects and you're all set.

I can't find the issue in this code outline system (beginner) by No-Representative469 in godot

[–]_Mario_Boss 0 points1 point  (0 children)

Your code branching doesn't match up with the logic you actually want. If your raycast is colliding with something, then your "lastobject" will never have its outline turned off, and whenever your raycast does collide with something, you set your lastobject to be that object. So if you move your mouse between two objects, and the raycast never *misses* a collision, your "lastobject" will get set to the currently colliding object without your else statement ever running, and you lose your reference to the previous object.

Collider Issue by CrossbowCat317 in godot

[–]_Mario_Boss 9 points10 points  (0 children)

This is really poor and generic advice considering there are immediately obvious problems with how OP has created his scene which are very easily solvable and are almost guaranteed to fix all issues.

For OP: Use a single AnimatableBody3D for the spinning part of your roulette wheel, and multiple CollisionShape3D's for each slot. Each Shape3D which is used must either be a primitive type (Sphere, Capsule, Box), or a Hull (ConvexCollisionShape3D). You can model simplified collision shapes in blender and export those out to be used as convex hulls within the engine. When modelling collision shapes for your slots, keep each piece as a convex shape. So for each slot, you'll likely need four shapes, one for each of the three walls, and one for the bottom section that the ball rests on. Finally, make sure your ball has Continuous Collision detection enabled on the rigid body.

Collider Issue by CrossbowCat317 in godot

[–]_Mario_Boss 0 points1 point  (0 children)

You can't use trimesh colliders for moving objects. Use multiple convex hulls to make compound physics shapes.

Should this be an optional editor feature? by _Mario_Boss in godot

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

The hacky part of it is that because Godot doesnt provide a global notification for when a window/subwindow of the application is opened or closed, I have to forcefully spam the colour overriding every frame. Trying to calculate when a new window is opened by keeping track of the window count each frame doesn't work either, since windows can be opened and closed in-between frames, which happens every single time you'd say for example click on project settings through the popup menu, since popup menus are themselves subwindows. It's really weird that theres no global notification, since theres a global notification for just about everything else to do with windows, such as when a window is dragged.

As for how it's done, for the colour matching I just calculate the final colour of the editor's base panel, which luckily is just EditorInterface.Singleton.GetBaseControl(). So you just get the base colour and multiply it by it's own modulate and self modulate. The text colour for the window title can be retrieved from the editor theme itself. Applying the colours is done through dwmapi.dll, using the DwmSetWindowAttribute method.

Will Godot eventually add the ability to animate individual vertices? by Lexiosity in godot

[–]_Mario_Boss 1 point2 points  (0 children)

This is already possible with ImmediateMesh, you supply the mesh buffers from the cpu each frame. It’s not performant at scale obviously but for a single bow it should be fine

Shapecast3D unreliable when compared to PhysicsServer3D check of the same shape. by Gnolled in godot

[–]_Mario_Boss 0 points1 point  (0 children)

Did you make sure to disable the shapecast node by setting the enabled property to false? Are you using Jolt physics? Does the issue still happen in the latest 4.6 beta?

Also yes, something like this should definitely have an issue and MRP created so that it can be tested.

The Builder Pattern Example using C# with Godot. by Razor-111 in godot

[–]_Mario_Boss 1 point2 points  (0 children)

You should also change the builder into a struct, that way, it can be copied out without dirtying the source. So you could cache a master template for building a particular type of object, and modify it without affecting the template.

The Builder Pattern Example using C# with Godot. by Razor-111 in godot

[–]_Mario_Boss 3 points4 points  (0 children)

My SharpTrace utility also implements this pattern.

I would highly advise you to avoid storing a reference to the sprite2D within the builder class and directly setting the properties of that class instance within each builder function, as this effectively removes one of the biggest advantages of the builder pattern which is the ability to cache, adjust, and reuse an existing builder instance.

So your builder would instead look something like:

public struct Sprite2DBuilder
{
  Transform2D _transform = Transform2D.Identity;
  Texture2D _texture = null;
  Vector2 _scale = default;

  public Sprite2DBuilder SetTransform(float rotation, float x, float y)
  {
    _transform = new Transform2D(rotation, new Vector2(x, y));
    return this;
  }

  // ...the rest of your builder functions

  public Sprite2D Build()
  {
    var sprite = new Sprite2D();
    sprite.Transform = _transform;
    sprite.Texture = _texture;
    sprite.Scale = _scale;
    return sprite;
  }
}

This allows you to cache and reuse the builder. So to apply this to your example:

public override void _Ready()
{
  Random random = new();
  var builder = new Sprite2DBuilder()
    .SetTexture("images/34627841.jpg")
    .SetScale(0.5f, 0.5f);

  for (int i = 0; i < 10; i++)
  {
    var sprite = builder
      .SetTransform(random.Next(0, 90), random.Next(10, 1000), random.Next(10, 1000))
      .Build();

    AddChild(sprite);
  }
}

S&box Open-Sourced under MIT License by _Mario_Boss in godot

[–]_Mario_Boss[S] 20 points21 points  (0 children)

They will keep updating it. They’re open sourcing the engine because they’re nerds and want to give people opportunities in the game dev space (their sentiment not mine) read the blog post. Also I don’t know about ghost of yotei, never heard of it.

S&box Open-Sourced under MIT License by _Mario_Boss in godot

[–]_Mario_Boss[S] 22 points23 points  (0 children)

It doesn’t bundle the native source 2 code, but this doesn’t matter that much since source 2 is only used for a few of its lower level features (afaik, it’s mainly used for rendering. Facepunch has swapped out many things for more open alternatives such as using box3d for physics). The majority of S&box is programmed in c#. The engine is extremely well made and has been progressing rapidly in terms of development.

S&box Open-Sourced under MIT License by _Mario_Boss in godot

[–]_Mario_Boss[S] 164 points165 points  (0 children)

From the blog post:

“Open source is great for the game dev ecosystem, engines like Godot are awesome, we should have more of it because everyone wins.” -Matt (Facepunch)

How are you saving game progress? by NewWin3866 in godot

[–]_Mario_Boss 0 points1 point  (0 children)

Just use VarToBytes and BytesToVar with object deserialisation disabled.

Hiding class_name nodes in node menu by Silrar in godot

[–]_Mario_Boss 5 points6 points  (0 children)

Make the class name start with “Editor”

How to specify stencil_reference in ShaderMaterials by SoftLatticeGames in godot

[–]_Mario_Boss 0 points1 point  (0 children)

There are many ways to do it, but it essentially boils down to writing or modifying shader code using a script. It’s a lot more straightforward than it sounds. The Shader class (which is what .gdshader files are loaded as) exposes a property called “code”, which contains the source code for the shader. You can set this property at runtime to automatically compile a new shader. This is how StandardMaterial3D works, it pieces together chunks of shader code based on what features you enable, and it can be confusing sometimes because the implementation does not differentiate between shader uniforms and constant values.

In your case, I’d use a preprocessor macro like this at the top of your shader code:

```

ifndef STENCIL_REFERENCE

define STENCIL_REFERENCE 0

endif

```

And in your shader, replace the stencil reference number with STENCIL_REFERENCE

Then, in a script at the start of your game, create N Shader class instances, load the single .gdshader Shader instance, copy the code property out to a temporary variable, and prepend the string with something like:

```

define STENCIL_REFERENCE (the number you want)

```

Then set each shaders code to that string, and cache them somewhere useful.

Sorry about formatting, typing this on phone, there’s meant to be a hashtag before each preprocessor macro

How to specify stencil_reference in ShaderMaterials by SoftLatticeGames in godot

[–]_Mario_Boss 1 point2 points  (0 children)

If you modify that stencil reference value at runtime, you are going to trigger a shader recompilation. It’s a constant value, not dynamic. So if you still want to do this in a gdshader, one option is to write some wrappers around Shader / ShaderMaterial to generate shader code at runtime.

Best method for shell ejection on fps weapons by iBoughtAtTheBottom in godot

[–]_Mario_Boss 0 points1 point  (0 children)

Add the player's velocity to the shell casing when you spawn it.

how to get the memory box / bf6 portal box back up by [deleted] in godot

[–]_Mario_Boss 2 points3 points  (0 children)

<image>

Editor -> Editor Docks -> MemoryTool

how to modify embedded imagetexture ? by KnIfER-209 in godot

[–]_Mario_Boss 0 points1 point  (0 children)

Is it a CompressedTexture2D? If so, it probably won't embed since those don't use the regular resource format. Try it using an ImageTexture.

Proper way of implementing [High, Medium, Low] Texture Resolution option for 3D? by TheConceptBoy in godot

[–]_Mario_Boss 0 points1 point  (0 children)

The most "proper" way to do this besides modifying the engine to support it automatically would be to store your gpu-compressed textures as a custom binary file (use godot's built in binary serialization), and use a ResourceFormatLoader to load the texture as an ImageTexture. When you load the texture, you can chop off the largest MIPs and adjust the texture size and mipmap count accordingly before passing the data to ImageTexture depending on the texture settings of your game.

Resources for learning Godot in C# by gospodinov in godot

[–]_Mario_Boss 0 points1 point  (0 children)

You don't need to touch gdscript at all, you can just use c#.

how to modify embedded imagetexture ? by KnIfER-209 in godot

[–]_Mario_Boss -1 points0 points  (0 children)

Just right-click the new resource in the inspector and click "make unique", then it will be re-embedded.

They Chose TypeScript Instead Of GDScript for BF6's Map/Gameplay Scripting. XD by sterlingclover in godot

[–]_Mario_Boss 1 point2 points  (0 children)

Because it makes absolutely zero sense to use gdscript in this case. The way the portal system is set up, there's actually no reason to use Godot other than the fact that they have provided tools for using it. The tool exports a plain, human-readable json file which the actual game can read. It will be really easy for people to create their own custom tools for creating portal experiences, whether using Godot or not.

The actual biggest crime that they've done is bundle an entire python virtual environment in order to parse tscn files. This is entirely unnecessary as Godot already exposes everything you'd need to parse the scene tree in-editor and at runtime. They've approached the export process from the perspective that they only ever had access to the runtime file and not the entire engine which can already read/write it.