I'm sure they already know all about this internally or from working directly with Playdead, but as is the case with any large software project, it can't all get done instantly. What may seem like obvious optimizations to you don't matter to the person who wants physically based shaders or a better audio engine, for example.
Great info! The first half of the talk felt a little long, but still good information in it. The scripting part was paced perfectly and also had great tips. Thank you!
The profiling tools (especially the historical ones) are the kind of large-grained analytics that nobody considers until they're neck deep in performance issues and wondering why something that ran just fine last build is broken now. Making decisions based on data, instead of guessing, will save you so much time, money and pain.
I'd love to know how some of these optimizations stand as of last versions of Unity, some seem pretty useable no matter the version (reducing the amount of vector maths and stuff), but some others like the Update and FixedUpdate, I'd like to know if that's still the case, if it still holds up the same or if there's been any work done on it. I'm kind of sure there will always be some overhead, but wondering if it got reduced, or not.
these optimizations are the reason why most devs using their inhouse engines and c++. its valid for almost all ready to use general products. for example you cant just buy an asset from store and hope for the best, you have to optimize for your specific needs. great talk btw, i wonder how many changed in 2018.3
Yes it does. But if you use it several times in an inner loop within the same frame, it's better to read it once and use that cached value instead of calling Time.deltaTime multiple times within the same frame. Not sure that's still a thing today with the latest Unity versions though but as there is still that C#/C++ bridge I guess it is.
Yes it does. But if you use it several times in an inner loop within the same frame, it's better to read it once and use that cached value instead of calling Time.deltaTime multiple times within the same frame. Not sure that's still a thing today with the latest Unity versions though but as there is still that C#/C++ bridge I guess it is.
it's funny.. some of scripting tips mentioned are amazing.. these same tips.. i found overtime some devs in unity forums saying those little changes in code don't matter much.. (focus on other things) i guess they were amateurs.. everything matters.. and those little things can have a toll on performance if they stack together..
One thing that has puzzled me since I've watcher your talk is about the sub scenes: are the sub scenes actually prefabs (or similar?) or actual scenes that are loaded additively or are all subscene objects always present, but deactivated, in the main scene?
Great info especially about recording profiling data! Guys how do you record that stuff? Profiling.Profiler.logFile = "profile.log"; Profiling.Profiler.enableBinaryLog = true; Profiling.Profiler.enabled = true; Is this the way to go?
what of the player is constant;y spinning his view frustum around? doesn't that cause unnecessary loading and unloading of assets which can hinder performance?
The player doesn't control the camera in the game they're talking about. The camera pretty much just follows player movement, and that movement is slow.
Probably because it still means calling a function, or making sure inlining is working correctly. You also kinda create a non-compliant version of Vector3 that has weird behaviour. I'd guess that blowing it all out is easier than messing with compiler settings and overloaded operators. It seems like, ideally, you'd want to create your own vector type with that self modifying behaviour.
I wonder how crazy they'd have needed to go with optimizing if they'd not released on consoles, or weren't so bothered with slight fps hitches and/or loading screens?
I wish Playdead would have made all those amazing tools available before moving to Unreal Engine, even paying on the Asset Store. But maybe too difficult if most of those tools were relying on Unity source code changes :/.
But wait, the vector math point doesn't make sense at all... Vector multiplications should be automatically done on SIMDs in parallel to actually save on performance. Why exactly is it faster when you create 3 separate mult ops for each of the vector elements instead of just doing one vector mult op? Is it because you need to create a Vector3 struct internally to do that or is there some other reason?
What was the name of the post? I was looking through the technology section but couldn't find anything. The closest thing I found was "10000 UPDATE() CALLS" which discusses the internal event loop and the pros and cons of running things via Update() vs. creating your own event loop to control the game with.
hm, sorry I just wrote very stupid comment, thanks for bumping this. Yes I had that article in mind. I guess I should have written 10k Updates vs 1 Update calling 10k ManagedUpdates. I've deleted my old comment
if a simple sidescroller requires a year of optimizing, i'm really scared to make a 3D game in unity. on the other hand, UE4 is a real pain in the butt and constantly blocking my workflow and i'm sure i'll never get anything done.
I believe SetPositionAndRotation(Vector3, Quaternion) is now exposed, at least as of 5.6. Not sure about SetLocalPositionAndRotation(). See docs.unity3d.com/560/Documentation/ScriptReference/Transform.SetPositionAndRotation.html
In older versions you should - theoretically - be able to cache reflection (it ignores privacy modifiers). So cache MethodInfo and then just Invoke it manually.
39:52 visual manipulation :P I really like the ideas, but I dont like that you've changed street fighter guy size, cause it's making visual mislead. This should not be done, ever. Cause we're losing the scale there. Why? Check getdolphins page for "worst graphs of YYYY". But I love the content, I mean all those things you've made there.
0:00 Introduction
1:53 Architecture
16:18 Inside Tools
28:34 Scripting Performance
Awesome!! Thank you! I am working on a seamless one level game and this is so helpful.
People need to watch the last part about scripting tips. Its so good!
Why?
I think Unity needs to watch this presentation themselves :D
I'm sure they already know all about this internally or from working directly with Playdead, but as is the case with any large software project, it can't all get done instantly. What may seem like obvious optimizations to you don't matter to the person who wants physically based shaders or a better audio engine, for example.
So basically it's more difficult to write high performance games in Unity than it is just writing them in C or C++. Awesome engine!
@@youtubesuresuckscock They fixed 99% of these issues back in 2017, so you're safe.
@@youtubesuresuckscock unity is the best game engine right now, I know it was so many issues back then, but it's alright now
Honestly the fact that Unity does not actually make games is a HUGE handicap for them. When he said that, it really resonated with me.
U have no idea what coming, past unity user.
Congrats on winning best art direction , well deserved
"Scripting Performance" at 28:32 !!!!! Awesome ! You have to see!
Great info! The first half of the talk felt a little long, but still good information in it. The scripting part was paced perfectly and also had great tips. Thank you!
Unity need to get all these game devs that are optimizing their shit and work together to improve performance immensely
What we learned today? Use unity for the editor only, the rest you redo when possible.
The profiling tools (especially the historical ones) are the kind of large-grained analytics that nobody considers until they're neck deep in performance issues and wondering why something that ran just fine last build is broken now. Making decisions based on data, instead of guessing, will save you so much time, money and pain.
This is great, thank you guys at Playdead!
I'd love to know how some of these optimizations stand as of last versions of Unity, some seem pretty useable no matter the version (reducing the amount of vector maths and stuff), but some others like the Update and FixedUpdate, I'd like to know if that's still the case, if it still holds up the same or if there's been any work done on it. I'm kind of sure there will always be some overhead, but wondering if it got reduced, or not.
I know its an old comment, but in case anyone is wondering, most of these things got optimized in the latest versions of unity
Last presentation was the only thing I can for :)
From 2016 and it's now on Nov. of 2022 when we finally got SetLocalPositionAndRotation(). At least we got it, took a while.
What are those sub-scenes exactly? An actual, just small scene? A prefab?
these optimizations are the reason why most devs using their inhouse engines and c++. its valid for almost all ready to use general products. for example you cant just buy an asset from store and hope for the best, you have to optimize for your specific needs. great talk btw, i wonder how many changed in 2018.3
How much of the script optimizations are fixed or going to be fixed by unity?
Am I the only one who kept hearing bounds colours? When he finally spelled it on a slide I was like, "OH! That makes FAR more sense."
XD
Great job guys!
Can someone help me understand why you can cache Time.deltaTime? Doesn't it need to update every frame?
Yes it does. But if you use it several times in an inner loop within the same frame, it's better to read it once and use that cached value instead of calling Time.deltaTime multiple times within the same frame. Not sure that's still a thing today with the latest Unity versions though but as there is still that C#/C++ bridge I guess it is.
Yes it does. But if you use it several times in an inner loop within the same frame, it's better to read it once and use that cached value instead of calling Time.deltaTime multiple times within the same frame. Not sure that's still a thing today with the latest Unity versions though but as there is still that C#/C++ bridge I guess it is.
A year after SetLocalPositionAndRotation doesn't seem to be available.
it is now
Anybody got tips on creating your own update functions? Do you use coroutines to find out when each frame ends?
Give the manager a list of behaviours that need to know when the frame ends and have it notify them the same way it does for the update.
Sorry for the noob question, but what does he mean by event subscriptions being expensive? Is he talking about a function subscribing to a delegate?
Hmmm, I feel he may refer to Unity Events, which rely heavily upon reflection?
it's funny.. some of scripting tips mentioned are amazing.. these same tips.. i found overtime some devs in unity forums saying those little changes in code don't matter much.. (focus on other things)
i guess they were amateurs.. everything matters.. and those little things can have a toll on performance if they stack together..
I love "Foreach"!!, no wait, I love get all actors of class.
Where can I find the slide?
docs.google.com/presentation/d/1dew0TynVmtQf8OMLEz_YtRxK32a_0SAZU9-vgyMRPlA
Thank you for sharing your good work! Playdead's are the best :D
One thing that has puzzled me since I've watcher your talk is about the sub scenes: are the sub scenes actually prefabs (or similar?) or actual scenes that are loaded additively or are all subscene objects always present, but deactivated, in the main scene?
You can load additional scenes in Unity now, I think that's what they've used.
anyone can explain to me what he means by build-time at 15:30 ??
Build time is before you run the game. When you "build" the game, so you can run it later. AKA an offline process.
Now there is a method to set rotation and position (SetPositionAndRotation) but not for setting local postion
how does the voxel grid registeres objects? collision detection?
Wow, I didn't know Demon Kane works as programmer after WWE
Yeesh. They might as well have made their own game engine...
How much of this is relevant with Unity 2018/2019. Does anybody know?
Maybe we will need to profile it :D
Great info especially about recording profiling data! Guys how do you record that stuff?
Profiling.Profiler.logFile = "profile.log";
Profiling.Profiler.enableBinaryLog = true;
Profiling.Profiler.enabled = true;
Is this the way to go?
what of the player is constant;y spinning his view frustum around? doesn't that cause unnecessary loading and unloading of assets which can hinder performance?
The player doesn't control the camera in the game they're talking about. The camera pretty much just follows player movement, and that movement is slow.
39:32
Why can't they overload the vector math operators to do what they write out in their code? Wouldn't you get the best of both worlds?
Probably because it still means calling a function, or making sure inlining is working correctly.
You also kinda create a non-compliant version of Vector3 that has weird behaviour.
I'd guess that blowing it all out is easier than messing with compiler settings and overloaded operators.
It seems like, ideally, you'd want to create your own vector type with that self modifying behaviour.
I wonder how crazy they'd have needed to go with optimizing if they'd not released on consoles, or weren't so bothered with slight fps hitches and/or loading screens?
I wish Playdead would have made all those amazing tools available before moving to Unreal Engine, even paying on the Asset Store. But maybe too difficult if most of those tools were relying on Unity source code changes :/.
"unity source code changes"
ah yes the forbidden fruit
But wait, the vector math point doesn't make sense at all... Vector multiplications should be automatically done on SIMDs in parallel to actually save on performance. Why exactly is it faster when you create 3 separate mult ops for each of the vector elements instead of just doing one vector mult op? Is it because you need to create a Vector3 struct internally to do that or is there some other reason?
Most likely Unity's Mono & IL2CPP runtimes don't make use of those instructions
If you want source code examples I have a Unity project demonstrating them here : bitbucket.org/GarretPolk/unity-script-performance/overview
I wish someone would've asked about coroutines.
MEC is pretty amazing dealing with coroutines and per frame garbage generation
What was the name of the post? I was looking through the technology section but couldn't find anything.
The closest thing I found was "10000 UPDATE() CALLS" which discusses the internal event loop and the pros and cons of running things via Update() vs. creating your own event loop to control the game with.
hm, sorry I just wrote very stupid comment, thanks for bumping this. Yes I had that article in mind. I guess I should have written 10k Updates vs 1 Update calling 10k ManagedUpdates. I've deleted my old comment
Sorry, I could catch up, why could not they use localposition? What was the problem there?
Btw after third presentation - and specially after, dont use update. I'm like... "drop unity, find engine that can render only graphics".
if a simple sidescroller requires a year of optimizing, i'm really scared to make a 3D game in unity. on the other hand, UE4 is a real pain in the butt and constantly blocking my workflow and i'm sure i'll never get anything done.
good for me. Because while you're afraid I develope
WWHAT ? SO HOW TO EXPOSE SETLOCALPOSITIONANDROTATION ??
Paying for it, it's the only way you can access Unity source code.
I believe SetPositionAndRotation(Vector3, Quaternion) is now exposed, at least as of 5.6. Not sure about SetLocalPositionAndRotation(). See docs.unity3d.com/560/Documentation/ScriptReference/Transform.SetPositionAndRotation.html
In older versions you should - theoretically - be able to cache reflection (it ignores privacy modifiers). So cache MethodInfo and then just Invoke it manually.
39:52 visual manipulation :P I really like the ideas, but I dont like that you've changed street fighter guy size, cause it's making visual mislead. This should not be done, ever. Cause we're losing the scale there. Why? Check getdolphins page for "worst graphs of YYYY".
But I love the content, I mean all those things you've made there.