Search Unity

Xamarin now free (and supposedly open source)

Discussion in 'General Discussion' started by Acissathar, Mar 31, 2016.

  1. MV10

    MV10

    Joined:
    Nov 6, 2015
    Posts:
    1,889
    Of course, and I've written plenty of code in my life to do just that (though I'd typically say "caching" rather than "pooling" -- to me "pooling" has overtones which relate more to connectivity reuse from my socket, DCOM, and DB / LDAP days). But there are plenty of code scenarios where it literally doesn't matter at all, and since Unity is so hyper-sensitive to allocations and GC, it seems like something that would at least warrant a mention here and there.

    But similar to Hippo's comment, I see the tutorials as a way to hook newcomers long enough that they can find their way around and figure out how to do things right. They'd probably lose too many people if those tutorials were "done right".
     
    Kiwasi likes this.
  2. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    I still don't see any of this as an excuse for Unity not to upgrade its GC system, if there is a path for it to do so. And the sooner the better.
     
    darkhog likes this.
  3. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I didn't mention culling. Octree has nothing to do with culling. It's about fast lookup of objects to a criteria, for example you need to know all the enemies in this area? or maybe you want to store a ton of items in a certain location but only want to spawn them when you get near? or for AI etc... it's just a structure, but something I think many people abuse physx for or just brute force solve, and that's not really good for them.
     
    Kiwasi likes this.
  4. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    This is something i made by code , some 2D array updated as enemies move around , store them on the right array space based on their position.
    Anyway having octree in the engine as C++ , and have some option to enable it in the engine with some parameters, than have the engine dealing with octree automatically and having exposed octree functions would be usefull , there is many uses like streaming also.

    Octree has nothing to do with physics ?
     
  5. pointcache

    pointcache

    Joined:
    Sep 22, 2012
    Posts:
    579
    agree adding to that also the messaging on which unity is built (update method ets) also are done with same approach in mind, if they would require user to actually use override and interfaces it would be harder to get newbs to grasp easily,
    but the tradeoff is 5x more overhead from Update than from a cached delegate invocation. I tested.
     
  6. pointcache

    pointcache

    Joined:
    Sep 22, 2012
    Posts:
    579
    Physics.Overlap sphere
    and ofc it has, since all physics colliders etc all are cached in trees under the hood.
     
    zenGarden likes this.
  7. pointcache

    pointcache

    Joined:
    Sep 22, 2012
    Posts:
    579
    from my experience with octree it is ineficient to build generic version of them, you will lose a lot of extensibility and performance. Performance wise you would take simple generic version and adapt it to particular situation,
    that said you can search github for unity octree, which is exactly that.
     
  8. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    Even if you don't want to release a game there, you still use it to benchmark IL2CPP vs Mono vs .NET on desktop (which was why I pointed it out, as it was claimed that you couldn't benchmark IL2CPP on desktop).
     
    pointcache likes this.
  9. pointcache

    pointcache

    Joined:
    Sep 22, 2012
    Posts:
    579
    Thanks i will actually try it.
     
  10. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    You mean we can use Unity in engine Octree system for our own needs ?
    Anyway i found many implementations :
    https://github.com/Nition/UnityOctree
    https://github.com/Pixelstudio/Octree
    http://stagpoint.com/forums/threads/octree-for-unity.13/
    I'll dig these and see what i can use for personnal needs.
     
  11. pointcache

    pointcache

    Joined:
    Sep 22, 2012
    Posts:
    579
    well if you do stuff like OnCollisionEnter etc, its sort of using the octree of physics engine to your own advantage, more relevant example is OverlapSphere which gives speed results comparable to octree search so its fast (but not as a well optimized octree for single object type, because they as far as i understand have to store and process a lot more info).
    Here are examples of what you can do with optimized octree that i did

    here using sphere overlap -

    notice that the lag comes only when the simultaneous collision count and their chained calculations (i.e. 100 cubes each affect all other 100 cubes at the same time) but the actual lookup speed is good

    another cool thing


    here its octree, each cube is a separate local event system that does look up for surrounding event systems and is extremely fast, as in 10k objects lookup is the fastest out of all means. Here the lag comes from using DOT tween for material animation, which was a mistake i did not realized at the time.


    octrees are awesome for complex things and huge scale games, however they again need subtle optimizations to be really efficient, since insertion /removal can dramatically slow it down if not done smart, as well as in node distance calculation method.
     
    zenGarden likes this.
  12. zezba9000

    zezba9000

    Joined:
    Sep 28, 2010
    Posts:
    985
    Mono's AOT system that runs on all iOS devices right now, .NET's lilac MSIL to LLVM AOT system.

    Mono has had AOT support for ARM64 devices before IL2CPP did, so I'm not sure what you're trying to say...
     
  13. pointcache

    pointcache

    Joined:
    Sep 22, 2012
    Posts:
    579
    zenGarden likes this.
  14. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    (Yes - please keep on topic, ranting is really drifting - make new threads for new soapboxes)
     
  15. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    lol that's rich.. I somehow went offtopic..its been offtopic for the past 2 pages.. jeez hippo
     
  16. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Ranting puts it over the edge. Get back on topic everyone.
     
  17. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    There is nothing more to discuss about Xamarin, Unity is aware, let's see if something will happen ?
    Anyway some off topic was more usefull and very informative and somewhat on track because it is about performance.
     
  18. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Yep but forum rules can only support so much drift. When it turns ugly, it stops.
     
  19. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    What it is uggly ? This is informayion sharing, usefull.
     
  20. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    I'll find somewhere to dump that rant again sooner or later hippo..my rants should be left untouched I wouldn't bother posting them if they had no point to be made, so don't get to carried away with that moderating.
     
    darkhog likes this.
  21. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,147
    Isn't that what blogs are for? ;)
     
    Kiwasi likes this.
  22. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    I dunno why you would ask me that knowing such discussion would be derailing this highly ontopic of xamarins blog thread/performance/etc/ etc/ but no Unity rants allowed thread.. I guess its ok to derail topics on passive nonsense but not critical points.
     
    darkhog likes this.
  23. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,735
    By Majority you mean 4 out of 11?

    But yeah, point taken, IL2CPP is an evolving thing... Only I don't see it evolving all that fast (numbers? stats? anyone? I haven't noticed it getting much faster with time) and Mono performance would increase too though, it's just that Unity isn't updating it. (for reasons that are no longer valid).

    And maybe IL2CPP has the potential to become much much faster all around even than the latest mono, but when will Unity get there? How many years?

    EDIT:

    Okay, in the end I don't care. They should do what they think is best. If the think IL2CPP is the way to go, they should (are doing) do that.

    I want to say I trust them to do the right thing, but I guess I don't, it's the same company that decided to go with enlighten after all, but that's another story that has been already told many many times.
     
  24. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Will we really gain a performance boost ?
    Unity 5.4 is a huge step in the right direction with threading and instanciation, and i think Unity should keep working in that direction bringing new features that brings performance instead of betting too much in IL2CPP.
    Some examples from UE4 GDC :
    - animation threading and update rate at lower rates for distant characters, skip interpolation for distant meshes, update separate populations
    -per LOD limit
    - Custom physic solver faster than Physix used for characters items for example
    - Apex per character cloth budget and moved to threading
    - reduce tick manager for some objects or use time manager
    - improve particles initialisations
    -HLOD to merge meshes and materials and bake material attributes
    - capsule shadow maps
    - particles alpha cut out
    - SSS per vertex possibility etc ...
    I think there is lot of room for improvments that could be done first and that are not related to language.
     
  25. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    I know Mono has one but I did not say iOS, I said all AOT platforms which may include iOS but also such as WebGL and consoles? lilac AOT was only in planned stated when it was open sourced and that's not too long ago.
     
  26. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    Totally different people work on those things, though...
     
  27. MV10

    MV10

    Joined:
    Nov 6, 2015
    Posts:
    1,889
    Which would be a valid point if all open issues and roadmapped projects had people assigned to them...
     
  28. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    Here is some food for thought. Everyone I think is making the mistake of treating Mono and IL2CPP as completely separate entities. IL2CPP is a compiler (or transpiler maybe) that essentially converts the IL generated by .NET / Mono into native code.

    Getting IL2CPP onto all platforms really is a move in the direction of updating the .NET Runtime. Unity have said it previously themselves. Once IL2CPP has been updated to all platforms, the .NET Profile can be updated as well (which also means updating IL2CPP to support the new profile so it's a long process).

    Edit: While this was a bit off topic, trees like Octree are methods of special partitioning which is why they are unrelated to specific things like culling or physics. They are just tools. A Quad Tree is another kind of tree that just uses x, z and not y so it partitions in 2D space.

    I gave a .NET user group presentation on spatial partitioning to solve business problems. For example a taxy company with 2000 taxies needs to know how many taxies are in a certain area. They could ping all 2000 taxies and ask for their location and then do distance math, or they could have taxies register and deregister with nodes in a quad tree. They use super fast self-culling lookups to find which node(s) encompass the desired area and then all the taxis in that container are what they're looking for.

    If you have Silverlight installed (this was an old demo), I built an example application that shows quad trees being used. Load it up and check the "Show quad division" box in the upper left corner. Move your mouse around the map to see the quad divisions and taxis found. In the upper right it shows you the number of queries (i.e. it might e 2 instead of 2000).

    http://www.dustinhorne.com/quadtreedemo.html
     
    Last edited: Apr 3, 2016
  29. MV10

    MV10

    Joined:
    Nov 6, 2015
    Posts:
    1,889
    Since IL2CPP is of limited usefulness now (at best), it would seem to make a lot more sense to switch the .NET platform first, which I think is the point a lot of people have been trying to make. I agree they aren't independent, but to me it looks like a lot of throw-away work to build so many dependencies on something that is already outdated.
     
  30. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Well we'll have to wait for Unity to say something about it. We don't know the facts, but Unity probably does. What if IL2CPP is still faster? What if .NET for whatever reason can't be massaged to run on target platform?

    Unity's made blunders before like supporting Flash, then sunsetting it. If it turns out there isn't a speed gain from IL2CPP and there is no reason to go C++ first, then, obviously, IL2CPP is pointless.

    But if Unity blogged about it recently saying IL2CPP is going ahead regardless, we should be asking WHY not telling them NOT to. Because we don't have the facts and they do.

    If it turns out there are consoles or devices NET just can't reach at the same performance then it's very clear.

    So Unity, why still IL2CPP?
     
  31. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    Maybe @JoshPeterson can comment something or maybe they have not yet gone through everything in detail with all the options they now have available with the latest changes.
     
  32. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    I think I can tell you some of the reasons.

    1. Portability. Historically, porting Mono to new platforms was a real pain that often took many man months. Unity usually starts supporting a new platform long before Mono does, and sometimes some platforms never become officially supported by Mono. Porting things like JIT to a new CPU architecture is no small feat. On the other hand, IL2CPP was built from the ground up to be as portable as possible. It takes around a week to get a new platform running on IL2CPP - all platforms have C++ compilers, and to get a platform running on it all we need to do is implement a small set of platform specific APIs that IL2CPP can use to talk to the OS. Finally, there are some platforms we support that will never be able to run Mono.

    2. Managed code performance. We believe that IL2CPP can (and is, most of the times) have better performance and lower memory footprint than Mono. It will only get better in the future.

    3. Interop performance. Managed -> Native (and vice versa) transitions are practically free on IL2CPP. This is a huge deal for an engine like Unity, where native code and scripting engine are so closely intertwined. Considering most of the time spent in scripting in games is usually spent calling UnityEngine APIs, a non-trivial amount of time of that is interop transitions.

    4. Maintainability and customizability. IL2CPP has proved to be much more maintainable than Mono is today and this allows us to better customize it and take more shortcuts to improve its interactions with the engine.

    5. Stability. IL2CPP was built stability in mind, and it has a test suite that's much, much bigger than what Mono ever had. This allows to move fast and change things the way we need to without fearing of breaking our customers. Fun fact: we have 12 times more active bugs on Mono versus IL2CPP.

    Lastly, let me make this clear since there are some posts that seem to have this false idea: IL2CPP is not preventing us from upgrading .NET profile. On the contrary - it makes it easier due to the fact that we don't have to port new Mono to the bazillion platforms we support - instead we now only need to support it on desktop platforms, which it already supports.
     
  33. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    How faster can it be from .Net ? Is there some early performance tests ?
    For PC games i am not sure it will make a real difference.

    So when IL2CPP can be expected to come for PC games ? end of year ?
    Or can we expect some updraging .Net soon perhaps ?
     
  34. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    It really depends on what. Stuff like math heavy computations can be much faster. Stuff like virtual calls will not be any faster, since that's a slow operation by definition and you cannot do anything about it. It will probably not make a huge difference for PC games, since PC games are rarely script performance bound anyway.

    No ETA on that.

    Did you miss the blog post? We're working on it.
     
    Ryiah and landon912 like this.
  35. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    I'm not an expert, so does this mean a better garbage collector for PC games?
     
  36. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    Eventually, for all platforms.
     
    AcidArrow, Velo222, Ryiah and 2 others like this.
  37. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Certainly, and this is something missed by most benchmarks. I'm guessing it will lead to faster code under the hood in the long term such as not having to copy data so much, and kind of work on the same piece of data the engine would.
     
    AcidArrow and landon912 like this.
  38. landon912

    landon912

    Joined:
    Nov 8, 2011
    Posts:
    1,579
    Agreed, the 1000 Update() blog post really showed just how bad this is. A staggering amount is spent in the interop service. It will be a great day when this is gone.
     
    Ryiah and hippocoder like this.
  39. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    The original post explaining why IL2CPP was being created was that Unity did not want to upgrade the .NET profile on any one platform until they could do it on iOS, and at the time, the only way to do it on iOS without paying Xamarin was to write their own runtime. And the current timeline says that the .NET upgrade will not even be considered until IL2CPP is done. I don't necessarily disagree with that decision, since having wildly different .NET versions on different platforms would be confusing. But that means IL2CPP is, in fact, preventing you from upgrading the .NET profile.
     
    JaredThirsk, darkhog and MV10 like this.
  40. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    But if they didn't have it, some platforms would be quite unavailable. Overall this is faster progression.
     
    angrypenguin likes this.
  41. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    They could now go back to using Mono on iOS, and use an existing tool to convert .NET into WebGL. I mean, iOS has always worked without IL2CPP, and the only reason they need it for WebGL is as an intermediate step in the conversion from .NET to WebGL where they are already including a chain of third party cross-compilers anyway.
     
    Qbit86 likes this.
  42. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    It's not just for WebGL though. At some point, you hit platforms which need to be fed C++.
     
    Ryiah likes this.
  43. Ippokratis

    Ippokratis

    Joined:
    Oct 13, 2008
    Posts:
    1,521
    I seriously doubt that the news of Xamarin acquisition and subsequent licensing consequences arrived to Unity at the same time they arrived to us. They probably arrived earlier, since they are a strong player in the industry. Chances are, bright minded engineers, marketing directors etc, had the time to weight the options and select a strategy. For some reasons explained above, this strategy includes both IL2CPP and incorporating the latest mono. I am not a big fun of IL2CPP myself, especially the slow compile times it gives drive me nuts. But it is useful now, might prove even more useful soon and does not halt integration of the latest mono. It seems like we have some good news, why not enjoying it ?
     
    Kiwasi likes this.
  44. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    I don't think there is anything that needs C++ itself; there are just platforms that need native code and have libraries written in C++, like PlayStation. But that is what Mono and MS .NET runtimes are; they run natively and convert .NET IL into native code and run it natively. I think any future platform that is invented is going to have support from multiple languages pretty quickly.

    I mean, if someone from Unity gave a reason they "needed" it then I would (probably) stop whining. ;) But the Unity post above is just about how, theoretically, given time, it might, theoretically, be faster, more stable, and more portable than everything Microsoft and Xamarin develop in the future. I just don't have that much faith, nor do I think it's a good use of Unity's time. I don't mean this as a knock to Unity devs. I don't think any major software company is going to be able to write a .NET runtime that's faster, more stable, and more portable than the one that will come from the combined powers of Microsoft, Xamarin, and the whole open source community.
     
    Qbit86 likes this.
  45. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,147
    Only if the platform allows it. There are platforms, with Apple's iOS being a common example, that require AOT compiling.
     
    angrypenguin likes this.
  46. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    AOT is still running IL natively; it just doesn't let you generate or run new IL at runtime. IL2CPP doesn't get around that: you can't generate new C++ and compile/run it at runtime on iOS either, as far as I know. I mean maybe you could, but that would be specifically hacking around the security in the OS designed to stop runtime code generation which I'm sure is frowned upon in the app store.
     
  47. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    This!

    Plus, it's already been explained that porting that to platforms where it doesn't already exist is quite a lot of work, where adding support for a new platform to the new pipeline is comparatively much less.

    That's not to mention the cost of upgrading on a system where Unity is providing their own support, too. There's no avoiding some level of that, and one of the things IL2CPP does is help minimise it.


    Define "need", then.

    There's more than one way to skin this cat, so there's no unavoidable requirement for any sole approach. What could someone say to possibly convince you that this approach is at least as reasonable as others?
     
    Last edited: Apr 4, 2016
  48. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    Part of the reason it was hard was that they were not allowed to update their Mono runtime or use anything that Xamarin or Microsoft had released in the last ten years. Now they can.

    Also, I'll believe that it "only takes a week" to port IL2CPP to desktop when they actually do it. Since it doesn't even have an ETA yet and has been in the works for over a year, I have some severe doubts that it's actually only going to take them a week when they finally get around to it.


    The fact that they couldn't afford a new Mono license from Xamarin but wanted to update .NET on iOS was a real "need". Now that need is gone, though.
     
    Qbit86 and Kiwasi like this.
  49. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    I don't know how long some of you have been around, but Unity used to work just fine on iOS before they started the IL2CPP project. You can still download older versions of Unity and publish to iOS using Mono instead of IL2CPP. It's not something they need in order to compile to iOS; you can use AOT with regular Mono.
     
  50. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    See my edits.
    Another part of the reason it's hard is that they were supporting platforms that those others were not. I don't know which of the two dozen platforms those were, but they've explained that all of those platforms have existing support for C++ which they can leverage.

    No, AOT takes the bytecode and turns it into machine-dependent code prior to deployment to the device. No IL gets deployed to the device.