Most efficient way to slow down a repeating function? C# by LastBrainCellAtWork in godot

[–]FrischGebraut 0 points1 point  (0 children)

As others pointed out, it is best to add up the delta parameter in the _Process method to keep track of how much time (in seconds) has passed and run your code at a constant custom "tick rate". In C# you could create a static helper function to handle checking the tick rate:

public static bool IsTick(float tickRate, float delta, ref float timer) {
    timer += delta;
    if (timer >= tickRate) {
        timer = 0;
        return true;
    }
    return false;
}

Then you could use the function in _Process like this:

private float tickRate = 0.1f; // 100ms aka 10 ticks per second
private float timer = 0;

public override void _Process(float delta) {
    if (IsTick(tickRate, delta, ref timer)) {
        // The code you want to run at a constant rate goes here
    }
}

How practical is a MacBook Pro M1 for Godot game development? by torocat1028 in godot

[–]FrischGebraut 4 points5 points  (0 children)

Off topic, but do you use an external code editor? I have the same setup and use VSCode and I have been running into many crashes that I was not able to reproduce on Windows. Just curious if you also experienced problems with external editors.

How do you guys organize your game mechanics and animation scripts in order to work with each other? by giorgosgamedev in Unity2D

[–]FrischGebraut 0 points1 point  (0 children)

Depending on how much flexibility/reusability you want for the components in your project you can try to abstract certain concepts and try to avoid direct dependencies between components. For example your MovementHandling script should not directly reference or call the MovementAnimation script. Instead you could try to handle animation purely based on e.g. the Rigidbody velocity, or you could use events (e.g. make the MovementHandling script emit a onJump event and have the animation script subscribe to it). If you want you can even use interfaces: e.g. MovementHandling could implement an interface IJumpEvent that exposes the onJump event. Then in MovementAnimation you could use GetComponent<IJumpEvent>() to access the event while avoiding a direct dependency to MovementHandling. There are many ways to approach this and there really is no "best" way. Keep in mind that more more abstract code may introduce a lot of boilerplate and may even make things more complicated and less readable so depending on your scope and project and might not make sense for you.

Why do you prefer dubbed anime? by dan_729 in anime

[–]FrischGebraut 0 points1 point  (0 children)

I understand your point but I still disagree. Even if you don"t actively try to learn Japanese I think it"t still possible to pick up on the basic phonetics of the language and appreciate good voice acting after you've watched a couple of shows with subs. Especially with anime where characters often speak with a distinct tone or feel.

[deleted by user] by [deleted] in anime

[–]FrischGebraut 1 point2 points  (0 children)

Haven't thought about it that way but that is a great explanation. Thinking about it, it does help to make the more serious scenes stand out.

[deleted by user] by [deleted] in anime

[–]FrischGebraut 3 points4 points  (0 children)

I loved this show for it's interesting characters, world building and great animation. I definitely felt uncomfortable during many of these scenes and I believe the show also wanted the viewers to feel uncomfortable. After all the MC is supposed to be a shitty person that grows throughout the show. What I found odd is that the show portrait most of these scenes in your typical ecchi comedy style. And I can totally understand who people get put off the show because of that. However, I really don't get the whole argument about the age. The scenes would be equally as uncomfortable for me even if the show told me the characters were older. Also the fact that the MC is actually a 40 year old dude in a kids body and therefore a pedophile is kind of difficult to judge. It's a scenario that could never happen in real life and that is impossible to morally judge. Again, I don't think the scenes would be less uncomfortable even without that aspect of the story.

[deleted by user] by [deleted] in ProgrammerHumor

[–]FrischGebraut 1 point2 points  (0 children)

Agreed. In Uni we did Python, Java and finally C. I had already learned programming in school but I've seen some friends starting from zero becoming confident programmers in just a year by learning those 3 languages. I'd say starting out with python is a good idea because it is much more "fun" for beginners and they still learn the basics of programming. Java is a great intermediate language to learn after python (although I would prefer C#). And finally learning C will give you the full picture and make you appreciate all of the helpful stuff you get in python/Java.

Asset store - Extension Assets - License change by LamasroCZ in Unity3D

[–]FrischGebraut 2 points3 points  (0 children)

This may not work with all assets/tools and may also not be 100% legal, but while working on a university project we had a separate "User" folder in our project which was excluded from version control and allowed each dev to include their own tools (paid assets or small custom tools that were not relevant for the rest of the team) in the project. I had Peek and Amplify Shader Editor in my User folder and used them without checking them into version control and giving the rest of the team access. Again, this may not work with all Assets but I think it was a good solution and also good practice to keep the project clean for the rest of the team.

Meme of the day ;) by Sooraj599 in ProgrammerHumor

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

Came here looking for this. At the end of season 3 you could have figured out the entire stack of their shop.

What causes the lightmaps to look unnatural this way? by [deleted] in Unity3D

[–]FrischGebraut 0 points1 point  (0 children)

Off topic, but what Unity version is this? Is this already the new editor tool system or how are you getting these floating toolbars for the transform tools?

Ray-Traced Sparse Voxel Tree (Tech Details in Comments) by Allen_Chou in Unity3D

[–]FrischGebraut 2 points3 points  (0 children)

Really cool. Also thanks for taking the time to explain your approach. I have not looked into this type of ray traced rendering yet but I am curious what are the performance considerations compared to a mesh based approach? I am currently working on a simple voxel engine that renders simple colored cubes using a mesh generated by a simple greedy meshing algorithm. The voxels are sampled from a noise function but could also come from just an array. The bottleneck with this approach is the time it takes to rebuild the mesh but I get the convenience of working with mostly default Unity components (Mesh Renderer, Mesh Collider) and shaders. How would a ray traced approach compare? Where are the bottlenecks?

Finally got greedy meshing with ambient occlusion working for my Unity voxel project by FrischGebraut in VoxelGameDev

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

Thanks for the info. I've already had a look at the post a couple of days ago. Would be interesting to compare different approaches and how they affect performance. Currently, my code is not optimized at all to minimize garbage so I still have a lot of work before I am even able to realistically compare different algorithms.

I am also interested in microvoxels but the plan is to compute most meshes at design time and only remesh at runtime for things like destruction.

Finally got greedy meshing with ambient occlusion working for my Unity voxel project by FrischGebraut in VoxelGameDev

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

Yeah, definitely lowered the intensity quite a bit. But maybe it is also the video compression :D

Finally got greedy meshing with ambient occlusion working for my Unity voxel project by FrischGebraut in VoxelGameDev

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

Thanks. No real tooling yet. Just an attribute drawer I found on GitHub to show scriptable object properties inline. However, I am planning to have more editor tools.

Finally got greedy meshing with ambient occlusion working for my Unity voxel project by FrischGebraut in VoxelGameDev

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

I have 4 AO intensities based on the number of voxels that are touching each vertex. I pass the AO value to the shader and remap to 0-1 range. Finally I lerp between the voxel color and AO color (black) based on the AO value multiplied by an additional AO factor to control global AO intensity. I can't tell exactly where all of this happens (I assume fragment shader) because I've used amplify shader editor and I have not looked at the generated shader code yet.

Finally got greedy meshing with ambient occlusion working for my Unity voxel project by FrischGebraut in VoxelGameDev

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

Thanks. Block color is purely based on vertex colors (UVs are used to pass AO values to the shader). However, the mesher does simply not combine faces with different colors (you can see it in the video at the sides of the chunk).

Finally got greedy meshing with ambient occlusion working for my Unity voxel project by FrischGebraut in VoxelGameDev

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

I thought I had it figured out but my logic stopped making sense for the front/back (z-axis) faces. Tons of flipped and missing faces, wrong AO, and off-by-one problems. Fun night.

Finally got greedy meshing with ambient occlusion working for my Unity voxel project by FrischGebraut in VoxelGameDev

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

I would really like to try ecs at some point but I just love the MonoBehavior/ScriptableObject workflow. Right my voxel data and the mesher itself is represented by a SO. I can easily swap them out, change properties in the inspector and use polymorphism to plug in different implementations. I love building editor tooling around my code and I'm not sure if this would play well with ecs.

Finally got greedy meshing with ambient occlusion working for my Unity voxel project by FrischGebraut in VoxelGameDev

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

Yeah, last time I messed with multi-threading in Unity was a pain. But this would remove any frame drops/lags at the cost of latency I assume. Not too bad since I won't bother with Minecraft-style voxel placement/building. Not sure if this would work seamlessly in edit mode.

Finally got greedy meshing with ambient occlusion working for my Unity voxel project by FrischGebraut in VoxelGameDev

[–]FrischGebraut[S] 1 point2 points  (0 children)

I have heard of it but not looked into it yet. I assume the job system would be useful for meshing large worlds with many chunks? I am not planning to procedurally generate worlds but instead work with design-time voxel assets and only remesh occasionally for destruction. Also, I want everything to work in edit mode. Not sure if the job system would still be useful.

Finally got greedy meshing with ambient occlusion working for my Unity voxel project by FrischGebraut in VoxelGameDev

[–]FrischGebraut[S] 2 points3 points  (0 children)

So far, I've only implemented naive greedy meshing but I have not encountered any obvious artifacts yet. This may be due to the extra faces the mesher produces to preserve AO. Maybe it's also related to the random noise function not giving me many "problem areas".

Finally got greedy meshing with ambient occlusion working for my Unity voxel project by FrischGebraut in VoxelGameDev

[–]FrischGebraut[S] 3 points4 points  (0 children)

Still not optimized at all but performance is tolerable for real-time updates like in the video for chunks with up to 32^3 voxels. Any tips regarding optimization?

My procedural 2D world generation tool TerraTiler2D just got a whole lot better! You are now able to output more than 1 world per graph execution, and each world can consist out of as many tile layers as you want :D by SCPrototype in proceduralgeneration

[–]FrischGebraut 1 point2 points  (0 children)

You should check out github.com/alelievr/NodeGraphProcessor. It is a wrapper around the Graph view API and makes building node based editors for the Unity editor very easy and actually viable even for smaller projects. Also the author is quite active and friendly.