Sunday, October 28, 2012

CryEngine vs Unity

I was wondering what is better CryEngine or Unity and here is a post that answered my question:

I have been busy with CryEngine 3 (CE3) last days, after all these thread here covering other AAA engines. I have digged quite a bit into the C++ code of CE3 right now and so far I have to withdraw my previous statement about it being crappy. It is cumbersome, but so far it is one of the best pieces of API code I have ever seen (that is probably also the reason why it has almost not changed for 10 years now). I am going to port my "half" Unity game to CE3 right now, this will take quite some time but this post covers the reasons. This is no flame thread or anything, so if you really want to know an objective, but technical, view on CE3, from a person who really likes Unity (at least for what it was made for), you will get it. It took me quite a while to write this, so I would appreciate constructive feedback and don't convert this in a flaming thread please, we have enough of them about this subject already.

First, let me tell when you don't need to bother about CE3, so you don't waste time in this thread:
1) You want to create mobile games or games for low-end hardware
2) You are not going to create FPS like games with some sense of certain realism, say Crysis or Age Of Conan. Though one sure can with CryEngine, it gets nasty, just like with UDK, maybe even more.
3) You have no in-depth programming skills in C++ or can accept the limitations of Lua, the scripting language of CE3 (for now)
4) You have no good models to put into your game anyway, in that case CE3 makes only limited sense, even though you might still want to use it, see more below ^^
5) You want Mac/Webplayer support ^^. CE3 does not support it, because of driver limitations on apples site; and as for the webplayer, well ^^ its quite obvious here I guess (a decent level makes up to gigabytes of data). But CE3 (to my surprise) supports Linux!
6) You are new to gamedev! Use Unity first, understand it, push it to its limit, then switch to CE3 if you think you need it. If you don't master Unity, you have no chance with even simple things in CE3, I promise you...
7) You just don't miss anything in Unity. In that case you might still wanna read on...

### A DROP IN COLD WATER

So now some eye-candy videos to bring us all on the same line about what kind of graphic we are talking about, they are all more than worth watching I can't even recommend one in particular:

Realtime Radiosity
DirectX 11 & CryEngine
CryEngine Promotion
Another Good Promotion

So you might come up with "But these are all just promotion videos, you can't take them seriously!". No, you can! This is what impressed me most (and convinced me finally) of all when I first started the CE3 Sandbox editor. It just looks damn awesome, without doing anything. Just pick some AAA models, stuff them in and enjoy. This is something I have never seen before. In UDK you would have to twist your brain to come even close to what Unity Pro is capable of, while UDK is capable of the same things as CE3 but most people have no chance in unleashing this power... But what you get with CE3 by "default" is just beyond measure, and I am not kidding. Of course this has its price. CE3 only runs on recent hardware, but the fact that it runs on these crappy consoles already proves that it can't be that bad. At least it doesn't even start on my 2010 notebook (damn Intel HD). What is also impressive is that the "empty" default scene in CE3 already has 200k polygons of interactive water. That is quite funny because this very scene would already come in a range close to what Unity can do at all, but it is a god damn empty default scene in CE3. And also if you look at the second video, you can see that there is NO point at all comparing CE3 with Unity. These are different worlds for different audience! It's you who has to decide which audience he wants to/can please.

### WHAT EXACTLY DOES UNITY LACK BESIDES VISUAL QUALITY?

Of course, the visual aspects are not worth mentioning, because these two engines do not and cannot even compete in the market. So what could still make you choose CE3 instead of Unity, even if you are happy with the visuals of Unity Pro?!

1) You want a dynamic environment. Forget it with Unity! Even if you can workaround some of the many issues that will arise, you won't get any decent look due to lack of global illumination (and in fact much more), which is only provided by the static Beast Lightmapping. And more importantly, no dynamic occlusion culling and that is killing! You just can't work with that. And even the static one is bugged to the teeth and a pain to work with already when your scene is not dynamic at all.

2) You want a destructible environment. You can do it, to some extends, I did it with about 10k fragments flying around with PhysX support (using a hand crafted "Adaptive-Octree-Dynamic-Batching" algorithm I developed precisely for this purpose as well as highly optimized shaders to minimize CPU overhead on mesh update; not to mention the fancy polygonal fragmentation algorithm). Looks nice but is already the limit. Builtin dynamic batching doesn't work for anything but mobile. CE3 batches almost everything automatically in deferred MSAA HDR scenes. So much about that. It supports automatic realtime destruction/fragmentation (not only prebaked). CryTek has seen what I have seen, no destructible dynamic worlds without throwing anything prebaked over board. They simple have nothing prebaked, though you sure can use it (for explicit optimizations), but you don't have to and you don't by default. And that is one reason why it looks so good; most other engines have to prebake, prebake, prebake, hours and hours on UDK "Swarm" server farms until a static scene looks somewhat near "decent" (hopefully). CE3 does it in realtime...

3) You want decent Posteffects, like HDR, Bokeh-DoF, analytic SSOA. CE3 has them all builtin (the fancy stuff soon) and they excel in every respect. Especially the little things like "SSOA shining through particle effects or transparent objects", "no MSAA in deferred rendering", "no scalable particle systems" add up pretty quickly in Unity and make most of the "nice" stuff unusable in real world situation and pretty much only useful for showcases. What I have learned is "No good look without excellent post-effects" which means no good look at all in Unity (always compared to CE3). New fancy stuff is on the way, like Image-Based-Reflections (and all the other stuff seen in the UDK Samaritian Demo, just that with CE3 you won't need five GTX 590 for this) which is quite jaw-dropping. I am sure I don't need to mention tessellated displacement mapping as seen in the second video, HDR lighting, transparent colored shadows, the list is endless...

4)You want a real-life sky with day-time support (realistic sunset, atmospheric scattering etc.) , weather (rain, snow), weather occluders (that is quite helpful and a pain in Unity ... again), wind on all objects with much more sophisticated influences, dynamic clouds, etc (and not only on these crappy terrain surfaces)... Just all the stuff that create some kind of "immersion" for the player. You can buy most of this stuff in the asset store, but to be honest, it costs quite a bunch and it does by no means compete with the corresponding CE3 effects and additionally, the Unity versions are much slower and will finally make your game unplayable ^^. You can just keep stuffing all that into CE3 without noticeable FPS drops...

5) You want interactive, realistic water. No chance with Unity! The lack of advanced shader support makes most of these attempts quite useless. While Unity has decent looking "Pro" water from the top down, it is like with everything else in Unity. It seems more like a marketing strategy, because it is just of not help in practice. There is no decent "underwater" effect and even if there would, the water4 has no "height at" function to properly decided the "underwater" property (one could do that himself, as with everything in Unity). But if you look at the CE3 water effects, you will see that this is far away from anything you have ever seen in Unity and probably couldn't even do in Unity efficiently. Additionally it supports interaction (automatically) which means creating waves by just walking into it, or shooting into it. This is pretty slick, and couldn't be done efficiently in Unity I suppose (due to lack of shader support). The CE3 water is FFT based and supports (of course) DX11 tessellation (again automatically) which really makes it look like movie water. CE3 comes with three different amazing water surfaces made for different occasions (ocean, in-door, river).

6) You want to make your game moddable. Use Unity Pro and AssetBundles! No wait... How can you create an AssetBundle? Yes, with Unity Pro, so how will your players mod your game? Not at all I suppose. Sure you could again build a solution yourself like using Unity free and making a custom "FBX to Mine" converter and load that stuff, have fun! What about animations? How to read them out and how to load/store them? What about sounds? They don't layer when imported with WWW. What about textures? They are stored as PNG if modded, and have to be converted to DXT on every, single, restart! The PNG decoding alone is far too much for any decent use case. CE3 was built from the ground up (since 2001) to be highly moddable and hell it is! There are Maya/Max exporters for any occasion and custom file format for anything you can just load at runtime in script code and most importantly, load them efficiently! You can even change the entire game code and scripts without any "hacks".

7) You want to create procedural content. This is quite possible with Unity using the skinned mesh or the usual mesh. But hell, it is inefficient! CE3 gives you C++ access to the raw rendering pipeline. You can stuff in DX10 instancing matrix streams as well as utilize all other streaming capabilities; you can update vertex/index buffers partially (which is a great thing and really not too much to ask for?! ). Combined with the up to 10 times faster execution of C++ code compared to C#, especially for such raw array manipulation, this is something you can't miss. And another thing is you can dump this out in the usual CE3 mesh format "CGF" and read it back in later. And since nothing is prebaked in CE3, you get realtime radiosity, dynamic occlusion, as well as fragmentation for mesh destruction...
Additionally CE3 supports a lot of things I couldn't figure out right now, like advanced AI, superior networking, ...

### CONCLUSIONS

So what this comes down to is that Unity has a lot of stuff to some degree. But that very degree is just high enough to make it suitable for proper advertisement while it will do you no good in a productive environment. Anything in Unity requires SO MUCH work to get it working PROPERLY and that is the key-word. As long as you just want to stuff some prefabs together it might look quite nice. But if you really want everything in a complex scene fit together, you have a hell of a mess in front you and it will take a lot of back-breaking work to get it right and then still it is just static. Unity doesn't provide tools to control this mess, UDK does and it still sucks... And this is the very reason why I am switching to CE3. For now I have omitted all that stuff and this was a good decision. A lot code can be reused in CE3 since I focused on gameplay and not so much on rendering (since I had the hope that Unity would catch up until I am done but now I doubt it; or let's say I can't wait anymore). But more importantly is what would lie in front of me when sticking with Unity:

1) Writing (and failing because of lacking shader/C++ support) a dynamic occlusion solution, without this ANY real shooter or 3D game in general is doomed to fail.

2) Creating/Implementing most of the stuff I talked about in the previous "chapter". Especially the modding part as well as weather effects, the particle problems, the list is again... endless!

3) Buying a lot of stuff like: RAIN{One} AI, Voxelform, various weather effects and rendering packages, which totals almost to a Unity license in itself... And besides buying, also implement these things. Like Voxelform, which comes similarly in a AAA incarnation in the CE3 Sandbox editor and allows for cave and overhang creation and much more. It is even accessible from C++ and that is just amazing as well. The CE3 Sandbox editor is ingenious and well I don't find any words for it!

4) Implementing an AI, and only god knows how in a dynamic environment, since even the commercial assets are mostly static even if some try to claim some support for dynamic waypoint/navmesh hybrid approaches, but it sounds rather suspicious. I'd rather trust CE3 to be honest...

5) Coding all the game logic stuff for a typical FPS like picking up items, shooting weapons, reloading and you know it all ^^. Well again, this comes builtin into CE3 ^^. The simple demo scene "Forest" already combines a lot of effects that are unmatched when compared even to vivid commercial Unity titles... As long as you want to use a typical FPS game logic, CE3 has it all! From the easiest thing to complex multiplayer match setups and proper synchronization of item pickups, shooting and stuff. To be precise: You get access to a major portion of the Crysis 2 script code and C++ game logic (there are "alien" and "nano-suit" code comments all over the place, even in deep C++ call trees).

6) Multiplayer mode. What is builtin into CE3, you have to code yourself in Unity, again... Yes it provides a network layer but that is pretty much it. With CE3 you get a lot of high-level networking along with the native pipeline, like map-voting, chatting, and different kinds of prefabed match types, not to mention all the well tested Crysis networking code.

7) Buy a lot of assets, like cue sound effects and other stuff that is already right in front of me in CE3, but I can't use it in Unity!

8) Not to speak of character animation. It's just deadly in Unity. At these times I really praise weapon socketing, vehicle system, integrated support for using mounted guns on vehicles ^^, default character animations with reloading, swimming (it even comes with a bunch of different swimming techniques), realtime motion capture application (as seen in one of the videos) using Kinect and IPiSoft, procedural locomotion and AI for climbing ^^...

9) Anti-Cheat. CE3 also has anti-cheat build in (PunkBuster) and a lot of places to hook in your own solutions.

Well probably there is much more, since I was only talking about non-editor related stuff. And finally, looking at the still unsatisfying results due to lack of dynamic radiosity and proper overall rendering quality! The amount of code that would be required to get my game anywhere near "release" is extraordinary, and I already have coded about 20000 lines ^^. I doubt that this project would succeed anywhere below 60k and probably at least 3k USD of additional budget. Much more than I would ever need in CE3 even if I would write it entirely in C++, but I am not going to. CE3 is free and requires a 30% revenue share. Frankly, I can live with that! If the game is really a burner, I will just move the headquarter into a tax paradise, so I would just pay taxes to CryTek, so to speak. Or at least I would never go beyond 50% and that is almost what we have in our country already! And to be honest, 30% revenue share for all you get from CE3?! I mean I would proudly give them the 30%, as well as to UT if they would fix all these issues, but they won't! And for people who say that this is worse for Indies ^^. What could be worse than 3k USD of upfront payment? I sure could find better things to do with it than wasting it for some "virtual" license crap; so screw it. This way you only have to pay CryTek if your game brings in money, and this is the way to go for Indie...
Also I have to correct my statement about these engines not being suitable for indies. For UDK this still applies, for CE3 it doesn't. What you need are excellent programming skills and a lot of dedication and the power to defer "knowledge", which means to accept that you don't understand jack about the engine you are working with; otherwise you get lost, I can tell you that! CE3 is a real monster and even the sole include headers for C++ you can use make up a high 5 digit amount of lines... The C++ reference manual is over 4000 pages filled just with types and methods, without much comments but sure better to navigate than crappy IntelliSense... But the power and assets you get with CE3 also because of the large existing Crysis code portions, the impressive out of the box rendering quality, and all the stuff I talked about make it even better for Indie than Unity, proper skills provided. You will get a game done much faster if you use CE3 correctly, and will look and feel way better; not to mention the fact that it scales with your success. If your game succeeds you already have everything in the right engine to make it a real AAA title over time... If your game succeeds in Unity you will have to port it, which basically means recreate it...
So far the only thing CE3 seems to suck at is full-screen detection as for the funniest code comment ever directly in the main Crysis GameDLL: "// ghetto fullscreen detection, because renderer does not provide any kind of listener". And this also the only deficiency I found so far in their API design.

After all, even if you are not shipping a game with CE3, you will learn so much about AAA game development, and you will probably be shocked how much features Unity really lacks and never come back. I don't know ^^. I will remember Unity if I ever create a mobile game it is sure excellent at this one...

Oh one last thing of medium importance. The free version of CE3 does NOT support custom shaders. The good thing is that you won't need them anyway since CE3 has a large asset database and you can reuse all the stuff in the net. And in contrast to Unity, you neither need to optimize anything in CE3 nor could most poeple. It is all perfect...

CE3 supports C++ debugging in Visual Studio 2010 and for Lua scripts. You can even start the engine from within C++ so to speak, it gets sort of a client for you to use.

I could go on for a while but I tried to find an end, and here it is, also because I am falling asleep right now it takes so damn long to write... There is no way I am turned around on this subject and that is not the point here. But you still are welcome to comment on all this.

No comments:

Post a Comment

Comment here: