Search Unity

Xamarin now free (and supposedly open source)

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

  1. darkhog

    darkhog

    Joined:
    Dec 4, 2012
    Posts:
    2,218
    W̶a̶i̶t̶,̶ ̶y̶o̶u̶ ̶d̶o̶n̶'̶t̶ ̶h̶a̶v̶e̶ ̶s̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶ ̶t̶o̶o̶l̶?̶
     
    Ippokratis likes this.
  2. zezba9000

    zezba9000

    Joined:
    Sep 28, 2010
    Posts:
    985
    IL2CPP is about a 3rd faster then Mono but not .NET.
    .NET Core (aka coreclr) is about a 3rd faster then older versions of .NET with my tests [.NET 3.5] (would have to check again) and the old versions of .NET were already faster then Mono and IL2CPP.

    Now I know its a HUGE project to update anything to .NET over Mono as the embedded APIs are different. Also IL2CPP may be more portable then both .NET and Mono because of how it compiles out into C/C++ code... a method I personally agree with and wish .NET itself would implement over LLVM back-ends as it allows you to target VC++, GCC, CLANG, etc compilers.... much more practical.

    Because of this I wish IL2CPP would contribute to the .NET foundation and not just consume it by open sourcing IL2CPP at some point. If anything porting over IL2CPP peaces over in some way that allows .NET to have a MSIL to C++ backend would be awesome!
     
    JaredThirsk likes this.
  3. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Is there actual proof to what you're saying about IL2CPP being slower than net (if that is what you're implying) ?

    I imagine it would be hard to test .net clearly vs mono vs IL2CPP on a phone, as you did of course? Because IL2CPP isn't available on desktop at the moment and such tests would have to eliminate Unity itself as an overhead to be clear.

    (as obviously if IL2CPP isn't as fast as .net then we don't really want to be using IL2CPP for anything except WebGL).

    But I'd like to see hard data rather than your word (not doubting, just requesting for clarity).
     
    Kiwasi likes this.
  4. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    How does CoreCLR factor into this discussion? It's an entirely different beast and not even relevant.
     
  5. tswalk

    tswalk

    Joined:
    Jul 27, 2013
    Posts:
    1,109
    lolz...

    but the emails were sent out yesterday to us... so ya, wewt!.. glad I didn't buy that ridiculous license afterall.
     
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,675
    Yes it is :D If you target Windows Store!
     
    JaredThirsk and hippocoder like this.
  7. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    I think MS mostly brought them in because Unity is a very popular .NET-based game engine, and MS is starting to gather every very popular .NET-based anything under the umbrella. I think Unity's popularity would have guaranteed them a seat at the table even if MS thought that their runtime was terrible. Honestly I wouldn't be surprised if MS also pushed them to put IL2CPP on the back burner and instead switch to the new open source MS/Xamarin runtime.
     
  8. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,144
    Okay, but how about for those of us targeting Steam :v
     
    darkhog likes this.
  9. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    Doubtful, and even if it were the case they'd be far more likely to aid in transition from IL2CPP to .NET Native.
     
  10. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    I don't know... .NET Native has some downsides similar to IL2CPP like lacking the Dynamic reflection features and such; .NET Native seems more geared specifically to phones or embedded apps where the .NET code itself has to eke out as much performance as possible... Unity's engine itself is already mostly native and the .NET layer is just for game logic, where I think added features and compatibility would be more beneficial than a slight performance enhancement. But... we'll see I guess. Any change in direction would be good. I just don't want to see them say "Yay, we can now legally update our .NET runtime for the first time in a decade. But instead we're going to hold out just three or four more quick years to iron out the bugs in IL2CPP just to show Xamarin and MS we don't need their help."
     
    Qbit86, JaredThirsk and darkhog like this.
  11. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    That's really grabbing at straws. A pessimistic view. I think they're instead practical: WebGL isn't going away. IL2CPP has to be made regardless. Might as well make it really good.
     
    Kiwasi, angrypenguin and McMayhem like this.
  12. Deleted User

    Deleted User

    Guest

    Edit: Wow ok, obviously nobody finds IL2CPP's name a little funny..

    Anywho, if it works as well a later versions of Mono then fine.. There are quite a few features in C# 6.0 that'd be handy though.. So a long a we can have our cake and eat it, no problems.!
     
    Last edited by a moderator: Apr 2, 2016
  13. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    I don't think they need IL2CPP for WebGL; they could just use Mono now.
     
    darkhog likes this.
  14. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    No they can't. Webgl is based on asm.js, a precursor to webassembly, and it needs byte code. As to .net native vs il2cpp... They have exactly the same limitations that mono already had on iOS. It's AOT. In fact, the original bits of my asset that are ported to work on iOS worked out of the box with webgl and on all other il2cpp (and AOT) platforms. The only real downside is that il2cpp forces AOT compilation onto all platforms and I mostly despise AOT. On the other hand it also makes implementations consistent across platforms.
     
    angrypenguin, JaredThirsk and Ryiah like this.
  15. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    I'll admit I haven't used Unity's WebGL yet, but as I understand it it takes C#, compiles to CIL, uses IL2CPP to convert CIL to C++, uses LLVM to convert C++ to IF, then uses Enscripten to convert IF to asm.js. Instead of going through all that, they could go from C# directly to LLVM to asm.js using something like LLILC and Roslyn. All these acronyms are giving me a headache. I guess mainly my point is that I don't see a "need" to get to C++ for WebGL, the only purpose it's currently serving is as a middle step in the long conversion of .NET to WebGL.

    I also mostly despise AOT which is why I'd rather have real .NET than .NET Native. But I'd gladly take .NET Native over the current Mono runtime or IL2CPP.
     
    Qbit86 likes this.
  16. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Why do you guys despise AOT?
     
  17. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    AOT is very rigid. It involves some magic to get some things working. Reflection is particularly problematic, at least I'm terms of dynamic type creation and instantiation. Even generics don't work well with AOT which is where some of that magic happens. There's actually a kind of JITish bit that happens, involving heavy use of trampolines that bounce in and out of semi managed code to support them. The exceptions generated by AOT issues are also problematic and often hard to track down. The older mono runtime resulted in bugs with AOT that were difficult to work around. I've seen at least as many in il2cpp generated code on some AOT platforms (xbox one in particular) that are brutal, one of which was reported over a year ago and I still don't think Unity has fixed it.

    The biggest issue I feel with it (AOT in general) is that we are using a managed framework with some very nice features that AOT limits or eliminates. Even with an upgraded .net profile we will likely never see the introduction of dynamic support as I'm not sure it can be made to work in an AOT environment. In most cases it's better to avoid dynamic anyway but it can be very handy when working with nosql databases and even quick serialization and deserialization.
     
  18. Acissathar

    Acissathar

    Joined:
    Jun 24, 2011
    Posts:
    677
    I do, mainly because I have the "IL2" part stuck in my head as "I love to."
     
    tiggus and Deleted User like this.
  19. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I see yeah. I tend to avoid most of C#'s exotic features (one might call them standard) but I'm pretty basic in terms of what language features I use, so I'll most likely never encounter these problems. I can see how they'd plague people who architect code.
     
    Dustin-Horne likes this.
  20. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    Yeah it's a personal preference for me. However, as I alluded to as well, the benefits of consistency and eventually performance once il2cpp is stabilized will outweigh the cons.
     
    hippocoder likes this.
  21. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    I just want the garbage collection problems to go away, or at least diminish drastically. I just had a case where Unity's terrible GC pretty much stalled me on a game. It wasn't because of my own code, but a 3rd party's networking solution that simply had terrible garbage collection problems. And 3 or 4 months of work came to a halt for me, and now I have to find a new networking solution as well as restructure my entire game to work with the new system. All this because the garbage collection in Unity is just really bad.
     
    JaredThirsk, MV10 and HeadClot88 like this.
  22. HeadClot88

    HeadClot88

    Joined:
    Jul 3, 2012
    Posts:
    736
    That just sucks. Yeah... Glad unity is doing something about the Garbage collection issues
     
  23. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,157
    Sounds to me at least part of the blame lies with incompetent third party developers.
     
    Last edited: Apr 2, 2016
    Kiwasi likes this.
  24. darkhog

    darkhog

    Joined:
    Dec 4, 2012
    Posts:
    2,218
    Windows Store is stupid, anyway. Another GFWL, except now it supports apps too. I wouldn't be even surprised if it'd turn out GFWL and WS has similar code base.
     
    HeadClot88 likes this.
  25. Dustin-Horne

    Dustin-Horne

    Joined:
    Apr 4, 2013
    Posts:
    4,568
    It's a whole different animal. UWP uses .NET Core and compiles to .NET Native before publishing.
     
  26. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Ye, me too. For me 'New Mono' (or .NET) = new GC. That all. :D
     
  27. tiggus

    tiggus

    Joined:
    Sep 2, 2010
    Posts:
    1,240
    Probably but I am guessing this is a huge area of optimization that would help a lot of folks regardless. I remember on IRC chatting with one of the Trion guys using UE4 and talking about how I was using pooling for all my enemies and various components to avoid GC and he was like "what? never had to do that, just instantiate a new one". Seems like an easy win.
     
  28. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Yeah, UE4 *does* suffer the same gc stalls. So presumably, he's not pressuring it enough.
     
  29. tiggus

    tiggus

    Joined:
    Sep 2, 2010
    Posts:
    1,240
    Could be, also it was desktop
     
    Kiwasi likes this.
  30. mdrotar

    mdrotar

    Joined:
    Aug 26, 2013
    Posts:
    377
    I think the point was, it's harder to pressure the GC in UE4 because it's better... as in, it's not something you have to constantly worry about.
     
  31. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I think you should constantly worry about it regardless unless you want to just waste performance, which is what it sounds like. For the best game, regardless of language or engine, you want to use best practises.
     
    Kiwasi and angrypenguin like this.
  32. mdrotar

    mdrotar

    Joined:
    Aug 26, 2013
    Posts:
    377
    This. No more excuses. Time to swallow your pride of IL2CPP and focus on the customers now. It is incredibly frustrating and depressing to see the world continue to progress forward while Unity stubbornly remains in 2009.

    The feature set is already broken between platforms (with Windows Phone), and WebGL is still not ready for prime time anyway. So even if IL2CPP is required for WebGL, let WebGL be the one under constant development with IL2CPP and let everything else get the upgrade now.
     
    Qbit86, JaredThirsk and darkhog like this.
  33. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    If you want faster desktop engine, go use UE4 :rolleyes: ?
     
  34. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I dunno if it is faster though.
     
  35. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Well ... at least he will get a better garbage collector :D
     
  36. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Dunno if it is. https://wiki.unrealengine.com/Garbage_Collection_Overview
    After a while you wonder why UE4 bothers with a gc if it's so hands-on. Might as well just have really nice ways to manage memory manually.

    I guess it's really only intended for beginners to get up and running before switching code over to manual control when things get slow.

    Which isn't really any different to avoiding allocations in Unity (which you will always need to do in game development if you want perf).

    However the downside in Unity is that you often can't avoid it. Because things like OnCollisionStay can't always be avoided unless you want a game that doesn't work as well as it could.

    Basically long before Unity overhauls it's GC it should provide means for us to avoid using the GC to begin with. Currently that doesn't look so easy. Even the new cinematic post allocates data with command buffers. Lots of that needs to be fixed before GC since those problems are not going away with a better band aid.
     
    Kiwasi and zenGarden like this.
  37. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,750
    A newer mono would be good.

    And I'm not completely sold on IL2CPP. It's really debatable if it's faster than the really old mono we have right now (old link, but I can't find anything more recent: http://jacksondunstan.com/articles/3001 see the benchmarks at the bottom), so it's a pretty safe bet that it's not faster, currently, than a recent Mono.

    Maybe it has the potential to be faster assuming enough work goes into it, maybe not, I wouldn't know.
     
  38. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    Yes this is definitely true. But I can't put the third party developer in a headlock and force him to fix his asset, or make him restructure it. And fixing it for him would require even more time than if I simply cross over to another solution. In the end it just cost me time and money. Live and learn though as they say. It's just one example why I want Unity to have faster garbage collection though. Is there anyone who likes Unity having a terrible GC?
     
  39. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    IL2CPP performance increases all the time though, so it's far from a safe bet. It's not static. The link on that page shows the majority of tests were faster with IL2CPP when set to release.
     
  40. darkhog

    darkhog

    Joined:
    Dec 4, 2012
    Posts:
    2,218
    And one of which is never to optimize prematurely. As in, don't try to optimize memory, unless it becomes an issue on the target hardware. Also, "practises"? I've thought better of you, hippocoder.
     
  41. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Correctly allocating memory and not being wasteful are best practises, it's what you do by default. That has nothing to do with optimisation, which can lead to bad design patterns. Using memory correctly is a good design pattern.

    It's normal. I'm saying a lot of users use Unity (and other engines) abnormally because they're not used to game development or lack experience in game development. For example in any AAA game you've got, 100% chance they're pooling stuff.

    Pooling isn't optimisation. It's normal. Not pooling is simply deliberately thrashing memory, you have to go out of your way to do it. It's as if you're rebooting that part of your game constantly. That is why it is a design practise and not an optimisation.

    In any case, the focus is on what we can't work with, allocations which are unavoidable, these are what the focus is about and best practises cannot avoid these.
     
    Kiwasi, angrypenguin and JaredThirsk like this.
  42. MV10

    MV10

    Joined:
    Nov 6, 2015
    Posts:
    1,889
    Kind of interesting that none of the Unity video tutorials... well, none of the beginner to intermediate (the only ones I've watched)... even use the P-word, if I recall correctly.
     
  43. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Unity advocates using instantiate and co routines, both which personally I find counter productive in producing full working fast functioning games.

    I think the take away is, that the learn tutorials are designed to aid people with zero experience in game development.

    Pooling and even Octrees, spatial stuff, are essential core features of any game really, and Unity does not natively support either. Should it? Yes - if it can be done higher performance and simpler than using C# for the job, since all games will at some point benefit from them.
     
    Kiwasi, MV10 and zenGarden like this.
  44. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    Umbra does take care about culling, so you don't need octree culling ?
    About pooling there is some plugin you must buy , but it is easy to create a pool using some array , still i agree Unity should have prefabs pooling functionnality as a C++ in the engine.
     
  45. MV10

    MV10

    Joined:
    Nov 6, 2015
    Posts:
    1,889
    Does a pooling asset (or engine feature) really save much dev work?
     
  46. zezba9000

    zezba9000

    Joined:
    Sep 28, 2010
    Posts:
    985
    What? How is it not? Mono and .NET can fully share any of there code with one another... this could mean a lot of things but may mean very little depending on how things play out for Unity on this.

    1) .NET and Mono are now both part of the .NET foundation under the MIT licence. (What does this mean for IL2CPP and Unity's Mono in terms of performance and features?)

    2).NET is a baseline for performance comparison when it comes to Mono or IL2CPP in Unity3D. Its very relevant to this topic in that aspect.

    3) Because .NET and Mono are now both MIT it opens up questions about what direction Unity should or will take in the future. (Update Mono, switch to coreclr or keep pushing IL2CPP even though its way behind in features but not performance).

    4) This is a general discussion form for a reason and the topic was meant to spark discussion about what this news might mean for Unity and the C# / .NET ecosystem. Performance in my mind is in the top two... so if there is something wrong with bringing this up.. tough.
     
  47. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    Hmm... what is your solution for the AOT platforms if you want to get rid of IL2CPP? AFAIK IL2CPP is currently ahead of everything when it comes to total of supported platforms and development stage.
     
  48. pointcache

    pointcache

    Joined:
    Sep 22, 2012
    Posts:
    579
    info from where? last time ive seen the actual numbers it felt more like they struggle to fulfill the promises, because in many cases on many platforms in common scenarios numbers were WORSE than on mono. So i think you are wrong.
     
  49. pointcache

    pointcache

    Joined:
    Sep 22, 2012
    Posts:
    579
    why would anyone do that.
    #MShater
     
    darkhog likes this.
  50. pointcache

    pointcache

    Joined:
    Sep 22, 2012
    Posts:
    579
    its more of a common code paradigm than some unity specific thing. Any small object can be reused to decrease memory footprint and increase performance by minimizing allocation, in unity world is some kind of buzzword.