Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unreal Engine 5 = Game Changer

Discussion in 'General Discussion' started by DigitalAdam, May 13, 2020.

Thread Status:
Not open for further replies.
  1. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,492
    Dots is really about going around the memory access speed bottleneck https://www.forrestthewoods.com/blog/memory-bandwidth-napkin-math/
    which also happen to be an energy problem in mobile, ie the less costly access to far away memory, the less energy consumed. There is a race to lower micro joules in tech, and memory access is seen as a sin, even GPU vendor are starting that race.

    upload_2020-5-16_23-26-40.png
     
  2. Ommicron

    Ommicron

    Joined:
    May 15, 2020
    Posts:
    47
    the dots renderer is only like 15-25% faster at rendering. megacity was able to render so many things on screen not because it was using dots necessarily, but because of subscenes and their script which loaded and unloaded different subscenes with different contents.
    megacity was more a showcase of dots only features like better audio rather than the power of dots itself
     
  3. shredingskin

    shredingskin

    Joined:
    Nov 7, 2012
    Posts:
    242
    My interest in DOTS went down quite a bit.
    Maybe when I'll do my million rotating cubes game it'll be the perfect tool.
     
    Aiursrage2k likes this.
  4. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Ommicron was previously banned on their other account (and multiple accounts are against the rules anyway) for trolling this thread and resorting to personal attacks, so there is no point in responding to someone deliberately trying to undermine people.

    If they do it again it will be permanent I suspect.

    In future please don't respond to individuals looking to get a response out of you. It's pretty obvious everyone, new account and all just for this thread :)
     
  5. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I will merge this thread with the other one. We shouldn't have multiple threads on this. Merging will merge things chronologically so please don't be surprised.

    (Merging other threads on UE5 into this one)
     
  6. bupkinfetch662

    bupkinfetch662

    Joined:
    May 17, 2020
    Posts:
    14
    my biggest criticism towards unity is that they do not at all communicate properly with their customer base and do not at all provide enough learning content (though better than unreal)

    like how tf are you supposed to know that you should always turn on il2cpp for final builds to get free performance. i actually found that out separately from a random post from Joachim ante on a somewhat unrelated topic about how they're focusing their optimisations only for il2cpp.

    i suspect that unity has a fragmented hierarchy and too few people at unity actually know what is happening and have a good understanding of the engine, based on personal accounts. any time i have a non trivial problem, it is always a community member who is able to answer it

    i know dots is experimental, but couldn't they just give me something to get started with animation, data flow graph, dsp graph etc.. instead of TODO


    there should be a unity wiki where each person can edit and add stuff like what the localtoworld matrix is or how to add custom light probe functionality etc.
     

    Attached Files:

    Rewaken and hippocoder like this.
  7. bupkinfetch662

    bupkinfetch662

    Joined:
    May 17, 2020
    Posts:
    14
    omicron had some very interesting points to bring up and had very well thought out opinions that you knew came from a well learned unity user.
    don't know if it was trolling or what, but you could obviously tell he would listen to other people's opinions and just speak his mind and try to contribute to the conversation and admit when criticism for unity was well earned
     
    Last edited: May 17, 2020
    T0rp3d0 likes this.
  8. nxrighthere

    nxrighthere

    Joined:
    Mar 2, 2014
    Posts:
    567
    Keep in mind that the online services are available for any game engine that supports C/C++ or C#. (SDK provided for both, but C interface can be wrapped with almost any other popular programming language).
     
  9. discofhc

    discofhc

    Joined:
    Dec 18, 2017
    Posts:
    47
    Where is "The Heretic"? Again, they only released a minor part of it, just the character, without the full animations, etc. Maybe they will release some other separated minor part, as some scenario or another character. Just like they made with "Blacksmith", "Adam", "Book of the Dead".

    "Megacity" had a cool concept to be breathtaking, but i remember it as a mess and now it is already very outdated.

    "Sherman" was released on a zip file, it was outdated weeks later.

    "Spaceship" and "First Person Sample" are really good examples, for a change, hope they continue to update it, but i think they won´t.

    Why this happens with Unity? For sure Epic will release their UE5 Demo to the developers, complete, as they did with Infiltrator, Elemental, Shooter Template, even a Boy and his kite. The demos still working today, years later. And the engine changes a lot on every release.
     
    protopop, pm007 and pcg like this.
  10. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    He was banned for personal attacks in PM. Making another account does not absolve this. It is also against the rules entirely, to circumvent a ban.Thanks for understanding. This will not change.
     
  11. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    The problem with Unity's demos is that they do not scale. They are more what I imagine are movie presentations. This is important because for an engine to scale you need a single pipeline, strong LOD, H-LOD and systems need to know about each other. Unity relies on asset store for this so it is capped by asset store / your team budget. That is not very scalable at present. I think DOTS is their solution for that.

    Until that scaling becomes built in, and battle tested I do not think we can expect Unity's demos to translate to finished similar games in the same way. I have begged Unity until my fingers are blue on all these issues for years. I understand DOTS is the solution for it in the end.

    By contrast epic's demos translate to far better looking games in the end, for example Jedi Fallen Order. This is because the engine scales, has hlod, has all the things you actually need to build out a title and run it well. This does not mean Unity is bad, just targeting a different demographic like movies or mobile.

    Unfortunately until some major architectural changes take place (DOTS) and the supporting tooling is available (hlod etc), Unity will not be building titles like Jedi Fallen Order. I'm sorry but that's just a fact based on actual evidence, and the evidence is DOTS isn't finished and that game is in the stores with rave reviews.

    Please note, I am a major advocate for Unity. But am not a Kool Aid drinker. Ever.
     
    TeagansDad, pm007, GCatz and 4 others like this.
  12. discofhc

    discofhc

    Joined:
    Dec 18, 2017
    Posts:
    47
    Yes, this explains Why some great Studios made a really good game with Unity, but then choose UE4 for their next one. The struggle is real.
    Bloober Team made layers of fear with Unity, and then layers of fear 2, Observer and Blair witch on UE4.
    No code made observation (the best game i played last year), their next game is being made with UE4.
    LKA made city of light with Unity, then are making Martha is dead with UE4.
     
  13. bupkinfetch662

    bupkinfetch662

    Joined:
    May 17, 2020
    Posts:
    14
    that sounds like a very vague statement that means absolutely nothing.
    what do you mean by scale? if you copied the megacity demo 100x, it would still work, does that scale enough for you?
    the asset store primarily serves the purpose of giving alternatives for your niche, but there is no asset that is a necessity for your project
     
  14. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I prefer to deal with released production proven features when making comparisons. I hope that's a reasonable expectation?
     
    AlanMattano and angrypenguin like this.
  15. bupkinfetch662

    bupkinfetch662

    Joined:
    May 17, 2020
    Posts:
    14
    i think 95% of people only associate good graphics with unreal solely because of the name. unreal is a pretty good game engine name vs unity, but given an identical example of a scene made with ue4 vs unity, only the most astute of observers would be able to discern the difference

    same with asset store, they subconsciously associate the name with a thought
    asset store = money = bad
    package manager = potential errors = bad
     
  16. bupkinfetch662

    bupkinfetch662

    Joined:
    May 17, 2020
    Posts:
    14
    well ue 5 is neither released nor even proven, and it won't be until at least 2021
     
  17. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    And DOTS, when? Also it doesn't bother me if you make accounts to just reply here but it's unhealthy to do so.
     
  18. shredingskin

    shredingskin

    Joined:
    Nov 7, 2012
    Posts:
    242
    Unity seems to have a big disconnect in many ways.
    I've already talked about how they can turn out a ton of "templates" that at the end of the day most people won't end using for nothing, but struggle to get out a character template. At least seems like they are using the character template for the DOTS sample, so at least feel like themselves are having somewhat of cohesion.
    But it's on a lot of little things, like for example lightmapped lods, why are they on a github in the middle of who knows where ? Or their volumetric lighting,planar reflections (for built in) or the lightprobe volumes and lightprobe placer ? It's not that they don't work, it's just that having a random script that who knows if it will be deprecated tomorrow doesn't bring any security for anyone (this reminds me that for example the SNAPS packs they do use the same script with different GUID, so I have to replace all the missing references).
    The AutoLOD (and HLOD) has been in github for many years now, who knows if they will keep improving on it, make it part of the engine, an official package or just ditch it.

    I bet that when they release The Heretic, it will have hundreds of scripts tailored for the demo, with their own workflow in mind, but that would benefit everyone (like volume timeline actions). At some point they should really prioritize users and not marketing.
    Like great, you did a really cool movie, what does it means to the actual user ? (let's not even talk about releasing the assets under custom user agreements). Did anyone get something of out Unity saying they used a third party to scan a guy, then used another third party to rig him (hell, it doesn't even use the default humanoid rig). Will it be full of scripts that will only work for a cinematic ? Or half of them will be one use cases of how they managed to make a houdini mesh interact with a regular mesh ? Will it be full of scripts that replicate the "film template" themselves released ?
    It's about building a foundation and keep growing from there, having something solid to rely upon, but seems like Unity themselves are the ones reinventing the wheel everytime, and the end goal is just to make a marketing video.

    You can't even open the project on 2019.3, tell me more how good it scales.
    According to you unity should stop updating their engine, because a lot of the things they are working on have already assetstore solutions.
     
    elias_t, OCASM, thelebaron and 4 others like this.
  19. bupkinfetch662

    bupkinfetch662

    Joined:
    May 17, 2020
    Posts:
    14
    guessing 2021 as well, judging by unity's roadmap and when aspects of dots will be production ready


    you are very clearly completely inexperienced, do not at all know what you're talking about, and probably have never even written a line of dots code yet you talk as if you're a professional about how its <<unscalable>>

    very clearly biased towards unreal as well
     

    Attached Files:

  20. IllTemperedTunas

    IllTemperedTunas

    Joined:
    Aug 31, 2012
    Posts:
    782
    This highlights the pressing issue quite well. It is not a singular feature, or lack of functionality that is missing in the Unity Universe. It's a "state of mind". New tools on the horizon are great and all, but we are more confused and frustrated with what the future holds than ever, hobbyist to veteran.

    No strides have been even attempted by Unity in the absolute core problem of gamedev: making it something approachable. It's not JUST the lack of pipeline in their engine, but elsewhere to foster these technical skills and knowhow. Over a DECADE in this industry, and they have not just learned nothing, they have regressed.

    When DOTS is finally in a shippeable state, how do they reach us? How do they plug the community in and help us help ourselves learn and utilize this tech. Each and every asset they sell would benefit from guidelines and standardizations in tutorials and documentation. The users and content creators are the greatest untapped resource of Unity. This thread is a testament to that.

    There are many barriers to making a game, most of which is knowledge. To make a good game you need to see through the smoke and mirrors and understand the tech. You need resources to shape this tech while your are passionate, while the iron is hot. Knowing the computer power is out there, the functionality is out there to do what you want to do, and has been done in thousands of games, but having 0 resources is gutting.

    Unity where is your Brakeys video for how to use the mecanim system? A system that is VERY GOOD, stable, and not going anywhere. Why haven't you invested on getting the word out on your finished and solid functionality?

    Here's my challenge to anyone reading this at Unity. Tie together a next level tutorial series with Brakeys where he does a game jam on inventive use of your Mecanim system. Then do 3 followup episodes where he dissects the best submissions and shows how amazing your tools are for a variety of projects. Pay the best projects a 1k prize and release each one for free on the asset store, standardize the competition on the current release version of Unity. Make a few asset backs that have animations and models free during this time (you will recoupe your loss many times over by getting people excited about animations packages)

    Create a PIPELINE for LEARNING. Not everyone is a content creator, some people have the skills to build not to teach, some people have more personality than skills. Can we work on fostering a community that uses the best of our talents to create the best gamedev user base ever?

    You might think "Asking a significant enough portion of our users to compete in an animation system competition is asking a bit much." And that is exactly the point.

    Unity has been in the business of smoke and mirrors for too long, both expecting its developers to watch their fancy trailers like pedestrians and think they will get the same functionality out of the box, while also assuming we will create vital tech and sell it on the asset store.

    Feels like they want us to sell the snake oil for them.

    There is no high-level strategy to their business model, they lucked out on being in the right place at the right time and have done little with that position since. Their every action is designed to nickle and dime a user base with storefronts that barely integrate with their services, and in no way foster the creation of better and key tools to bolster their own engine and business model.

    What does Unreal's business model say to it's users?
    "We believe in you, and we are successful enough in creating top tier product we aren't even interested in nickle and diming you. But we're going to give you our tools for free, because in the off chance one of our hundreds of thousands of users creates that diamond in the rough, the next minecraft, it doesn't matter if we nickle and dimed. We know our business, and that's to sell rock solid games that make billions of dollars. We're not going to thin our resources chasing waterfalls, -err storefront water shaders."

    You know what would be cool? Some sort of documentary series on a small team that created a key plugin like amplify shader, NGUI, shadergraph, shaderforge, Bolt, etc. Where are these people from? How did they find Unity? How did they develop their unique skills that allowed them to puncture the market? How did they come up with the idea to create their assets? I'm not saying this in a sense of making a fluff piece to feign interesting in your community. I'm saying if Unity gave a damn about the process and fostering that process of tech and the people behind it, and they started many years ago, we'd be looking at a completely different gamedev landscape.

    Instead we're just a massive throng of neckbeards sitting in our caves screaming at a cold, faceless forum. For too long gamedev has been this closely guarded secret, a dark ritual hidden behind tech companies and NDA's. Knowledge of pipelines is universally seen as company secrets. Unity is in the unique position to righteously move forward with spreading the gamedev gospel as it boons both them AND their user. And they have done increasingly NOTHING in this cause. Whether you're a new user or advanced user, no communal learning structure has been fostered. There are so many FREE and universal tools to aide with this. Youtube, itch.io, discord, etc, etc. And they have not even made an attempt to expand upon the core spirit of their platform, when they have hundreds of thousands of passionate developers who would jump at the chance to make their engine more usable.

    Thousands of the most talented, hard working, tech savvy people in the world, who would work simply to better the medium and platform they hold so dear (and maybe for a little exposure for their indie game) squandered.

     
    Last edited: May 17, 2020
    elias_t, tyrot, arkano22 and 5 others like this.
  21. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I was talking about current Unity, not dots. If you search you'll find me talking about dots, sharing dots resources and talking about how that scales, going back a year or more :)

    It's just not here yet though. You point the finger at everyone else being inexperienced but it is you that isn't seeing the value of production proven and actually tested/released code. Something like DOTS would need years on top still, after release. Unity knows this. Take time to read.
     
    LIVENDA_LABS likes this.
  22. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,554
    I feel like there's sarcasm tag missing.

    Additionally given that the user created sock puppet account before, they'll be likely doing it again and probably already did that. Anyway, this is not my problem.
    ------

    C++ has higher level of bug prevention features compared to C#. The things you'd be looking for are primarily const correctness and ability to mark any argument object as read only with compile error when you try to alter its state. Basically, the enemy of multithreading is side-effects, and C++ has more features that exterminate side effects.

    This is pretty much on par with what functional languages offer, although this is optional, and does require discipline and understanding. C# lacks those features, and that's why Immutability is popular in it.

    If there are additional primitives needed to make multithreading safer, I'd need to hear what they are. As I'm not all knowing and can be missing information.

    Additionally, one thing about megacity demo, is that in situation where you need huge number of objects, the normal things to do is to reduce agency of objects and turn them from polymorphed agents into a particle system and array of flat data with no methods. This is pretty much how titles like Ultimate Epic Battle Simulator work. So, having ton of cars is not that great.... but if you, say could enter every car, interact with its interior and have a different unique driver, or enter every apartment in every building, that would be quite amazing.
     
    Last edited: May 17, 2020
  23. bupkinfetch662

    bupkinfetch662

    Joined:
    May 17, 2020
    Posts:
    14
    did you know that C# too has the const keyword and you are in fact also able to pass variables by const reference into functions?

    anyway you don't, cause you have no idea what you're talking about and just making blind attacks at unity

    also how the cars are implemented in megacity, that's absolutely something you could do very easily, just add extra functionality to the car prefab, or the building or whatever.
     
  24. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,554
    This indicates that you're most likely recently banned Omicron and little else.
    Getting angry and switching to insults reduces your credibility.

    Regarding const references in C#:
    https://blog.dunnhq.com/index.php/2017/12/15/readonly-parameters-in-c-a-step-closer-to-immutability/
    Not quite the same thing.
    I'm also not seeing const methods, which are a part of the whole deal and are very important.
    https://stackoverflow.com/questions/3799062/const-methods-in-c-sharp
    If you're talking about C++ const, you are supposed to be aware what const methods are. There's also matter of constexpr, templates being more powerful than C# generics, but that's story for another time.

    Regarding "blind attacks at unity", have very good idea of what I'm talking about, and are familiar with shortcomings with both unity and unreal.

    I know problems with unreal API, the thing is, in the long term other benefits can outweigh having to deal with messier code. This has been discussed few pages ago as well.
     
  25. bupkinfetch662

    bupkinfetch662

    Joined:
    May 17, 2020
    Posts:
    14
    I haven't even once doubted that dots is not up for release. it is you who are comparing present day dots with eu5 and how eu5 is so much superior
    you haven't posted in the dots forum at all for the past year apart from the questions about visual scripting
     
  26. bupkinfetch662

    bupkinfetch662

    Joined:
    May 17, 2020
    Posts:
    14
    i know what the constexpress keyword is
    and anyway
    Code (CSharp):
    1. void MyFunc(const int& variable) {
    2.  
    3. }
    would be

    Code (CSharp):
    1. void MyFunc(in int variable) {
    2.  
    3. }
    in c#, functionally they're identical. but C# has several keywords for all the different ways you can use const in C++
     
  27. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,554
    That is incorrect and you didn't read the link I provided. The link lists the difference between C# in and C++ const.
    You also can't do
    Code (csharp):
    1.  
    2. class Test{
    3.      int myMethod() const{
    4.      }
    5. }
    6.  
    In C#, which is a whole point of const correctness.
     
  28. bupkinfetch662

    bupkinfetch662

    Joined:
    May 17, 2020
    Posts:
    14


    yes that's what the in keyword does. you won't be able to change object properties without
    it throwing a warning

    there's also get / set stuff
     

    Attached Files:

    Last edited: May 17, 2020
  29. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,554
    You've successfully demonstrated that it is completely different from C++ const.

    In C++ this results in a compile error and makes compilation of the project fail.

    And get/set does not prevent you from accidentally altering object's state from within getter/setter, which is what const methods are for.

    Those principles are important, because when applied to systematic fashion they provide an iron guarantee, that "in this function, state of this object does not change".

    Anyway.

    You appear to be feeling strongly about things and believing in them. However, emotions and faith cannot be used to replace knowledge. If you have knowledge, you can demonstrate it. Getting angry is not very useful.

    Have fun.
     
  30. bupkinfetch662

    bupkinfetch662

    Joined:
    May 17, 2020
    Posts:
    14
    ok so what that it throws a warning that it won't work vs not compiling

    C# burst compiler actually makes great strides in its compiler in that it will throw errors if you code is not thread safe and won't vectorise. so you won't unwittingly make multi threaded code that produces race conditions making it slower than single threaded
     
  31. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,616
    Getting a bit off topic, but anyway...
    Sure, but as a software designer I'm confident that you know that having more features is not the same as being better. The C++ approach is to keep adding more and more stuff, with the (reasonable enough) rationale that people don't need to use the things that don't benefit them. C# takes the (also reasonable) approach of avoiding stuff if the designers think it'll make more challenges than it'll commonly solve.

    For instance, multiple inheritance can be useful, but it can also be a trap. C++ supports it, C# deliberately does not, and you could frame that absence of a feature (or the presence of Interfaces, which are deliberately limited in comparison to multiple inheritance) as a "bug prevention" measure. Same deal with the deliberate absence of pointers.

    That aside, at times I would personally love C# to have an equivalent to const in particular.

    That's a big difference, though. Plenty of programmers don't worry about warnings. The compiler refusing to do something is quite different to a quiet and polite request that you please maybe reconsider, if you've got the time...
     
    SunnySunshine likes this.
  32. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,554
    It means you have a lot to learn when it comes to C++ programming.

    For the sake of completeness, I'll explain.

    Const keywords are safeguards that you place so compiler can prevent you from breaking your own code.
    "By my royal decree, this function will never alter internal object state". "By my royal decree this parameter will never be modifier from within functions". This stuff becomes very important when your project/programs grows and reaches size of several megabytes (or several dozen megabytes, or several hundred megabytes) because at this point you can no longer keep it all in your head.

    const method indicates that "this method cannot change state of hte object".
    And when you use const references, the only methods that you can call are const methods.
    It is not an "advice" or "warning" it is a "rule".

    In time, systematically applying const correctness rule, you create safety net, which clearly indicates that "those functions could not have altered the object". So, when you have an unexpected change in object state, you can very quickly narrow down your search to the locatiosn which are allowed to alter the object in the first place. Compiler and discipline also prevents you to creating accidental bugs and wrecking object's internal state unless you intended to do so. You can't wreck thigns by accident, because you told compiler you should not be allowed to.

    C# lacks this.

    Any function that takes reference value can wreck its internal state.
    Any class method can wreck itnernal state of a class as well when called. You have no warranty that "this function does not alter class state", they all possibly do.
    "In" is not transparent in this regard, because it apparently occasionally silently creates a copy, meaning you can still create yourself a heisenbug by calling a method on the copy instead of original and forgetting about it.

    And that's why C# has concept of immutability rather than C++'s Rule of the Three/Five/Zero and const correctness, however, immutability in a language that invests heavily into reference types and has GC is not a good thing, as it produces garbage, which results in non-deterministic performance problems in your game.

    So, when you're doing C++ programming, you can already have a LOT of tools to make your code bulletproof. In C# you have less tools. In C# you also have less control over object destruction and lifetimes, and that's why unity went with custom API/dialect to dance around this problem with Dots.

    Why not add a C++ api is something to wonder about.

    Either way you'll have to continue discussing this with someone else.
     
    Last edited: May 17, 2020
    tatoforever and angrypenguin like this.
  33. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,554
    I don't want a language war here.

    But from my position, C++ const correctness thing is one I always miss having when dealing with C# code. You don't exactly need to bring the rest of the C++ into the language, but this particular one has a huge benefit. The other useful one is deterministic lifetimes, by the way.

    C# does have cool features of its own. Extension methods are brilliant, in my opinion.
    The other thing I liked in C# is coroutines and C++ already integrated those.

    In the end, at least C# is not Python. Thank Cthulhu or whoever for that...
     
    Ramobo, xVergilx and angrypenguin like this.
  34. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,616
    Nor do I, and I think we're both mature enough to not go down that path.

    I was specifically talking about the comparison being based on number of features. I just don't think that's a practical way to look at it, especially considering the fundamentally different attitudes underlying the design of each language.

    Edit:
    Though I don't understand this one. I also find coroutines useful, but I was under the impression that they're Unity-specific?
     
    neginfinity likes this.
  35. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,554
    Yep. Been there, done that, too many times, and probably you and me both.

    They're not. "Coroutines" are generator expressions that produce a potentially infinite stream of values you can pull from without explicitly creating a temporary storage object. Their important property is that they can resume execution from point after returning value. I can't list all languages where they exist, but they exist in Python and are called generators:

    Code (csharp):
    1.  
    2. def firstn(n):
    3.     num = 0
    4.     while num < n:
    5.         yield num ## <-- Bet this looks familiar.
    6.         num += 1
    7.  
    8. sum_of_first_n = sum(firstn(1000000))
    9.  
    In C++ they're called coroutines.
    https://en.cppreference.com/w/cpp/language/coroutines
    Code (csharp):
    1.  
    2. generator<int> iota(int n = 0) {
    3.   while(true)
    4.    co_yield n++;
    5. }
    6.  
    And in C# outside of unity:
    https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/yield
    https://www.dotnetperls.com/yield
    Code (csharp):
    1.  
    2.  
    3. using System;
    4. using System.Collections.Generic;
    5.  
    6. public class Program
    7. {
    8.     static void Main()
    9.     {
    10.         // Part A: compute powers of two with the exponent of 30.
    11.         foreach (int value in ComputePower(2, 30))
    12.         {
    13.             Console.Write(value);
    14.             Console.Write(" ");
    15.         }
    16.         Console.WriteLine();
    17.     }
    18.  
    19.     public static IEnumerable<int> ComputePower(int number, int exponent)
    20.     {
    21.         // Part B: continue loop until the exponent count is reached.
    22.         // ... Yield the current result.
    23.         int exponentNum = 0;
    24.         int numberResult = 1;
    25.         while (exponentNum < exponent)
    26.         {
    27.             // Multiply the result.
    28.             numberResult *= number;
    29.             exponentNum++;
    30.             // Return the result with yield.
    31.             yield return numberResult;
    32.         }
    33.     }
    34. }
    35.  
    Basically, what happens is that generator/coroutine is allowed to return value, and then resume execution afterwards. This requires some imteresting gymnastics, because generator function can have local variables, and those need to be stored somewhere while it iterates or remains in suspended state. I think this is usually solved by turning generator function into an anonymous class.

    What unity did when turning Generators into Unity Coroutines is basically an interesting hack. They exploited generator ability to resume execution, and used yield return as a way to wait for the next frame. They also recognize situation where another generator is returned, which is how sub-coroutines work. The whole coroutine mechanism can be quickly implemented from scratc has a list of stack of IEnumerators.

    I think that should basically explain it.

    -------

    One interesting application of Coroutines I found is in text parsing. For example, it is normal for a parser to build a tree or list of tokens, then pass it on to lexer/etc as a list. By performing parsing via coroutines you can simply implement each stage as a coroutine/generator function which yield returns relevant info to the level above it. So at the bottom level a function will be scanning text for identifier, and then yield returns it to the level above it where higher level routine decides whether they make sense or not. It was a fairly clean approach.
     
    Last edited: May 17, 2020
    Lagermeister likes this.
  36. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,616
    Yeah, this is one of the early things I looked into with Unity. Definitely useful in video games, since sequencing things is a really common activity which can otherwise take up oodles of error-prone code.
     
  37. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,891
    Current hardware is extremely powerful and woefully underutilized. Most existing code runs in a single vector unit of a single core. In a 4 core cpu with SSE4 instruction set that’s 1/16 of the speed you could reach. Not to mention that most programmers rely on pure luck for good cache utilization, and many aren’t even aware of its impact on performance.

    To get DOTS performance with C++, you need to write your own job-stealing threadpool and be ready to wrestle with simd intrinsics. Both are incredibly hard to get right. Why do I know? Because I did. Then went back to DOTS for ease of maintenance.
     
    Last edited: May 17, 2020
    tatoforever, Shizola, OCASM and 9 others like this.
  38. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,554
    I would need to test that. No offense.

    You have much higher credibility than the "dots fan with many accounts", but this also falls under category of the problems where I'd need to place down the rake myself and step on it repeatedly myself to make sure it works in the expected way.
     
    EternalAmbiguity and hippocoder like this.
  39. MDADigital

    MDADigital

    Joined:
    Apr 18, 2020
    Posts:
    2,198
    Any thougts on porting Obi to jobs? :)
     
  40. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,891
    Pretty much done. Refactoring/optimization/testing now.
     
    OCASM and MDADigital like this.
  41. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    1,891
    None taken :). I had to figure this out the hard way myself. DOTS performance in C++ is reachable, but only worth the pain if you don’t have DOTS available. Wouldn’t have appreciated it the way I do if my background was any other, I’m afraid.
     
    neginfinity and JoNax97 like this.
  42. MDADigital

    MDADigital

    Joined:
    Apr 18, 2020
    Posts:
    2,198
    Nice, it will also scale better with other unity jobs than doing your own multithreading separate from unity. How is performance vs your native code version?
     
  43. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Off topic ... please move DOTS to another thread, this is mostly about rendering here, and the perceived workflow advantages etc.
     
    LIVENDA_LABS and arkano22 like this.
  44. VeganApps

    VeganApps

    Joined:
    Jun 30, 2006
    Posts:
    263
    TL;DR

    Nanite's mesh shading also means to download 50 TB of game data instead of 50 GB. This is going to kill our internet and the nature.
     
  45. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    Im slowly going to start learning unreal after I finish my current projects
     
    tyrot likes this.
  46. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,964
    Clearly you haven't used C++ in years any more than I have. You made it sound like it was difficult so on a hunch based on past conversations with @neginfinity I went searching to verify if that was the case and very quick discovered that it hasn't been the case for at least three years. Lines 58 to 60 show how easy it is to create a parallel for each in C++.

    Code (csharp):
    1. // parallel-fibonacci.cpp
    2. // compile with: /EHsc
    3. #include <windows.h>
    4. #include <ppl.h>
    5. #include <concurrent_vector.h>
    6. #include <array>
    7. #include <vector>
    8. #include <tuple>
    9. #include <algorithm>
    10. #include <iostream>
    11.  
    12. using namespace concurrency;
    13. using namespace std;
    14.  
    15. // Calls the provided work function and returns the number of milliseconds
    16. // that it takes to call that function.
    17. template <class Function>
    18. __int64 time_call(Function&& f)
    19. {
    20.    __int64 begin = GetTickCount();
    21.    f();
    22.    return GetTickCount() - begin;
    23. }
    24.  
    25. // Computes the nth Fibonacci number.
    26. int fibonacci(int n)
    27. {
    28.    if(n < 2)
    29.       return n;
    30.    return fibonacci(n-1) + fibonacci(n-2);
    31. }
    32.  
    33. int wmain()
    34. {
    35.    __int64 elapsed;
    36.  
    37.    // An array of Fibonacci numbers to compute.
    38.    array<int, 4> a = { 24, 26, 41, 42 };
    39.  
    40.    // The results of the serial computation.
    41.    vector<tuple<int,int>> results1;
    42.  
    43.    // The results of the parallel computation.
    44.    concurrent_vector<tuple<int,int>> results2;
    45.  
    46.    // Use the for_each algorithm to compute the results serially.
    47.    elapsed = time_call([&]
    48.    {
    49.       for_each (begin(a), end(a), [&](int n) {
    50.          results1.push_back(make_tuple(n, fibonacci(n)));
    51.       });
    52.    });
    53.    wcout << L"serial time: " << elapsed << L" ms" << endl;
    54.  
    55.    // Use the parallel_for_each algorithm to perform the same task.
    56.    elapsed = time_call([&]
    57.    {
    58.       parallel_for_each (begin(a), end(a), [&](int n) {
    59.          results2.push_back(make_tuple(n, fibonacci(n)));
    60.       });
    61.  
    62.       // Because parallel_for_each acts concurrently, the results do not
    63.       // have a pre-determined order. Sort the concurrent_vector object
    64.       // so that the results match the serial version.
    65.       sort(begin(results2), end(results2));
    66.    });
    67.    wcout << L"parallel time: " << elapsed << L" ms" << endl << endl;
    68.  
    69.    // Print the results.
    70.    for_each (begin(results2), end(results2), [](tuple<int,int>& pair) {
    71.       wcout << L"fib(" << get<0>(pair) << L"): " << get<1>(pair) << endl;
    72.    });
    73. }

    Speaking of workflow advantages C# was a major workflow advantage for Unity (the other languages didn't truly bring enough of a workflow advantage which is ultimately why they died off), but between C++ rapidly becoming easier and the complexity of DOTS compared to MonoBehaviours any programming workflow advantages are rapidly disappearing.
     
    Last edited: May 17, 2020
    Aiursrage2k and nxrighthere like this.
  47. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,589
    Unreal dev responded to a download size question with:
    https://twitter.com/gwihlidal/status/1260597164318711808?s=20

    Whatever this means specifically will we learn eventually.
     
  48. valarnur

    valarnur

    Joined:
    Apr 7, 2019
    Posts:
    438
    In what ways is C++ becoming easier?
     
  49. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,964
    valarnur likes this.
  50. Raive

    Raive

    Joined:
    Jan 6, 2013
    Posts:
    20
Thread Status:
Not open for further replies.