Happy Sunday! Hope this video gives you some ideas for optimizing your game, no matter how many bullets you are firing! 👍
@connorjagielski6760Күн бұрын
I quite literally just tried this on my own. We’re live tracking a dancer, and wanted hundreds of raycasts shooting out to interact with the environment to be shown on an LED wall. Thank you for your impeccable timing
@git-amendКүн бұрын
Awesome! That sounds very interesting!
@Ayushmaan_Singh77Күн бұрын
I can only say one thing, when my first game comes out, you will be one of the biggest reason for my success.Your courses and topic selection is absolutely amazing.
@git-amendКүн бұрын
Great to hear! Thanks!
@trungan2259Күн бұрын
everytime im stucking in anything, git-amend make a video about it 🤯
@git-amendКүн бұрын
Hahah! Nice!
@adamplett2924Күн бұрын
I swear man. Everytime
@KuroUsagi1010Күн бұрын
I hope you don't stop making these videos. You're the only one i found that explains advance stuffs like this
@git-amendКүн бұрын
Thank you!
@JustLetMePickAFuckingUsernameКүн бұрын
Amazing, I was looking into this yesterday and didn't make much performance improvement. This is perfect. Thanks.
@git-amendКүн бұрын
You're welcome!
@Fitz0furyКүн бұрын
very cool. its videos like this that will cost me an extra month on my current project cause i want to play with the ideas in them!
@git-amendКүн бұрын
Haha! Don't get too distracted!
@Fitz0furyКүн бұрын
@@git-amend dude im not even slightly kidding. you did all the PC stuff, and then the playables and the burst stuff. it keeps getting harder and harder to skip trying stuff out. ...i always watch but it takes a time investment to retain some of this stuff. the last stretch of videos i have not actually spun up projects to learn. cause i need to focus on my game. im going on a vacation this week. Im installing unity 6 RN. im gonna go through the last few videos one night at a time during vacation while the fam is asleep!
@TheArghnonoКүн бұрын
Another great video. I still haven't started working with jobs, but this makes me want to do some premature optimization now 😀
@git-amendКүн бұрын
Haha! Awesome!
@jeffreyhersh908Күн бұрын
I keep looking forward to Sundays because of these videos. Always something new to learn. Even if I know the topic you are covering, your take on it always adds something to my knowledge. Question. With you covering jobs and burst will you be doing something with ECS (DOTS) as well? How about generating a mesh from base vertices and triangles using jobs and burst?
@git-amendКүн бұрын
Awesome, thank you! Yes, there have been many requests for DOTS and we'll get there. That's a great idea for a video, I'm going to write that down. Cheers!
@TheGabmeisterXКүн бұрын
Please continue making videos! They are really good.
@git-amendКүн бұрын
I surely will! Thank you!
@rutchjohnsonКүн бұрын
Thanks hit-amend!
@git-amendКүн бұрын
No, thank you!
@ThorBondeКүн бұрын
your videos are quickly becomes my favorites, but i'm wondering what makes the icon left of you code lines and what do they mean i see fire symbol and unity logo and other?
@git-amendКүн бұрын
I'm glad you're enjoying the videos! The icons you see next to the code lines in Rider are called gutter icons. Fire means 'Frequently called code' and the Unity icon has several different meanings, but usually it means something that is exposed to the Unity editor. www.jetbrains.com/help/rider/Settings_Gutter_Icons.html
@techdave99Күн бұрын
This gives me a few ideas about stuff. Great!
@git-amendКүн бұрын
Nice, glad to hear that!
@lonbpalmerКүн бұрын
Another great lesson!
@git-amendКүн бұрын
Glad you liked it!
@UTTheLawКүн бұрын
Very nice! Thanks!
@git-amendКүн бұрын
You're welcome!
@정동우-n2xКүн бұрын
and I have a some question. After studying your video, I understand that it involves putting various pieces of information into a NativeArray and then using it. Is my understanding correct? If so, when I follow such a Data-Oriented Design (DOD) approach, can I use NativeArray by placing data into it? I apologize for my lack of understanding
@git-amendКүн бұрын
While NativeArray is not inherently Data-Oriented Design (DOD), it is a tool that supports DOD principles by allowing for efficient memory management and data access. DOD focuses on organizing and processing data in ways that minimize cache misses and optimize CPU performance, and NativeArray helps achieve this by storing data contiguously in memory. When used within a DOD approach, NativeArray enables better performance, especially in parallelized systems like Unity's Job System.
@정동우-n2xКүн бұрын
@@git-amend I’m sorry for always bothering you with questions due to my lack of understanding. I always enjoy watching your content. As you know, I’m a relatively new Unity player(2years), and I’m trying my best to clone code from all of your projects. Thank you as always. I’m learning a lot.
@НикитаМордик-к8фКүн бұрын
Thanks, very interesting method, try to use something like that in my FPS game))
@git-amendКүн бұрын
Awseome! Glad to hear that!
@НикитаМордик-к8фКүн бұрын
@@git-amend how much that method better than usual raycast? I mean performance and physics calculation.
@git-amendКүн бұрын
In terms of raw performance, the job-based approach can handle many more raycasts per frame without bottlenecking the CPU because it allows you to run multiple raycasts/spherecasts in parallel, while traditional raycasting is limited to the processing power of a single thread. It's difficult to give specific numbers, because all projects are different. If you don't need many raycasts every frame, then just stick with normal raycasts, but I think in an FPS game it will have a good payoff.
@techdave99Күн бұрын
I wonder how well this will scale up or would using the particle system would be better?
@git-amendКүн бұрын
I think it will really depend on the project. It think it will scale well for most projects, especially if you can cache the different arrays, which would require a little bit of refactoring. I would prefer this kind of system when I want to know precise details about collisions, and it could be used for other purposes as well such as an AI Sensor. On the other hand, a Particle system is low cost and great for visual effects where you need less info about what they collide with.
@techdave99Күн бұрын
Thanks for the info!
@정동우-n2xКүн бұрын
Additionally, could you share some shader you made later? That's great.
@git-amendКүн бұрын
Do you mean a shader from this video, or just shaders in general?
@정동우-n2xКүн бұрын
@@git-amendI like the shaders used in this video, but if it's alright with you, I would love it if you could share the shaders you create. I can make basic shaders too, but you are always on a higher level.
@damonfedorickКүн бұрын
Nice!
@damonfedorickКүн бұрын
forming a list to release objects at the end of the frame is actually such a Giga Chad move.
@git-amendКүн бұрын
Thank you! Cheers!
@mikhailhumphriesКүн бұрын
What is this () =>? I don't get why you use it
@git-amendКүн бұрын
The () => syntax you see in the code is called a lambda expression in C#. It’s a way to define an inline function (anonymous method) without explicitly declaring it. It's a more concise and readable way to define small, reusable functions.
@meteturkayКүн бұрын
amazing
@git-amendКүн бұрын
Thank you! Cheers!
@DevGOMКүн бұрын
Can you make a video about optimization using lua?
@git-amendКүн бұрын
That sounds like an interesting idea! What kinds of bottlenecks are you facing with lua?
@marcsh_devКүн бұрын
First, good video, goes over things well. However, correct me if Im wrong, but if you were raycasting the bullets against the volumes, you wouldnt need to substep the bullets. Projectiles are often actually raycasted since they do move fast, and the raycast is from last_frame_pos to this_frame_pos, and thus doesnt need a substep. (I prefer sweep casting of sphere (ie, capsules/lozenges), but its functionally similar) Im not a big Unity dev, but it should have (hopefully batch) raycast options, which might end up faster than your substepping (depending on quite a few things). Substepping the point projectiles could be faster, so if I was looking at it, Id keep both versions around.
@git-amendКүн бұрын
In Unity, Raycasting works by testing against intersections, not against the full volume of a collider, and on top of that Raycasts will not detect colliders for which the Raycast origin is inside the Collider which is why 'tunnelling' is a common issue in Unity.
@marcsh_devКүн бұрын
Ok, so below is my question and (hopefully) understanding of the issue. Also if this _is_ the issue, that.. rough, but at least understandable. By "ray" its really an origin, direction, and max length, so its technically a line segment. Ill be using ray below as is common with this. Unless you mean this (forgive the bad text art below): Key: [ ] == the collider |----> == the ray |---> [ ] == Clear miss |----[---> ] == hit |--[------]---> == this should be a hit, but is it a miss in Unity? If so, thats strange, but also if so, I now understand better. (description of the above (Third is the real question). First one is just no intersection, with the ray outside completey. Second is an intersection with a side, with the origin of the ray outside, and the end of the ray inside. These are for example. Third is start of ray is outside, _and_ end of ray is outside, but the ray itself intersects the collider. Im guessing third is the one that is broken on Unity?)
@JasonKaler49 минут бұрын
Nice tutorial. I was wondering why the sub steps help with detection? It doesn't make sense to me that ray casts would fail if the object we're colliding with is not moving. Surely there must be something else wrong in the logic. Is this a result of the frame loop not aligning with the jobs? so some frames are being missed by the jobs. Would it not be better to solve the issue by casting a ray from the bullets last checked position to its current position ? This should also allow for more complex trajectories.
@hop3studio511Күн бұрын
How can you this good?
@git-amendКүн бұрын
Thank you for the kind words!
@6541l-s2j15 сағат бұрын
Just curious if this is actually more efficient than just putting a box or sphere collider on each bullet and letting the default physics do the collision detection?
@git-amend12 сағат бұрын
Detecting ray intersections in multithreaded batches of native memory is much cheaper than determining if entire colliders intersect one by one, and depending on your project you can make it even more efficient than the video by streamlining your memory allocations.
@TheformandКүн бұрын
There shouldnt be a need for sub-stepping here. In your job(s), move each projectile to the desired position. Then, raycast from the old position to the newest position. If hit, remove the projectile. That guarantees no tunnelling.
@git-amendКүн бұрын
That sounds promising, but it's just the inverse of the move/raycast operations as they exist in the video. Casting the ray before or after the move does not change the fact that it can potentially miss. It's the same ray, just cast at a different time.
@RomaGorovКүн бұрын
agreed. also can raycast and then move to hit point or to frame distance.
@eugenschabenberger5772Күн бұрын
I would like to see a cpmparison to an implementation without the job. It looks like the same data is copied twice.
@git-amendКүн бұрын
By all means, I encourage you to do so and use the profiler to see what is happening with (and without) the Jobs.
@brutalgamer1507Күн бұрын
how can i use it to find cover for enemy ai
@git-amendКүн бұрын
You can adapt this approach for enemy AI cover detection by using spherecasts or raycasts to check for obstacles between the AI and potential cover points. By casting in multiple directions from the enemy's position, you can determine if a cover object is blocking line-of-sight to the player. This technique allows the AI to evaluate which positions provide the best cover from incoming threats.
@brutalgamer1507Күн бұрын
@@git-amend Like for potential cover I shoot ray from the cover to player which ever ray doesn't hit the player we add that position to the list and from the list we check the closest cover distance from enemy and assign it as a cover like this am I right
@git-amendКүн бұрын
@@brutalgamer1507 Yes, that sounds like an approach that could work. Or you could do the inverse and shoot rays from the player and get the hits.
@brutalgamer1507Күн бұрын
@@git-amend but this approach work with manually setted cover position in level but there is any way to find cover without any manually set the cover position in level
@brutalgamer1507Күн бұрын
@@git-amend and 1 more question I want to make realistic Spider-Man swinging like in spiderman PS4 but how should I use raycast to make this happened
@AtmosMr4 сағат бұрын
@git-amend Hi, I am having issues trying to get on your discord server it says all the links are invalid. I suspect a problem with the thing between my keyboard and chair but how do I join?
@git-amendСағат бұрын
That's hard to say, but the Discord is alive and well. The last time someone couldn't join was because they had reached their max limit of servers they could join.