Hello guys,
I just read this article about Promises in game development and was wondering what do you think about it ?
Hello guys,
I just read this article about Promises in game development and was wondering what do you think about it ?
Maybe it’s just me, but the link doesn’t seem to lead to a working URL.
That’s weird because it works just fine for me.
I tried both Chrome(immediately goes to google with “did you mean…” that doesn’t go anywhere) and Firefox (“server not found”).
Typical programmer article. Pages in without ever explaining what a promise is or why I should care about them. ![]()
By the time I got to the end of the article I’m convinced that a coroutine will do the same job. Unless you are doing a lot of specialist stuff, there is no real need for a promise. And it’s trivially easy to write your own coroutine caller if you need to move outside of MonoBehaviour or need more control.
As one coming from Scala background, I welcome any such tools which enables me to handle async tasks in a cleaner, and composable manner. And the concept itself is quite popular among JavaScript developers as well, so maybe it’s about time we can expect to see these things in gaming industry too.
I haven’t done any serious game development (or C# development for that matter) yet. But I’ll definitely check this library out (along with UnityRx) and see if I can get some benefit from it.
I think you are a bit harsh ![]()
I found the article very clear and the author tries to explain what Promises are, where the concept comes from, why it could be useful for game and clearly explains the pros/cons for promises and Coroutine and BT.
I agree that Coroutines can handle the same types of situations described in the article but I like the chain syntax and the custom Promises they develop which can be useful. But yeah, nothing really new with Promises, just a different way of doing things, a new syntax. So maybe it’s just about using what your are the more confortable with.
Anyway, it’s nice to hear what you guys think about it.
I skimmed through the article, and IIRC normally this pattern is called “Future” and not “Promise”.
It is a cool idea, used in both Qt framework and modern C++. It is much better than dealing with raw threads, and does different thing compared to coroutines.
See:
http://doc.qt.io/qt-5/qfuture.html
http://doc.qt.io/qt-5/qfuturewatcher.html
http://en.cppreference.com/w/cpp/thread/future
However, I think something similar should already be available in C#. See, for example:
https://msdn.microsoft.com/en-us/library/ff963556.aspx
[lil bit o silly] If a game developer promises something - they should deliver on that promise! ![]()
Have had it bookmarked for some time now with the intention of reading it but have yet to find the time or desire. Articles of this nature can be both enjoyable and informative to read but the size of it is simply too much for now.
We would if you artists would stop moving the target all the time! ![]()
That was actually why I clicked the link. I was expecting to read a piece reaming the likes of No Mans Sky and anything Peter Molynuex. Instead I got some weird attempt from a web developer to convert me to some illconcieved hybrid of a coroutine and a behaviour tree.
Which may be why I came across a little harsh. Nothing ruins a mood more then broken expectations.
That aside I still stand by my original judgement. It’s not really a tool I can see myself using or needing. And the tone of the article sounds much like the dependency injection or the F# guys. They are very convinced their new way is the best, but they struggle to explain why in any concrete terms.
I think oh joy another buzzword and using a common word. Probably chosen as much
for people being able to say “broken promises lol” than anything else.
I doubt I’ll ever get into this parallel programming stuff. If I do it would be purely out of “fun” just exploring it as a hobby. But I think most of the underlying tech will handle all of this automatically for the most part over time. I thought it (like Windows itself) was already supposed to be doing that to some degree.
Basically there is no shortage of technologies, patterns & practices, paradigms, languages and so forth for a person to dive into. With or without this one.
As a web developer, I’d say you couldn’t be more right. It’s a nightmare sometimes trying to stay up to date.
I suppose it’s because there are a lot of clueless people who just wanted to look like an elite programmer, or to try something new without actually understanding the concepts ![]()
I have mixed feelings about FP, but I can vouch for dependency injection, as I hardly can think of writing any piece of code without it these days. And I believe I can explain its benefits in concrete terms if I’m given time, as I’ve done that a few times before when I had to teach the concept to junior developers.
When I moved to C#/Unity world, the first thing I did was searching for a suitable DI framework and I found Zenject, and I’m quite happy with it.
I strongly believe that more and more game developers will use some sort of a DI framework in future, just like how they seem to be slowly embracing the concept of unit testing.
Shoot. I’ve got time. ![]()
I’ve attempted to understand the concept and the benefits before, but I can’t get my head around it.
Ok, then I’ll try to be very brief ![]()
The biggest benefit with DI, as I see it, is that it enables you to separate the concern of resolving dependent components, or of managing their lifecycles from that of your actual business(or gaming, in this case) logic.
In fact, Unity itself can be seen as a sort of a DI container, as it resolves various components assigned to properties in your script from the Inspector, and sometimes manages their lifecycle too, if they happened to be another MonoBehavior scripts.
Considering what would it be like, if Unity did not provide such a mechanism, I think it wouldn’t be necessary to emphasize the benefits of having a DI framework further.
Probably the more interesting topic to talk about, in this context, might be whether or not it could be beneficial to have another DI framework on top of Unity, like Zenject or Adic, for instance.
I’d like to argue that it could, because DI implemented by Unity is not ‘lightweight’ (it’s nothing to do with performance), as it enforces your classes to extend from MonoBehavior which makes it problematic to unit test them, or to follow common design principles, like making your intentions clear by declaring all the necessary dependencies in your constructor, so that it would be impossible to instantiate the class in an invalid state.
And sometimes, you need to allow different implementations of the same contract, like for instance, when a developer of a RPG template would want his or her customers to choose between a few different control schemes, or even to implement their own.
Unity’s own DI implementation doesn’t support such a use case very well, but with a dedicated DI framework like Zenject, it’s just a matter of wiring up different components as needed.
Lastly, it can also help defining the scope of components in a cleaner and more intuitive ways. In a game, some components only make sense when they are attached to a game object, like a script to hold a character’s attributes, for instance. But there are other components as well, which should be bound to the scene or even the whole project itself, like such script which handles user preferences, for instance.
With Unity, you need to solve such a problem by either writing a singleton class yourself, or by adding an arbitrary game object in a scene and attach your scripts there. But with a DI framework which provides predefined set of scopes, it can be done in a much more cleaner way, thus making it easier to understand and manage.
I’m not saying that everyone needs to abandon their old ways and start using DI right away. But I believe that at least its benefits are something real, as it has been proven in other fields over the past decade.
Lol. Its the customers! They demand more polys, better shaders, grander animations and unrealistic FX! The customer gets what the customer wants. ![]()
I thought from the title this thread was about making promises to yourself that you won’t let your dreams be dreams.
Tell me about it. You know how much easier my job would be if every building in Australia was black or white? None of this lobster orange or lemon yellow stuff.
![]()