Everyday Unity – Telegram
Everyday Unity
1.11K subscribers
157 photos
59 videos
42 files
2.36K links
A game developer and tech lead in a top grossing company posting Unity, programming, and gamedev related stuff that I find interesting
Website: https://gamedev.center

Most used tags are:
#performance
#shader
#interview

Author: @alexmtr
Download Telegram
Unity3D - Personal Notebook: A notebook filled with a variety of Unity-related content by a seasoned game developer.

It is especially helpful for new developers as it provides the following:
- A list of existing assets that the author typically includes in their projects.
- UI tips: Although Unity's documentation has greatly improved in terms of UI and its optimizations, this notebook can still serve as a handy cheat sheet to refresh your knowledge.
- The building process and how to troubleshoot potential issues.
- Optimization tips
- Editor tips and tricks
and many more

https://docs.google.com/document/d/1-EFSFLf8bJTZq60kwLzHBOTnb9nv6_Oelu5ho6J_-uI/edit#heading=h.qolyg3va2zkn

#book #tips
🔥2👍1
Improving Burst Inspector search performance

Another example how standard methods might be a lot slower due to various reasons, for instance safety checks. And how own implementation may leverage some assumptions to provide performance gains.
But as usual, always profile.

https://blog.unity.com/engine-platform/improving-burst-inspector-search-performance

#optimization
👍2
Compute Shaders in Unity: Processing transforms with GPU

The noscript is a bit misleading, it's about how to pass data to a compute shader, modify, and then return back to a C# noscript. Transforms are still processed on the main thread. But it's still a decent example how to use compute shaders.

https://www.artstation.com/blogs/degged/KOre/compute-shaders-in-unity-processing-transforms-with-gpu

#compute #shader
👍3
Position-Based-Dynamics: A PBD fluid in unity running on the GPU

Position based dynamics is a method used to simulate physical phenomena like cloth, deformation, fluids, fractures, rigidness and much more. The key process in PBD is to simulate the object as a set of points and constraints. Forces are applied to the points to move them and then the constraints make sure the points wont move in a way that violates the simulation.

https://github.com/Scrawk/PBD-Fluid-in-Unity

#simulation #fluid
👍2
Mechanics and tricks from Platformers applied to Endless Runners to improve experience

The author describes multiple platformer mechanics and provides code samples for them. I believe such mechanics are must have in a platformer game nowadays, and I definitely gonna implement all of them in a kinematic character controller I develop for my own roguelike game with platformer mechanics.

The list of mechanics:
- Early Fall: Player descends as soon as jump button is let go ending jump early.
- Jump Buffering: When the character is already in the air pressing jump moments before touching the ground will trigger jump as soon as they land.
- Predict Ground Collision: When the character is already in the air pressing jump and there is a platform near and below, it can jump as it is already on the ground.
- Coyote Time: Jump still triggered a few frames after running off a ledge.
- Catch Missed Jumps: If a player doesn’t quite make a jump either lift them up a few pixels or change the collision mask so their feet don’t hit the wall.

https://arielcoppes.dev/2023/04/10/platformer_techniques_in_endless_runner.html

#platformer
👍5
This media is not supported in your browser
VIEW IN TELEGRAM
Platforming Tips and Tricks

As a game developer it is your job to make the character move as the player wants, NOT how the player inputs controls. Even if you think your niche is having a very hard game that only makes it more important that your controls are forgiving.

The post also contains a playable demo with these tricks implemented.

http://www.davetech.co.uk/gamedevplatformer

Repo of the demo: https://github.com/DavidStrachan/GM-Perfect-Platforming-Paragon

#platformer
👍5
This media is not supported in your browser
VIEW IN TELEGRAM
kyubuns/AppIconChangerUnity: Change the app icon dynamically in Unity (iOS only)

https://github.com/kyubuns/AppIconChangerUnity

#icon #ios #native
👍4
How to instantiate a prefab in ECS?

It's interesting how such a big post needed to describe so simple action as instantiation. And it doesn't even touch the topic of using a hybrid approach, for instance to connect entity to Animator so your instantiated object can be animated using Mecanim and triggered from ECS.

https://coffeebraingames.wordpress.com/2023/07/28/how-to-instantiate-a-prefab-in-ecs/

#dots #ecs
👍3
SHOULD YOU DO EARLY ACCESS?

Basically the EA path is high risk, and slightly higher reward. Don’t do EA because you need “feedback.”

https://howtomarketagame.com/2023/07/27/should-you-do-early-access

#marketing
👍2
8 TIPS to get MORE WISHLISTS!

1. Take part in the Steam fest
2. Make sure the game is polished
3. Provide a really good tutorial to teach players how to play the game
4. Implement analytics, especially for tutorial to track at which step users drop the game
5. Use Cloud Diagnostics (a Unity service for errors and crashes)
6. Add an in-game feedback form
7. Boost wishlists a week before the fest
8. Do livestreams during the fest

https://www.youtube.com/watch?v=-cnjCyYCxxc

#marketing
👍3
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
👍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):
| 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
👍4