Jump to content
  • Advertisement

Recommended Posts

Hello,

So I have been programming with C++ for 2.5 years now. I have been interested in checking out C# for fun. My question is pretty simple. Does C# use a form typically for their games? The simple game examples I have watched on YouTube reminds me A LOT of Visual Basic. 

Was this just an easy way to show you C#? Or using the form is a big part of C#? Or is it nothing more than using something like MFC and completely irrelevant to making games?

Thanks

Share this post


Link to post
Share on other sites
Advertisement
Posted (edited)

C# can be used for a wide variety of things, not just Forms.  You can use it with Unity to make games.  You can use it with ASP.Net Core to make web pages or web services.  You can make command line tools.  You can port to various other operating systems (not just Windows). 

There are a lot more things you can do with it than I could even list.

It has the same sort of of variety you have with C++ (not exactly the same, but very flexible).

Edited by Nypyren

Share this post


Link to post
Share on other sites
7 hours ago, RamblingBaba said:

Or is it nothing more than using something like MFC and completely irrelevant to making games?

MFC is obsolete and it is replaced by C# forms. The difficulty for using C# in games is that any library is first exposed by C++ and you need to build CLI layer to use it inside C# modules. C# as managed language runs over unmanaged C++ libraries as for OS resources (sockets for example), and has only basic types/operations included as isolated.

Share this post


Link to post
Share on other sites

Forms, especially Winforms are obsoleted too and have been replaced by WPF. You can run your game in C# even if there are some libraries written in C++ you need like OpenGL for rendering, they could be included into your C# code via C++/CLI (not recommended) or the more flexible p/invoke layer using DLLImport Attribute and the function signature. The other way round is a lot harder to achieve because you need to provide a CLR in your C++ application to run C# in the same process but you could also run the C++ and C# in different processes and just communicate via IPC.

C# can also be transpiled into native code using either IL2CPP or from this GitHub project IL2CPU, an x86 assembler to run directly on the hardware without any OS arround it

Share this post


Link to post
Share on other sites

Well, Visual Basic and C# are both Microsoft's domain. So that's why you might see similarities there. Personally, though, I think they're both very different. For me C++ looks different from most other languages. So that might also have lead to your impression.

I believe there is no such language that is inherently better suited for games than others. You could do a whole Game based on JavaScript. Sure, some engines use other languages than others. But you're not confined to a specific engine to realize your vision, are you?

The forms, you mentioned are part of Microsoft's .NET framework work and I believe they work with Basic just as well. Though, I'd rather not because MS has restructured their whole desktop thing with the new apps they have. Also, Unity, for example, handles forms in a totally different way.

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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!