Looking at Unity made me understand the point of C++ coroutines
mropert.github.io
Looking at Unity made me understand the point of C++ coroutines
1–10 of 190 posts
Re: Looking at Unity made me understand the point of C++ coroutines
#2It can easily and often does lead to messy rube goldberg machines.
There was a game AI talk a while back, I forget the name unfortunately, but as I recall the guy was pointing out this friction and suggesting additions we could make at the programming language level to better support that kind of time spanning logic.
Re: Looking at Unity made me understand the point of C++ coroutines
#3Re: Looking at Unity made me understand the point of C++ coroutines
#4Not an expert in game development, but I'd say the issue with C++ coroutines (and 'colored' async functions in general) is that the whole call stack must be written to support that. From a practical perspective, that must in turn be backed by a multithreaded event loop to be useful, which is very difficult to write performantly and correctly. Hence, most people end up using coroutines with something like boost::asio,…
Re: Looking at Unity made me understand the point of C++ coroutines
#5Re: Looking at Unity made me understand the point of C++ coroutines
#6More broadly the dimension of time is always a problem in gamedev, where you're partially inching everything forward each frame and having to keep it all coherent across them. It can easily and often does lead to messy rube goldberg machines. There was a game AI talk a while back, I forget the name unfortunately, but as I recall the guy was pointing out this friction and suggesting additions we could make at the prog…
Sounds interesting. If it's not too much of an effort, could you dig up a reference?
Re: Looking at Unity made me understand the point of C++ coroutines
#7Always jarring to see how Unity is stuck on an ancient version of C#. The use of IEnumerable as a "generator" mechanic is quite a good hack though.
Re: Looking at Unity made me understand the point of C++ coroutines
#8Always jarring to see how Unity is stuck on an ancient version of C#. The use of IEnumerable as a "generator" mechanic is quite a good hack though.
Edit: Nevermind, they eventually bothered.
Re: Looking at Unity made me understand the point of C++ coroutines
#9[0] https://web.archive.org/web/20260105235513/https://www.chiar...
Re: Looking at Unity made me understand the point of C++ coroutines
#10Always jarring to see how Unity is stuck on an ancient version of C#. The use of IEnumerable as a "generator" mechanic is quite a good hack though.
Not that ancient, they just haven't bothered to update their coroutine mechanism to async/await. The Stride engine does it with their own scheduler, for example. Edit: Nevermind, they eventually bothered.
[1] https://docs.unity3d.com/6000.3/Documentation/ScriptReferenc...