This media is not supported in your browser
VIEW IN TELEGRAM
noio/games.noio.planter: The plant simulation from Cloud Gardens as a Unity package for level design.
https://github.com/noio/games.noio.planter
#vegetation
https://github.com/noio/games.noio.planter
#vegetation
👍6
Optimize struct performances using StructLayout
I ran a simple benchmark that passes structs as an argument: one uses StructLayout.Sequential and another StructLayout.Auto.
I intentionally ordered fields in a way that makes them have padding.
And result is (the formatting in mobile clients sucks):
It can be avoided by using 'ref' parameter so no copying occurs. I've also thrown readonly structs to the test.
https://www.meziantou.net/optimize-struct-performances-using-structlayout.htm
#optimization #struct #layout #ref
I ran a simple benchmark that passes structs as an argument: one uses StructLayout.Sequential and another StructLayout.Auto.
I intentionally ordered fields in a way that makes them have padding.
And result is (the formatting in mobile clients sucks):
| Method | Mean | Ratio |
|------- |---------:|------:|
| Auto | 298.6 us | 1.00 |
| Seq | 359.0 us | 1.20 |
Obviously copying struct that is bigger due to the padding to pass it as an arg is slower. But this operation is so quick that it might be a problem only on a very hot path.It can be avoided by using 'ref' parameter so no copying occurs. I've also thrown readonly structs to the test.
| Method | Mean | Ratio |
|------------- |---------:|------:|
| Auto | 318.5 us | 1.00 |
| Seq | 398.7 us | 1.25 |
| AutoRef | 254.5 us | 0.80 |
| SeqRef | 299.7 us | 0.94 |
| AutoReadonly | 312.9 us | 0.98 |
| SeqReadonly | 390.5 us | 1.22 |
As you can see passing both structs by ref is definitely faster. But Auto is again faster than Sequential. While readonly structs don't have any performance benefits according to this benchmark. To make sure a defensive copy of a readonly struct is avoided, I've also added 'in' parameter to the arg and now we can see that structs are not copied anymore and performance is on par with the 'ref' parameter| Method | Mean | Ratio |
|--------------- |---------:|------:|
| Auto | 299.9 us | 1.00 |
| Seq | 369.1 us | 1.23 |
| AutoRef | 245.1 us | 0.82 |
| SeqRef | 305.7 us | 1.02 |
| AutoReadonly | 309.1 us | 1.03 |
| SeqReadonly | 369.6 us | 1.23 |
| AutoReadonlyIn | 255.4 us | 0.86 |
| SeqReadonlyIn | 303.4 us | 1.02 |
I performed all these benchmarks in .NET. It would be very interesting to look at it in Unity using IL2CPP, whether it affects performance in C++ or not.https://www.meziantou.net/optimize-struct-performances-using-structlayout.htm
#optimization #struct #layout #ref
Meziantou's blog
Optimize struct performances using StructLayout
A struct type is a value type that is typically used to encapsulate small groups of related variables. It is often used for interop with native DLL ([DllImport]). Structs are also used for performance reasons. Value types are allocated on the stack so it…
👍4
Designing a Realtime Combat System. This article is about melee combat foremost.
A great list of combat mechanics, how and when each of them should be used or not. Must help a lot when designing combat in your game.
https://howtomakeanrpg.com/a/designing-a-realtime-combat-system.html
#combat #platformer
A great list of combat mechanics, how and when each of them should be used or not. Must help a lot when designing combat in your game.
https://howtomakeanrpg.com/a/designing-a-realtime-combat-system.html
#combat #platformer
Howtomakeanrpg
Designing a Realtime Combat System | How to Make an RPG
Combat in action RPGs seems simple; avoid enemys attacks while dishing out your own but even a simple system is made up of many design decisions! In this article I'll cover the most important decisions you need to make when designing combat. I don't see many…
👍1
Speed up the build process of your Unity projects
It's a great post with practical steps based on real experience. I can confirm that these steps are helpful, as I had been working on the same project when these approaches were introduced.
It would be also interesting to read more about splitting the code base into multiple projects and how to properly handle the build process in that case as no references were provided in the post.
https://medium.com/@wondrous_aqua_toad_341/speed-up-the-build-process-of-your-unity-projects-a4e3f048c32f
#build
It's a great post with practical steps based on real experience. I can confirm that these steps are helpful, as I had been working on the same project when these approaches were introduced.
It would be also interesting to read more about splitting the code base into multiple projects and how to properly handle the build process in that case as no references were provided in the post.
https://medium.com/@wondrous_aqua_toad_341/speed-up-the-build-process-of-your-unity-projects-a4e3f048c32f
#build
Medium
Speed up the build process of your Unity projects
This tutorial will show approaches to improve the build time of Unity projects. From Client architecture, PlayerSettings, and Approaches si
👍3🔥1
Dependency injection
The author clearly shows how dependency injection helps make code more maintainable and testable.
https://youtu.be/J1f5b4vcxCQ
#pattern #di
The author clearly shows how dependency injection helps make code more maintainable and testable.
https://youtu.be/J1f5b4vcxCQ
#pattern #di
YouTube
Dependency Injection, The Best Pattern
Try using the attachment service at https://www.patreon.com/codeaesthetic
You'll also find deleted scenes, song names and more
You'll also find deleted scenes, song names and more
👍3
Developing SWIFT, Part 1: Combat & Gameplay Mechanics
The breakdown of combat and gameplay design decisions in a competitive melee combat action game
https://80.lv/articles/developing-swift-part-1-combat-gameplay-mechanics/
#gamedesign #combat
The breakdown of combat and gameplay design decisions in a competitive melee combat action game
https://80.lv/articles/developing-swift-part-1-combat-gameplay-mechanics/
#gamedesign #combat
80LV
Developing SWIFT, Part 1: Combat & Gameplay Mechanics
The developers of SWIFT have shared a massive, 2-part breakdown, discussing all the aspects of the game. In the first part, the team has talked about general gameplay and combat mechanics. Visit us tomorrow to learn more about environments, characters, and…
👍2🔥2
Use string.Equals with StringComparison.OrdinalIgnoreCase parameter instead of manually adding ToLower()/ToUpper() for better performance and cleaner code.
#string #performance
#string #performance
👍11
Everyday Unity
https://catlikecoding.com/unity/tutorials/noscriptable-render-pipeline/lights/ #srp #lighting
Custom SRP 1.0.0
How to upgrade the old SRP tutorial to Unity 2022. Some of these fixes I had to do myself when I followed this series a long time ago but using Unity 2021. It's great that Jasper supports the series and shared the update.
I personally recommend this series as it not only shows steps how to implement your own rendering pipeline, but gives an idea how some parts of rendering work in general.
https://catlikecoding.com/unity/custom-srp/1-0-0/
#srp
How to upgrade the old SRP tutorial to Unity 2022. Some of these fixes I had to do myself when I followed this series a long time ago but using Unity 2021. It's great that Jasper supports the series and shared the update.
I personally recommend this series as it not only shows steps how to implement your own rendering pipeline, but gives an idea how some parts of rendering work in general.
https://catlikecoding.com/unity/custom-srp/1-0-0/
#srp
Catlikecoding
Custom SRP 1.0.0
Unity Custom SRP 1.0.0 tutorial, modernization.
👍4
Intro to DOTS animation
No, there is still no solution provided by Unity as part of DOTS.
The author shows how to use a hybrid animator approach, similar to one shown in DOTS character controller samples.
The video also shows the simplest example how to use 2 most popular animation assets from the asset store.
https://youtu.be/KvabbZKrUHk
#dots #animation
No, there is still no solution provided by Unity as part of DOTS.
The author shows how to use a hybrid animator approach, similar to one shown in DOTS character controller samples.
The video also shows the simplest example how to use 2 most popular animation assets from the asset store.
https://youtu.be/KvabbZKrUHk
#dots #animation
YouTube
Intro to DOTS Animation - Unity ECS Tutorial 2024
🤑 Get these assets for 50% off: https://assetstore.unity.com/turbo-makes-games?aid=1101l9vRP 🤑
👨💻 Code/Scripts from this video: https://gist.github.com/JohnnyTurbo/c804634191848ca5ed7fde5082cc8a96 👨💻
Animation Options Wiki: https://forum.unity.com/threads/dots…
👨💻 Code/Scripts from this video: https://gist.github.com/JohnnyTurbo/c804634191848ca5ed7fde5082cc8a96 👨💻
Animation Options Wiki: https://forum.unity.com/threads/dots…
👍4
Dependency Injection on Unity
Another post why DI might be useful. But it also contains an implementation of a custom DI container, which is a great way to learn how containers work under the hood, especially how injections into MonoBehaviors work
Part 1: https://moderncsharpinunity.github.io/post/dependency-injection-on-unity/
Part 2: https://moderncsharpinunity.github.io/post/dependency-injection-on-unity-part2/
#di
Another post why DI might be useful. But it also contains an implementation of a custom DI container, which is a great way to learn how containers work under the hood, especially how injections into MonoBehaviors work
Part 1: https://moderncsharpinunity.github.io/post/dependency-injection-on-unity/
Part 2: https://moderncsharpinunity.github.io/post/dependency-injection-on-unity-part2/
#di
Modern C# in Unity3D
Dependency Injection on Unity
Many has been written about dependency injection, even Unity folks wrote about it long time ago, and there are some good frameworks like Zenject, so what is so cool about dependency injection?
👍3
Day Night Cycle using LUT in Fragment Shader of Materials
https://shahriyarshahrabi.medium.com/day-night-cycle-using-lut-in-fragment-shader-of-materials-80edaf26f655
Repo: https://github.com/IRCSS/Day-Night-LUT-Shader
#shader #lut
https://shahriyarshahrabi.medium.com/day-night-cycle-using-lut-in-fragment-shader-of-materials-80edaf26f655
Repo: https://github.com/IRCSS/Day-Night-LUT-Shader
#shader #lut
Medium
Day Night Cycle using LUT in Fragment Shader of Materials
I will cover how to use look up tables, aka LUTs in the fragment shader of the object’s material to make a day night transition or adjust…
👍2
This media is not supported in your browser
VIEW IN TELEGRAM
You can go a long way just by multiplying and adding simple textures in a creative way. ❄ Check out this frozen effect! Adding a few extra particles sells the illusion
https://twitter.com/unitygames/status/1536725196274642944
#vfx #frozen
https://twitter.com/unitygames/status/1536725196274642944
#vfx #frozen
👍6
Particle Effect For UGUI (UI Particle): This plugin provide a component to render particle effect for uGUI in Unity 2018.2 or later.
The particle rendering is maskable and sortable, without Camera, RenderTexture or Canvas.
It also correctly scales particles and provides better performance with mesh sharing feature.
https://github.com/mob-sakai/ParticleEffectForUGUI
#ui #particle
The particle rendering is maskable and sortable, without Camera, RenderTexture or Canvas.
It also correctly scales particles and provides better performance with mesh sharing feature.
https://github.com/mob-sakai/ParticleEffectForUGUI
#ui #particle
GitHub
GitHub - mob-sakai/ParticleEffectForUGUI: Render particle effect in UnityUI(uGUI). Maskable, sortable, and no extra Camera/Ren…
Render particle effect in UnityUI(uGUI). Maskable, sortable, and no extra Camera/RenderTexture/Canvas. - mob-sakai/ParticleEffectForUGUI
👍7
Moving faster
I find this very useful to help structure your development process. In the university I had the Personal Software Process (PSP) course that was also aimed to make each part of software development lifecycle more effecient. This post obviously does not cover what the whole course teaches you about, but it's a good place to start.
I also feel The Pragmatic Programmer vibes in this post. Some advice are directly from this book. So if you liked the post, you may take a look at the book too.
https://www.scattered-thoughts.net/writing/moving-faster/
#psp #productivity
I find this very useful to help structure your development process. In the university I had the Personal Software Process (PSP) course that was also aimed to make each part of software development lifecycle more effecient. This post obviously does not cover what the whole course teaches you about, but it's a good place to start.
I also feel The Pragmatic Programmer vibes in this post. Some advice are directly from this book. So if you liked the post, you may take a look at the book too.
https://www.scattered-thoughts.net/writing/moving-faster/
#psp #productivity
👍5
This media is not supported in your browser
VIEW IN TELEGRAM
Exarion
This tool makes a greyscale texture that tells each pixel when it should display itself. It helps create these types of textures easier.
https://botsop.itch.io/exarion
#vfx
This tool makes a greyscale texture that tells each pixel when it should display itself. It helps create these types of textures easier.
https://botsop.itch.io/exarion
#vfx
👍10
Vertex Color Baker
An AssetPostprocessor for Unity that can bake ambient occlusion and curvature information into mesh vertex color channels, mainly intended for mid-poly workflows and procedural hard surface shaders.
https://github.com/Fewes/VertexColorBaker
#ao #vertexcolor
An AssetPostprocessor for Unity that can bake ambient occlusion and curvature information into mesh vertex color channels, mainly intended for mid-poly workflows and procedural hard surface shaders.
https://github.com/Fewes/VertexColorBaker
#ao #vertexcolor
👍4
How to access worldwide your WebGL build from the local machine
https://medium.com/@wondrous_aqua_toad_341/how-to-access-worldwide-your-webgl-build-from-the-local-machine-b506c24a4dbd
#webgl
https://medium.com/@wondrous_aqua_toad_341/how-to-access-worldwide-your-webgl-build-from-the-local-machine-b506c24a4dbd
#webgl
Medium
How to access worldwide your WebGL build from the local machine
Sometimes you would like to share your web game or prototype on the internet with somebody. The option of creating an account on services like itch.io or Unity Play is not suitable for you and is…
👍6
C# Journey into struct equality comparison, deep dive
A great post that dives into reasoning behind implementing IEquatable<>: where exactly allocations happen and that default ValueType Equals implementation uses structural comparison only for tightly packed structs, otherwise field-by-field comparison is used which utilizes reflection.
For us it means that we must implement IEquatable<> in our structs in case they are compared, which is common case when used in collections (dictionary, list, array, etc).
https://medium.com/@semuserable/c-journey-into-struct-equality-comparison-deep-dive-9693f74562f1
#performance #equals
A great post that dives into reasoning behind implementing IEquatable<>: where exactly allocations happen and that default ValueType Equals implementation uses structural comparison only for tightly packed structs, otherwise field-by-field comparison is used which utilizes reflection.
For us it means that we must implement IEquatable<> in our structs in case they are compared, which is common case when used in collections (dictionary, list, array, etc).
https://medium.com/@semuserable/c-journey-into-struct-equality-comparison-deep-dive-9693f74562f1
#performance #equals
Medium
C# Journey into struct equality comparison, deep dive
Deep dive on struct equality comparison, stepping into .NET internals and C++ land
👍6
Unity HDRP & ShaderGraph: Nodes that Bloat Shaders
It's nothing new that Shader Graph generates less-than-ideal code, but it's still interesting to examine in detail and see which more optimal solutions the author proposes.
https://justlukass.hashnode.dev/shadergraph-can-bloat-your-shaders-and-here-is-when
#performance #shader
It's nothing new that Shader Graph generates less-than-ideal code, but it's still interesting to examine in detail and see which more optimal solutions the author proposes.
https://justlukass.hashnode.dev/shadergraph-can-bloat-your-shaders-and-here-is-when
#performance #shader
JL's blog about graphics
Unity HDRP & ShaderGraph: Nodes that Bloat Shaders
Explore Unity's HDRP ShaderGraph's impact on shader efficiency. Learn how certain nodes can generate redundant code with code samples & ISA disassembly.
👍3
Unity Assembly Definitions Explained: How to Organize and Control Your Code
This is definitely a good post that provides an overview of assembly definition settings and the benefits they bring. However, it's important to remember that any approach can backfire when taken to extremes. Having too many asm defs can significantly slow down your iterations. Even if compilation takes only seconds when your project is split into tiny assemblies, the domain reload would take much longer than compiling bigger assemblies, but in smaller quantities. Additionally, Rider needs to process all the assemblies, which also takes a lot of time, and this processing time seems to increase non-linearly as the number of assemblies grows.
Of course, the impact varies, and you should profile on your current hardware with your specific project. For me, 'too many assemblies' starts at around 500-600.
https://marcomignano.com/posts/unity-assembly-definitions-explained-how-to-organize-and-control-your-code
#asmdef
This is definitely a good post that provides an overview of assembly definition settings and the benefits they bring. However, it's important to remember that any approach can backfire when taken to extremes. Having too many asm defs can significantly slow down your iterations. Even if compilation takes only seconds when your project is split into tiny assemblies, the domain reload would take much longer than compiling bigger assemblies, but in smaller quantities. Additionally, Rider needs to process all the assemblies, which also takes a lot of time, and this processing time seems to increase non-linearly as the number of assemblies grows.
Of course, the impact varies, and you should profile on your current hardware with your specific project. For me, 'too many assemblies' starts at around 500-600.
https://marcomignano.com/posts/unity-assembly-definitions-explained-how-to-organize-and-control-your-code
#asmdef
👍3