Game Development with .NET
We’ve launched a new Game Development with .NET section on our site. It’s designed for current .NET developers to explore all the choices available to them when developing games. It’s also designed for new developers trying to learn how to use .NET by making games. We’ve also launched a new game development Learn portal for .NET filled with tutorials, videos, and documentation provided by Microsoft and others in the .NET game development community. Finally, we launched a step-by-step Unity get-started tutorial that will get you started with Unity and writing C# scripts for it in no time. We are excited to show you what .NET has to offer to you when making games. .NET is also part of Microsoft Game Stack, a comprehensive suite of tools and services just for game development.
.NET for game developers
.NET is cross-platform. With .NET you can target over 25+ different platforms with a single code base. You can make games for, but not limited to, Windows, macOS, Linux, Android, iOS, Xbox, PlayStation, Nintendo, and mixed reality devices.
C# is the most popular programming language in game development. The wider .NET community is also big. There is no lack of expertise and support you can find from individuals and user groups, locally or online.
.NET does not just cover building your game. You can also use it to build your game’s website with ASP.NET, your mobile app using Xamarin, and even do remote rendering with Microsoft Azure. Your skills will transfer across the entire game development pipeline.
Available game engines
The first step to developing games in .NET is to choose a game engine. You can think of engines as the frameworks and tools you use for developing your game. There are many game engines that use .NET and they differ widely. Some of the engines are commercial and some are completely royalty free and open source. I am excited to see some of them planning to adopt .NET 5 soon. Just choose the engine that better works for you and your game. Would you like to read a blog post to help you learn about .NET game engines, and which one would be best for you?
Online services for your game
If you’re building your game with .NET, then you have many choices on how to build your online game services. You can use ready-to-use services like Microsoft Azure PlayFab. You can also build from scratch on Microsoft Azure. .NET also runs on multiple operating systems, clouds, and services, it doesn’t limit you to use Microsoft’s platforms.
.NET has a rich set of tools
All the .NET tools you are used to also work when making games. Visual Studio is a great IDE that works with all .NET game engines on Windows and macOS. It provides word-class debugging, AI-assisted code completion, code refactoring, and cleanup. In addition, it provides real-time collaboration and productivity tools for remote work. GitHub also provides all your DevOps needs. Host and review code, manage projects, and build software alongside 50 million developers with GitHub.
The .NET game development ecosystem is rich. Some of the .NET game engines depend on foundational work done by the open-source community to create managed graphics APIs like SharpDX, SharpVulkan, Vulkan.NET, and Veldrid. Xamarin also enables using platform native features on iOS and Android. Beyond the .NET community, each game engine also has their own community and user groups you can join and interact with. .NET is an open-source platform with over 60,000+ contributors. It’s free and a solid stable base for all your current and future game development needs.
Learn more and start developing
Head to our new Game Development with .NET site to get an overview of what .NET provides for you when making games. If you never used Unity, get started with our step-by-step Unity get-started tutorial and script with C# as quick as possible. If you’re looking for tutorials, videos, and documentations to get your started, head to our new game development Learn portal for .NET for more resources.
Show us the work you do for .NET game development
We’d love to see the work you do for the .NET game developer. Please reach out to us if you’d like us to talk about the games you’re making, the APIs you’re developing, the plug-ins you’re distributing, or any .NET project remotely related to game development. Did you write a great blog post, or just read one? Do you want everyone to know about an amazing new .NET game development contribution or a useful plug-in or tool? Do you have an analysis of game development pipeline using .NET?
We’d love to hear from you, and feature your contributions on future posts:
- Leave us a message in the comments section below
- Send Abdullah (@indiesaudi) tips on Twitter about .NET game development.
I would like to present https://github.com/StbSharp, which is C# port of the famous C gamedev library named stb.
Or – in other words – StbSharp is pure C# framework that allows to do following things:
– Load Images in in JPG, PNG, BMP, TGA, PSD and GIF formats.(StbImageSharp)
– Write Images in JPG, PNG, BMP, TGA and HDR formats(StbImageWriteSharp)
– Rasterize TTF fonts(StbTrueTypeSharp)
– Encode images in DXT format(StbDxtSharp)
– Decode Vorbis(StbVorbisSharp)
Oh thank you. It looks interesting. Do you know any engines that use this port?
MonoGame uses StbImageSharp and StbImageWriteSharp.
I didn’t know that. That’s cool. If you want to write a blog post about it, reach out to me on twitter.
My (custom) engine uses StbTrueTypeSharp and it works like a charm! Thank you, Roman, you rock.
In fact,, rn I work upon simple engine-agnostic text rendering lib that’ll use StbTrueTypeSharp too: https://github.com/rds1983/FontStashSharp
Why not restart XNA project? Many people want it. Game developers need an official game engine supported by Microsoft.
If Microsoft can’t purchase Unity, then restarting XNA project is a good choose.
Somehow, you’ve got the idea that anything that has Microsoft’s name on it must be great. I don’t have to elaborate on how unpopular this idea is, because everyone knows. We all remember what happened to the largest worldwide vendor of mobile phones and smartphones in 2014.
That said, for a project to start (or restart), there must be manpower, potential market, potential profit, and competitive advantage.
I agree. Additionally, there should be more support for mobile platforms.
There is MonoGame, as well as FNA (an accurate representation of the XNA API) available here https://fna-xna.github.io/. There are also all those other Game Engines using .NET in the ecosystem. There are a lot of choices for .NET developers when making games. Thanks for making your voice heard here, its essential for the health of the community going forward.
Monogame is a fantastic step up from what XNA was, and I’d highly recommend it. While not being officially supported my Microsoft, it has basically everything you could need–especially with the Monogame.Extended packages. It’s very quick and easy to get started and supports a TON of platforms:
Monogame is basically the continuation of XNA project. It doesn’t need to be supported by Microsoft to be good.
Why do you guys keep mentioning SharpDX when the project is dead, as the developer got fed up writing bindings to DirectX?
After killing Managed Direct X and XNA, it puzzles me that Microsoft is so resistant to providing proper .NET bindings to DirectX.
Even with the big push for WinRT/UWP adoption, every time the question was raised, why no UWP bindings are provided for DirectX (it is after all COM based), we either get evading questions, or as of Reunion (we don’t have time for it).
It would be nice that for promoting .NET game development, Microsoft would stick to it and actually provide first party DirectX support instead of hoping for community work and their partners.
Ideally I’d like to see Microsoft take over SharpDX and integrate it into .NET outright (after getting it up to speed with the latest Direct3D features).
Thank you for your insights. SharpDX continues to be used in engines like MonoGame and Stride and WaveEngine. It’s open-source and can be forked and maintained by new folks. Thanks for making your voice heard here as its essential for the health of the ecosystem.
For a bit of fun and nostalgia I have written a simple game engine in C# WPF called “SpecCore”, inspired by the fun times I had with my Sinclair ZX Spectrum as a teenager. It’s certainly not going to be the next Unity, but if it takes someone back to their lost youth then it has done it’s job!
You can find the project here: https://github.com/andyste1/SpecCore
Thanks for sharing that. I hope some folks find it useful.
How come Monogame and Godot are not in this post? They are pretty popular and aspiring game devs should be aware of them
They are extensively discussed in three of the pages linked here. They mentions Unity, MonoGame, Godot, Stride, Wave Engine, FlatRedBall, CRYENGINE, and Xamarin.
FNA might be worth mentioning too. https://fna-xna.github.io/
Thanks for pointing that out. This is our first update to the site. We will continue to iterate on it.
I’ve written a 2D graphics API in C# called Gorgon, which uses SharpDX and Direct3D 11.2.
I’m surprised that MonoGame, or Godot aren’t mentioned here. It’s not like they’re unknown. Also, SharpDX is now abandoned, so it’s probably not a good idea to point to it as a resource for new projects.
Thanks for sharing your API. I hope other folks can find it here and find it useful.
MonoGame, Godot, and others are mentioned in our Game Engines page https://dotnet.microsoft.com/apps/games/engines?WT.mc_id=gamedev-blog-abhamed
The link to Microsoft Game Stack seems to be dead. It hits a 404 page.
I fixed it. Thanks for pointing that out.
Currently I don’t really know in which technology to rely on. The is SharpDX, there is SlimDX, some Vulkan impementations, some OpenGL wrappers. There was/is Win2D, then there is GDI and some proprietary implementations like VESA, Magick, SkiaSharp and many more… Managed DIrectX was abandoned… XNA was abandoned… SharpDX was also abandoned.
So on what can I rely on?
Currently I don’t really know what to take but at least for my future work there are a few essential requirements (only for short, because I can complain the whole day about the current status quo):
I would really love if some high level/high performance bindings would exist for WPF (but currently it seems way to slow) compared to GDI and it should be independent from DirectX. I hope that at least for WinUI this will be the case.
Still I also want the low-level access but the only access from WPF is going to C++/COM implementations. I assume it’s a lot of work to create DirectX bindings and I don’t know if it worth the work or if it would be better to find something more generic and platform independent,
Thank you for comments. I think they are extremely valuable. I will take all of it into consideration.
I’m working on exactly what you’re talking about: https://github.com/reignstudios/Orbital-Framework
Its an extremely cross-platform and agnostic API. Designed for speed, power and simplicity.
Much of the D3D12 layer it working good so far. Multi-GPU support will be added next and later RayTracing.
Will also have a agnostic sprite framework, audio and input frameworks as well. As well as an agnostic physics layer.
GPU accelerated vector support will also be looked into later.
You will also be able to write platform agnostic shaders in C#.
Keep in mind not ready to share this proj in a big way yet but you’re speaking music to my ears.
If you used XNA and enjoyed it, you may want to look at MonoGame (https://monogame.net/showcase) the APIs compatible, cross-platform, spiritual successor to XNA. We have it working on mobiles all the way to current gen consoles. Series X and PS5 support coming very soon. Games like Celeste, Bastion have used MonoGame in the past.
It’s OpenSource (https://github.com/MonoGame/MonoGame) and we accept PRs, if there is something that is wrong or needs adding. We recently released version 3.8.
PS. Even though I work for Microsoft, MonoGame is not directly associated with them, though they do support us by getting the word out.
Hi, why not considering stride3D, formerly xenko, a MIT licensed game engine using sharpdx as its core rendering. Support all major graphic library DX12 and vulkan is among supported backend.
Its work more “closely” with c# than Unity does.
If by any chance microsoft can be their gold sponsor.
EDIT : Oh shoot stride is already mentioned.
I am glad you saw that.
I find none of the API’s and engine’s listed as useful, versatile and elegant as XNA was for indie game development. It is a shame MS killed it off. It is about time to bring it back, along with some proper .NET DirectX bindings.
As others noted, since Managed Dx, XNA, SharpDX etc. are all dead, there is even no proper .NET DirectX bindings at the moment – and without that, talking about “Game Development with .NET” is counting chickens before they are hatched.
Games published with engines using .NET makes up a majority portion of mobile games. They also make up a significant portion of the desktop console market. So many of your favorite games are already made with MonoGame and Unity. There are always room for improvement in the ecosystem of course.
please change the title to “Mobile Game Development with .NET” then it would be clear for most of us.
C# is the most popular programming language in [mobile] game development
Corrected. When it comes to “game development” I personally think about desktop technologies like DirectX and C++ programming.
Please differ the both, mobile and desktop.
As you might know, over half of games published currently are made with Unity across all platforms. Sure, most of those might be on mobile, since its the more mainstream option, but there are some great AAA and desktop successes with it. The Ori series from Moon Studios and Fall Guys are just two examples of that. Also, CryEngine does use .NET to enable C# scripting and that engine is mostly used for AAA development.
With fidelity lines being blurred between platforms, and the emergence of cloud gaming, distinguishing between gaming on those platforms doesn’t make sense anymore. For example, the Nintendo Switch consoles uses an ARM processor just like an android device would. Oculus uses an ARM chip with an Android based OS in their only VR headset.
Players want to play everywhere, and developers can reach players where they play with .NET.
Thank you for your answer and time I appreciate it.
Excuse me for being old school, but game development for me means DESKTOP(console) game development. Furthermore, as 3D is technology of the day, it means 3D DESKTOP game development. 2D is niche, mobile is mobile. If either was aim of your article, it should be noted.
Now that we cleared that up, let’s see what we’re left with for “proper” 3d desktop game development in .NET:
I invested heavily in XNA back in the day, built engine and tools around it, just to see it dropped by MS like it was a joke. You need to understand that it takes years of time and commitement into any of there frameworks/APIs if you want to make something real out of it. And investing that much effort into something developed for hobby by someone, that might be dropped any day, is just not an option.
So until MS provides at the very least proper DX bindings, and shows some effort and commitement, 3d desktop game development in .NET is a joke.
this comment has been deleted.
What issues are you facing using MonoGame in 3D?? We recently released v3.8 with some improvements and the devs are definitely still working on it. It is VERY much alive! It is an open source project and we contribute the little spare time we have to it.