Sign in to follow this  
JoshCzoski

Unity CryEngine V scripting in C#? Really?

Recommended Posts

I programmed in Unity for about a year and just started playing around with the Unreal 4 engine, but in so doing I'll be needing to go boot-camp with C++ as I never learned it. C#, on the other hand, I've used for years.

 

I'm seeing that scripts in CryEngine are written in C#. This almost seems too good to be true.

 

My question, though (as I'm a little unclear with my research so far), is, is this basically an "option" to write scripts in C#? (can scripts also be written in C++?)

 

More importantly, does writing scripts in C# compromise the capabilities of the engine's performance significantly? Honestly, with Unity being my only experience, pretty much every other openly available game engine looks better, and I'd think the blame lies with it being written in C# rather than C++.

 

So . . . is this for real? CryEngine scripts in C# without an inferior (or at least significantly inferior) end product than with scripts written in C++?

Share this post


Link to post
Share on other sites
Well, on the plus side it sounds like they're using a LOT newer version of Mono than what the Unity guys are stuck with. Unity is currently all-in with their IL2CPP converter in order to escape from Ancient Mono hell (and simplify support for multiple platforms).

I haven't used CryEngine at all, so I can't say whether it's implementation will be good/bad/ugly or what. Try it out both ways; C++ and C# are both great languages, but they both have aspects where they're much better than the other. You'll have to decide which of those aspects you care the most about.

For your first question, as far as I can tell from the documentation, C# is an option and you can use C++ as well. Edited by Nypyren

Share this post


Link to post
Share on other sites
Honestly, with Unity being my only experience, pretty much every other openly available game engine looks better, and I'd think the blame lies with it being written in C# rather than C++.

 

This is incorrect. Unity uses native code for many of the performance-intensive routines just like Cryengine or Unreal does.

Edited by Kylotan

Share this post


Link to post
Share on other sites

Imagine you are trying to move from one location to another. When the distance is less than 50 meters, you'll probably just walk/run. If it's up to a kilometer, you might want to use your bike. If it's several kilometers, you'll probably benefit from using your car, even though it's a bit messier to find parking spots etc.

 

Scripting in C# is a bit like using your car. Very fast once running, but it might be heavy to start/end. If your scripts are complex and/or resource intensive, C# is a great option. If your scripts are very simple one liners, chances are something like Lua would perform better.

Share this post


Link to post
Share on other sites

Unity is currently all-in with their IL2CPP converter in order to escape from Ancient Mono hell (and simplify support for multiple platforms).


There are also plans to upgrade the runtime/compilers in the works so that it matches the modern stuff kicking about.

IL2CPP is largely for mobile platforms, I believe iOS in particular due to not being allowed a VM on those devices.

Share this post


Link to post
Share on other sites

Unity's Mono integration is much more coupled than CryEngine's.  CryEngine uses the latest mono and provides bindings (https://github.com/CRYTEK-CRYENGINE/CRYENGINE/tree/release/GameMono) that leverages the same binding techniques they use for Lua and the like.

 

The advantage here is it's a direct exposure of C++ Objects on top of the Managed interfaces so it's a bit of a cleaner API on the C# side but the real measurement is adoption.  Unity has always been a C# first kinda thing.  Cryengine just recently released this binding to try to gain market share.  I think until they have a slew of tutorials on the API in C# they won't get the kind of numbers they were hoping for.

 

That, and being subjected to Windows Only development environments hurts CryEngine when comparing to Unity.  Unity wins because you can develop on a mac, it's C# from the get-go.  CryEngine wins on the engine feature front as it's a much more powerful engine, but the lack of tutorials make it something that can't really be measured until that is rectified.

Share this post


Link to post
Share on other sites

I believe Lua is the "preferred" (for lack of a better term) scripting in CryEngine but they did add a C# interface.  

  

The reason why so many Unity games look so similar is due to the readily available common asset pool.  

The technical issues of the engine would be next in line and whether it's C++ or C# is pretty far down the list.  

  

The days of pushing a PC "to the limit" are just gone and left in the dust behind us.  

There's not even a lot of focus on getting everything out of the GPU because all of the blockbuster titles are console ports.

 

Basically unless you are writing AVX based algorithms what language you use isn't relevant anymore (with regard to performance).

And you can always some bits in native code if you need to and dynamically link it in.  

  

To me, the portability of the language and its supporting libraries is the dominating characteristic and that's where C# just comes unglued. (I wish C++ 14 was released ten years earlier.) YMMV.

Edited by Shannon Barber

Share this post


Link to post
Share on other sites

I believe Lua is the "preferred" (for lack of a better term) scripting in CryEngine but they did add a C# interface.  

  

The reason why so many Unity games look so similar is due to the readily available common asset pool.  

The technical issues of the engine would be next in line and whether it's C++ or C# is pretty far down the list.  

  

The days of pushing a PC "to the limit" are just gone and left in the dust behind us.  

There's not even a lot of focus on getting everything out of the GPU because all of the blockbuster titles are console ports.

 

Basically unless you are writing AVX based algorithms what language you use isn't relevant anymore (with regard to performance).

And you can always some bits in native code if you need to and dynamically link it in.  

  

To me, the portability of the language and its supporting libraries is the dominating characteristic and that's where C# just comes unglued. (I wish C++ 14 was released ten years earlier.) YMMV.

 

I would agree with most of this.  The fallacy of this argument is that all games *need* to push the limits.  Because our hardware is so good now compared to the average skill of the developers writing for it, we are in this weird black-hole time where we are getting API's to interact directly with the GPU (Vulkan, DX12) but that was driven by the big-boys in the pond and leaves most of us wondering what in the hell we are doing with them.

 

As for C#, C# is cross-platform (has been for a while, if you know the ecosystem) but the real kicker for C# is the lack of universally supported cross-platform.  Cross-platform exists for C# but it's a hodge-podge of compiler defines and spaghetti code to make it work.

 

This is from direct experience writing an OpenGL game engine in pure C#.

 

C# is amazing for the productivity and it's close relationship (syntax wise) with c/c++.  Where it really breaks down is when you want to move platforms.  Mono on linux/mac is great, but not this Xamarin fork.  It will get better now that microsoft bought Xamarin, but it's still like trying to force a square peg in a round hole.

 

C/C++ is better suited for easy cross platform development because of libraries like SDL, GLFW, etc.  These have C# wrappers now, but it's still not getting the most out of the language and runtime because this kind of stuff should be available as part of the framework (cross-platform windowing/input).

 

But I digress.  CryEngine's C# bindings are pretty good.  LUA is still preferred with that engine but it's nice to see them catering to more of the indy crowd (who average more use of C#).  But the lack of documentation and samples with it still make it wanting...

Share this post


Link to post
Share on other sites
does writing scripts in C# compromise the capabilities of the engine's performance significantly?

 

People place far more emphasis on language choice than they ought.  You can write bad code or good code in any language.  Some languages are more naturally a better fit to certain problems than other languages, but you can still get great performance out of mainstream languages if you try.

 

There are portions of games that need to have good performance, especially on games with a soft realtime requirement of 10ms or faster per screen.

 

While the game engine code may have strong performance requirements, usually the gameplay scripts have minimal concern over performance. You've got tens of millions of CPU cycles every frame, you can use nearly any language to get enough work done to run gameplay scripts.

 

 

Two examples: Back in my college days two decades ago we were on 300 MHz machines and were observing the direction of a pointing hand in front of contrasting backgrounds: that's doing camera-based gesture recognition (generally considered a slow processing task) doing it in Java (often called a slow language), and a simple, naive implementation was taking only a few hundred thousand cycles, leaving about 1.5 million free cycles per frame for other work.  On several programs we've written simple "just enough to get the thing working" scripting systems, all interpreted, and a few people were worried they would be too slow.  They weren't super speedy, but the were never actual bottlenecks. Processing was taking place outside of critical paths and never blocked or notably impacted performance.

 

 

 

Performance problems are seldom where programmers initially think they are. Language choice itself is generally not the cause of performance problems.  Bad algorithm selection, useless memory allocations, blocking operations, and stupid simple errors are the typical source of issues.  But for deciding between C++, Java, C#, Lua, even JavaScript, all of them are viable languages in today's games.

Share this post


Link to post
Share on other sites

 

does writing scripts in C# compromise the capabilities of the engine's performance significantly?

 

People place far more emphasis on language choice than they ought.  You can write bad code or good code in any language.  Some languages are more naturally a better fit to certain problems than other languages, but you can still get great performance out of mainstream languages if you try.

 

There are portions of games that need to have good performance, especially on games with a soft realtime requirement of 10ms or faster per screen.

 

Performance problems are seldom where programmers initially think they are. Language choice itself is generally not the cause of performance problems.  Bad algorithm selection, useless memory allocations, blocking operations, and stupid simple errors are the typical source of issues.  But for deciding between C++, Java, C#, Lua, even JavaScript, all of them are viable languages in today's games.

 

 

 

Completely agree.  I think most people think "This needs to be fast, and I don't want to think too hard to make it fast, what can I do from the get go so it gives me peace of mind that it might be fast" and C++ is born... (j/k).   Indeed, languages, architectures, etc have plenty of power.  It's all about how you use it.

And I completely agree with the algorithm, useless memory allocations, blocking statement here.  Most programmers don't have to worry about cycles, but rather execution time overall.  Welcome to pushing the limits.  Every aspect of a game engine can be finely tuned by implementing the best algorithms.  However, one algorithm that may make it super easy and fast to draw tree's for example, may end up not working at all for grass...  etc etc..  So it's a giant game of compromise, vs features, vs speed, vs look.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Partner Spotlight

  • Forum Statistics

    • Total Topics
      627674
    • Total Posts
      2978558
  • Similar Content

    • By trjh2k2
      I've never really been a "Unity guy", since all of my game-dev learning happened in C++, and in other engines, but I recently discovered the "complete projects" section in the asset store.  It's full up on projects you can buy that are billed as "ready to customize and release", with full ad integration.  Some of them claim to be for educational purposes, but why would you include a complete, polished, full featured game with ads as an educational example?
      This leads me to the question of why this goes by unchallenged?  Does Unity and the environment of the Unity Store actively encourage this style of game development?  Is the problem of asset flipping our own fault?  I don't mean this as a "we should make Unity shut this down" kind of thread, but rather just to examine whether or not the environment of being able to just buy whole games or pieces of games is something that damages the industry.  I get why Unity would allow it, and I'm sure it's a working business model for some people- and maybe some people DO actually just use these to learn from, but I'm not that naive as to think that there aren't people who recognize this as one of the shortest paths to putting a game on the market so they can cash in.
      Thoughts?
    • By StefanJo
      Hi everyone!
      I have just released a project called Line Driving to the Unity Asset Store.
      Line Driving is complete project ready for release for both Mobile and PC. 
      It is a game where you have to draw your own road for a car using mouse controls or touch input.
      Features:
      1.Simple to understand,detailed commented scripts 
      2.Well-written documentation 
      3.Mobile-ready 
      4.Unity Ads implemented 
      5.Easy to customize 
      and much more… 
      Link to the asset: https://www.assetstore.unity3d.com/#!/content/101595
      Support email: sjovanovic0831@gmail.com



    • By Kurupted Playz
      Hey, I'm looking for some people that can help me with a game that I'm making that is a 3d platformer.
      I mostly need someone for character design and animation,  I can do some coding but if you can do coding as well you're still welcome because I'm still not the greatest at coding just yet.
      if you need to contact me add me on discord @ Kurupted#1206
       
    • By Jcyshadow97
      Hi,guys.I m working on a Fantasy RPG.Currently i m work alone on the project.I really need someone can make UI stuff.If someone can handle it please feel free to contact me on email: 270514974@libero.it.
      Thank you guys and sorry for my english.
       
       



    • By STRATUM the Game
      Hey, everyone! This is my first post here.
      I would like to know what you think about my project called STRATUM. It's a 2D platformer that is heavily based on storytelling and boss fighting while trekking through the world.

      Everything in STRATUM takes place in the first century AD, in a world that wraps our own universe, called  The Stratum. A parallel Universe that is the home of the Christian deities . In this game you will play as a Dacian warrior, unfamiliar with everything in this world, you’ll get to know and understand The Stratum together with him.
      The main thing that I want with STRATUM is to reinvent the known lore and history of the Christian deities and realms. 
      The story is unconventional, it plays down a lot of the mysticism of Hell or Heaven and it gives it a more rational view while keeping the fantastic in it. What do I mean by that? Well, think about Hell. What do you know about it? It's a bad place where bad people go, right? Well, that's not the case in STRATUM. I don't want to describe such a world. In STRATUM, there is a reason for everything, especially for the way Hell is what it is in the game. "Hell" is called The Black Stratum in the game.
      This world is not very different from Earth, but it is governed by different natural laws.
      The story will also involve the reason why this world entered in touch with ours.

       
      What do you think about all that I said? Would you be interested in such a game? I have to say that everything is just a work of fiction made with my imagination. I do not want to offend anyone's beliefs.
      I want this to be a one man game. I have been working alone on it (this was my decision from the beginning) from art to effects to programming to music to sound effects to everything.
      I also have a youtube video HERE if you want to see the way the game moves and the way my music sounds.
      Please, any kind of feedback will be highly appreciated. If you have something bad to say, do it, don't keep it for yourself only. I want to hear anything that you don't like about my project.
       
  • Popular Now