General > General Technical Chat

How many people code in C these days, and if so, why?

<< < (25/99) > >>

Berni:

--- Quote from: coppice on May 07, 2020, 11:01:33 am ---
--- Quote from: IanB on May 06, 2020, 09:10:32 pm ---
--- Quote from: nctnico on May 06, 2020, 09:03:29 pm ---C# is MS only. People seem to use Python for that kind of applications nowadays. Personally I don't know anyone who is writing software using C#.

--- End quote ---
C# is gaining cross-platform support and much of it is now open.

--- End quote ---
Is it really? Mono has been around for years, but if it is seeing significant use it must be in places I never see.

--- End quote ---

Well alone the game Fortnight generated about 2 billion USD of profit in 2019 and is running on the UnrealEngine where most of the actual game code is C# running in Mono for multiplatform. And this is just one example. Lots of games are made with UnrealEngine or Unity and both use Mono to run C# code on Windows, Linux, Mac, Android, iPhone...

Id say that is a pretty damn big use of Mono.

Kosmic:

--- Quote from: Berni on May 07, 2020, 11:10:52 am ---
--- Quote from: coppice on May 07, 2020, 11:01:33 am ---
--- Quote from: IanB on May 06, 2020, 09:10:32 pm ---
--- Quote from: nctnico on May 06, 2020, 09:03:29 pm ---C# is MS only. People seem to use Python for that kind of applications nowadays. Personally I don't know anyone who is writing software using C#.

--- End quote ---
C# is gaining cross-platform support and much of it is now open.

--- End quote ---
Is it really? Mono has been around for years, but if it is seeing significant use it must be in places I never see.

--- End quote ---

Well alone the game Fortnight generated about 2 billion USD of profit in 2019 and is running on the UnrealEngine where most of the actual game code is C# running in Mono for multiplatform. And this is just one example. Lots of games are made with UnrealEngine or Unity and both use Mono to run C# code on Windows, Linux, Mac, Android, iPhone...

Id say that is a pretty damn big use of Mono.

--- End quote ---

FYI this is not true. UnrealEngine 4 is mostly C++ (100% of the runtime engine and a good chuck of the tools). Nobody remotely serious use C# and mono in a video game.

If you don't believe me just d/l the source code of UE4...

Berni:

--- Quote from: Kosmic on May 07, 2020, 12:46:57 pm ---
--- Quote from: Berni on May 07, 2020, 11:10:52 am ---
--- Quote from: coppice on May 07, 2020, 11:01:33 am ---
--- Quote from: IanB on May 06, 2020, 09:10:32 pm ---
--- Quote from: nctnico on May 06, 2020, 09:03:29 pm ---C# is MS only. People seem to use Python for that kind of applications nowadays. Personally I don't know anyone who is writing software using C#.

--- End quote ---
C# is gaining cross-platform support and much of it is now open.

--- End quote ---
Is it really? Mono has been around for years, but if it is seeing significant use it must be in places I never see.

--- End quote ---

Well alone the game Fortnight generated about 2 billion USD of profit in 2019 and is running on the UnrealEngine where most of the actual game code is C# running in Mono for multiplatform. And this is just one example. Lots of games are made with UnrealEngine or Unity and both use Mono to run C# code on Windows, Linux, Mac, Android, iPhone...

Id say that is a pretty damn big use of Mono.

--- End quote ---

FYI this is not true. UnrealEngine 4 is mostly C++ (100% of the runtime engine and a good chuck of the tools). Nobody remotely serious use C# and mono in a video game.

If you don't believe me just d/l the source code of UE4...

--- End quote ---

Well yes the engines themselves are are written in C++, but C# is one of the popular languages that is ran on top for actual game code. Okay yes UnrealEngine does favor C++ for game code too, but you can use any language that can compile itself into a dynamic library. Unity is just as big of a player in the game engine scene and it heavily pushes C# due to tightly it is integrated with it (So yes large parts of Unity are also written in C# to facilitate that, but the core parts of the engine are not).

These non compiled languages are attractive for the reason that they run on any platform out of the box and they offer a lot of rich debugging functionality regardless of platform. A lot of the time these modern game engines even allow for modification of code as its running live (even when running on a remote system like an Xbox or PS4). So it makes sense to use things like C# for game code in order to speed up development. Later on this also becomes usefull for any moding API pr plugins as they can tap into the code on a high level rather than essentially acting like a virus to tap into functions and memory.

Yes you would not write an entire game in C#, but quite a lot games released in the last 10 years are running the high level game logic inside Mono due to the benefits that JIT compiled languages offer.

Kosmic:

--- Quote from: Berni on May 07, 2020, 01:16:16 pm ---
--- Quote from: Kosmic on May 07, 2020, 12:46:57 pm ---
--- Quote from: Berni on May 07, 2020, 11:10:52 am ---
--- Quote from: coppice on May 07, 2020, 11:01:33 am ---
--- Quote from: IanB on May 06, 2020, 09:10:32 pm ---
--- Quote from: nctnico on May 06, 2020, 09:03:29 pm ---C# is MS only. People seem to use Python for that kind of applications nowadays. Personally I don't know anyone who is writing software using C#.

--- End quote ---
C# is gaining cross-platform support and much of it is now open.

--- End quote ---
Is it really? Mono has been around for years, but if it is seeing significant use it must be in places I never see.

--- End quote ---

Well alone the game Fortnight generated about 2 billion USD of profit in 2019 and is running on the UnrealEngine where most of the actual game code is C# running in Mono for multiplatform. And this is just one example. Lots of games are made with UnrealEngine or Unity and both use Mono to run C# code on Windows, Linux, Mac, Android, iPhone...

Id say that is a pretty damn big use of Mono.

--- End quote ---

FYI this is not true. UnrealEngine 4 is mostly C++ (100% of the runtime engine and a good chuck of the tools). Nobody remotely serious use C# and mono in a video game.

If you don't believe me just d/l the source code of UE4...

--- End quote ---

Well yes the engines themselves are are written in C++, but C# is one of the popular languages that is ran on top for actual game code. Okay yes UnrealEngine does favor C++ for game code too, but you can use any language that can compile itself into a dynamic library. Unity is just as big of a player in the game engine scene and it heavily pushes C# due to tightly it is integrated with it (So yes large parts of Unity are also written in C# to facilitate that, but the core parts of the engine are not).

--- End quote ---

So for UE4, again no this is not true. A C# .dll is really different than a C++ .dll. You can't really plug a c# .dll in a c++ application (the reverse is possible though). You need a CLR to run c# code. UE4 do not contain a CLR and run exclusively C++ code.

Also about .dll, on consoles (xbox, playstation) .dll are possible but are still not immensely popular. A huge monolithic executable is still preferred by the 1st party (Microsoft and Sony).


--- Quote from: Berni on May 07, 2020, 01:16:16 pm ---These non compiled languages are attractive for the reason that they run on any platform out of the box and they offer a lot of rich debugging functionality regardless of platform. A lot of the time these modern game engines even allow for modification of code as its running live (even when running on a remote system like an Xbox or PS4). So it makes sense to use things like C# for game code in order to speed up development. Later on this also becomes usefull for any moding API pr plugins as they can tap into the code on a high level rather than essentially acting like a virus to tap into functions and memory.

--- End quote ---

This is also not true. C# is a compiled language and it's not interpreted like python. Like Java it's compiled to an intermediary language that most of the time really look like x86 assembly. The IL then run in a runtime environment adapted to the targeted platform. So the idea is that your business code in IL stay agnostic of the platform.


--- Quote from: Berni on May 07, 2020, 01:16:16 pm ---Yes you would not write an entire game in C#, but quite a lot games released in the last 10 years are running the high level game logic inside Mono due to the benefits that JIT compiled languages offer.

--- End quote ---

Like I said Mono and even Microsoft CLR are far too slow to run a game. Even in Unity, which use C#, they created a C# IL code converter (IL2CPP) to be able to convert your C# code in C++. The C++ code is then compiled natively to suit the targeted platform. I think the only exception is Windows PC where some game are kept C# over Mono or MS CLR. All other platforms (Phones, Xbox, Playstation) run native code.

Overall C# in a game is a really bad idea. The trend right now is to create a Visual Scripting language like Blueprint in UE4. The Visual Scripting language run on top of C++ and performance can be managed.

Berni:
Yes i know there are differences between a machine code DLL and a CLR DLL. But UE4 will handle it with a simple plugin.

And yes C# is indeed not interpreted directly like Python. Its crunched into the .Net IL and this is then JIT compiled to platform specific machine code on the fly. This is the reason why C# is actually really fast, it only needs to be compiled once, then the code is essentially machine code. Sure it might not be the C level of performance, but its not that far behind. Hence why it does end up used in games so often. Most of the complex gameplay related game code is not being executed all the time so it does not matter if the code runs half as fast as it could in C++, it won't run often enough to visibly degrade performance, yet the creature comforts of the C# language make its development and troubleshooting significantly faster (this game logic is often a lot more complex in terms of many more variations in behavior, more variables etc). Games are huge and have long load times so recompiling a game for each test run is not desirable. For this reason a lot of games in the last 30 years have some sort of non precompiled language inside it(Lua used to be popular for this), it makes game development easier, since the non programmer person plonking down game NPCs can just quickly edit a file in notepad while the game is running. The only difference with C# is that its the first such popular language that is performant enough to be used for a lot more than just simple NPC behavior scripts that run once every few seconds. Go have a look at some C++ vs C# benchmarks and see how close to C++ performance it actually is.

I have looked at my Steam install directory and out of the 40 games installed 19 of those games had a folder named "mono" full of windows mono dll files. So it is safe to say a significant part of games make use of of it. Tho by now core.Net is replacing mono by doing the same job.

Still yes you would not write the entire game engine in C#. You do want all the performance you can get out of the low level loading and rendering functions, you want native calling of other native DLLs etc. But for high level game logic the small performance penalty is really not a big deal as its so small that the other benefits make up for it. Besides the big AAA publishers that do make there own C++ engines end up slapping ever larger DRM methods (decrypting the machine code as its running) and this results in very significant drops in performance of 10 to 50% in tests (People got there hands on a DRM free version of the same game to compare the DRM impact)

My point is that non C++ languages are used a lot in game development because they have advantages that outweigh the performance cost. They are still not a replacement for C++. But for the usual one man band engineer writing software to run on a PC with GUI the whole C++ thing is usually not a good fit. The slight performance gain is not justified by the extra time, effort and expertise required. If raw performance was the main metric then everyone would still be doing assembler.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod