I've been doing research on good tools to create games with, and I came across Monogame, Sharpx, and XNA. I have some questions regarding each:
When I create a new windows project (which advertises that it uses DirectX 12), the code template looks like this:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
I understand Monogame is a re-implementation of XNA, but where is the "re" part? This code shows Monogame using Microsoft's XNA, and doesn't even hint at the usage of DirectX 12.
SharpDX has an advantage of using WinRT (so i've heard), but what exactly does that mean to me? I know that SharpDX is a layer that sits on top of DirectX to allow it to be used in C#, and naturally should use WinRT. What excuse does Monogame have not to use WinRT?
I feel I'm confused at something and want clarity. Keep in mind that I'm a total noob at this stuff, anything helps!
MonoGame is indeed a reimplementation of XNA. It uses Microsoft.Xna.Framework.* namespaces to preserve source code compatibility with XNA projects. MonoGame does not currently support DirectX 12 - the desktop version has DirectX 11 and OpenGL backends.
It provides simple, cross-platform classes for common game tasks (loading content, rendering, sound playback, etc.) and a pipeline for building runtime-optimized content files. MonoGame is really powerful for most projects and great for quick development, though not a fully featured game engine like Unity. Since it is modelled after XNA (discontinued a few years ago), most XNA samples/tutorials work just fine.
SharpDX is a low-level wrapper of DirectX types. You should go with it only if you want to get your hands dirty with low-level plumbing, which doesn't appear to be the case.
The DirectX implementation of MonoGame (used for classic Windows, UWP, and Windows 8 apps) internally uses SharpDX for communicating with DirectX. When it comes to WinRT, it is just an implementation detail of "modern" Windows app platform.
Wikipedia has a few pages on the history of XNA. In short it is no longer supported. MonoGame extends it. SlimDX and SharpDX use their own DirectX wrappers and are basically copies of each other. Going by a recent post SlimDX future
It will not be continued. I do not know MonoGame but am strong in SharpDX and it provides current support for DirectX 12. If you also want to use OpenGL, you could try ANX but I do not know it. The SharpDX guy also wrote a Collada class which is on GitHub and there is an Assimp class that is compatible. None of the above have an integrated physics system but PhysX for .Net works fine with SharpDX.
In summary if you only need Direct X for C# then SharpDX would be the most straight forward choice. If you think you might expand to other platforms, you might want to check out MonoGame or ANX but I can't vouch for either. None of the above mentioned are complete Game Engines (such as Unity or UE4) they simply allow the use of features such as DirectX that are not natively supported by Visual Studio C#.
Related
I've recently started about thinking about making a 2D game engine in C# from scratch.
Now, I've wondered: In java, I'd use the java.awt.Graphics2d and java.awt.Container classes.
What would you suggest me to use in C#?
Apparently, google couldn't help me with that one.
In .NET you could use Windows Presentation Foundation, it offers a great lot of graphic-manipulation. But if it fits to create a game-engine, I am not sure.
See MSDN for an overview.
Though, if you really want to have power, you should stick with DirectX and C++.
Note: there is FNA and MonoGame (both reimplementations of the now discontinued XNA), but they are both frameworks for creating games, not creating a game engine...
You can easily build games (2D/3D) with FNA or MonoGame (reimplementations of the now discontinued XNA). They aren't engines but they are both a layer architecture for simple DirectX-usage.
If you're looking for image manipulation within Windows Forms (PictureBox, Draw()-method overrides) you should have a look at System.Drawing.
I would like to develop a game for windows 8, but since Xna isn't supported, i don't really know, if it is good to use something like MonoGame - because i think, it doesn't make any sense to use MonoDevelop with OpenGL while the UI Frontend runs with DirectX. But my searches and on "apptivate.ms", they still force the developers to use MonoDevelop - but why would a corporation like Microsoft even do this?
And i don't like to build my game in C++ with DirectX, because in my case, it's not a big game, and my favorite language (also, my language at work) is C#..
Btw., it would not be a big deal for me to write this game with OpenGL or C++, because I've got a lot of experience in these two for the past four years, but in this case, i like to have a "fast" and "save" solution like C# and a Graphics Framework.
So... maybe someone has the answer to these qustions:
Should i use MonoGame with Xaml / C# and don't worry about the mix of DirectX and OpenGL?
Or is there even another DirectX/Game Framework which i can use?
Or maybe, i'm totally wrong, and Xaml doesn't need DirectX? Or i can force MonoGame to use DirectX?
Or, another point - would something like "System.Drawing" fast enough for a spaceshooter with some nice shading effects (I think, for my case, i need shading and something like bloom, blurring etc.)? Maybe, Microsoft added a new 2D drawing library? (But i think its still gdi+ )
Your question is ambiguous if you are referring to Windows 8 Metro (aka Modern) or Windows 8 Desktop, but I assume it's the Metro version.
If you want to develop a game in C# for Win8 Metro without using a commercial solution, you can use:
SharpDX which is a low level DirectX API for .NET or the up-coming SharpDX.Toolkit (check latest news on the website) which is a high level framework around Direct3D11 (with a XNA like API, but with full Direct3D11 support). SharpDX is the only C# wrapper covering the whole DirectX API that is certified to work under Windows 8.
MonoGame which is using SharpDX for its Metro backend. I haven't heard that you need to use MonoDevelop for it, as it is working with an existing XNA project and VS 2012 should work just fine.
ANX which is also using SharpDX for its Metro backend.
Concerning the previous answer, If Win8 Modern is assumed, you can't use OpenTK, as OpenGL is not a certified API for the Microsoft App Store and SlimDX is not compatible with Windows 8 Metro.
There is an OpenGL to DirectX wrapper in the works that allows use of OpenGL in Windows 8 Modern applications. It's not complete yet but it may be sufficient if you want cross-platform compatibility and are willing to target only the subset of OpenGL that is implemented (or are willing to implement the rest yourself and hopefully contribute back.)
https://gl2dx.codeplex.com
Update: gl2dx seems to be dead as of November 2013, but there is a similar project, ANGLE, which implements most (if not all) of the OpenGL ES 2.0 spec and the EGL spec on top of either DirectX 9 or 11. This is the method by which Firefox and Google Chrome do WebGL on Windows.
http://code.google.com/p/angleproject/
If you want to use OpenGL and c#:
http://www.opentk.com/
For DirectX and c#:
http://www.slimdx.org/
or
http://sharpdx.org/
GDI+ is out bounds of Metro/Modern UI apps, if you're interested there some companies that look to make replacement apis like this one: http://www.moderncomponents.com/products/DrawingLibrary/, it's still in it's early stages, but looks good and may help you to create some simple games.
Is there any scene graph implementation for Windows Forms in .NET? It doesn't need to be free, but it can't be WPF.
I have to create a part of a bridge and color the stress accordingly. Interactive rotation would be nice, as well as zoom. I think DirectX or OpenGL would be fine.
A custom solution via XNA seems too complicated. I rather want to use a library, which provides higher level objects - optimally a scene graph, minimally triangles and light.
ILNumerics provides a scene graph in 3D. And supports Windows.Forms. Here are some examples.
Edit: It for sure is free: GPL version 3
You can do XNA rendering within Windows Forms it seems:
http://www.google.com/search?q=xna+windows+forms
There's SlimDX which wraps DirectX for .Net. I've gotten samples to work, but I'm new to 3D programming and there isn't much documentation on how to use SlimDX beyond the simplistic tutorials.
Unity3D is a game engine which might meet your needs with a straight-forward installation and 3D modeling import and view. No step-through debugger though, if that matters.
XNA might be a good choice, but I switched to evaluate SlimDX because of some concerning limitations Microsofts forces in networking gamer-services I saw early on. It made me think there would be other limitations that I wouldn't be able to bypass. Also, I was interested in more flexibility in performance and higher-quality realtime effects than I believed that XNA can provide. I'd be interested in others thoughts on whether such fears about XNA are founded. Perhaps they're not an issue for your stress visualization project.
I want to program for DirectX in C# and i have DirectX SDK,
what kind of project should be choose ? Windows form or ....
You should ask yourself first: What's the purpose of my project?
If you intend to building applications with beautiful 2D-3D visuals, then you just need to learn WPF.
On the other hand, if you wanna build games that require a lot of resources, XNA is the way to go.
Building applications on XNA is a lot of pain, since XNA is built for gaming.
The same can be said about building games with WPF.
In both cases, you don't need to communicate natively with DirectX (Which could be done via C++). Unless you're building a low level rendering engine, or a (very) high budget game.
You should use XNA, that is the replacement for Managed DirectX C#
Microsoft XNA ('XNA's Not Acronymed) is a set of tools with a managed runtime environment provided by Microsoft that facilitates computer game development and management. XNA attempts to free game developers from writing "repetitive boilerplate code" and to bring different aspects of game production into a single system.
From Wikipedia XNA Article.
Unless you want to just render windows but WPF might be the best options. See this blog post.
XNA:
XNA is a game oriented framework that allow you to target multiple hardware easily (Windows, the Xbox 360, Zune and now Windows Phone 7 with version 4) using .NET languages like C#.
Note that there's not a 1-1 relation between XNA and the DirectX SDK, for instance, it doesn't expose D3D10 or D3D11 or some interfaces that you can find in D3DX.
.NET Wrappers:
If your are looking for something similar than the native DirectX API, you have 3 options:
Windows® API Code Pack for Microsoft® .NET Framework:
wraps a bunch of Windows native libraries such as DirectX so they can be used from managed code. Note it doesn't expose API's prior to D3D10 such as D3D9.
SlimDX: Same thing but only for DirectX and exposes Direct3D from version 9 to 11 (SlimDX is an aside project that is not related to Microsoft).
C++/CLI and DIY the wrapper: Unless you have special needs, I wouldn't recommend it.
The final choice depends on your needs. If it's just for learning purpose of the DirectX API but in C#, I would say pick the Windows API Code Pack or SlimDX.
How could I run a game made with XNA on the iPhone/iTouch? Which steps/tools (existing ones or imaginary...) should be used?
Note: The goal is to avoid modifying existing C# code
UPDATE :
If I understand correctly, I must be able to:
Run my XNA code on Mono (monoxna or SilverSprite, promising?)
Run Mono on iPhone (MonoTouch)
Not only is it possible but here is a video of someone doing XnaTouch on MonoTouch: First game to IPhone build with XnaTouch (XNA for IPhone)
Here is the mono article about doing it http://www.mono-project.com/MonoTouch
I don't believe there is a good answer to your question. XNA doesn't target the iPhone, so the chances of being able to effectively port an XNA game without modifying the C# source code isn't likely to happen.
Instead, I'd recommend that you take a look at the various frameworks that exist to help you craft cross-platform games. Unity often comes up in these discussions, but it isn't free.
If cross-platform isn't your goal, but free iPhone development is, then I'd recommend looking at Cocos.
Edit: The MonoTouch project may be able to assist you in the future, but doesn't help you out right now. Still, it's something to keep an eye on.
Edit: The landscape has changed a lot in the ~5 years since this question was posted. If you have an XNA project that you want to get running on iOS, then Xamarin.iOS (formerly MonoTouch) plus MonoGame is a near-perfect fit. MonoGame is missing a huge chunk of the XNA content pipeline, which means you'll either have to abandon it or have a VS2010 instance somewhere compiling your assets.
The MonoTouch project may eventually help here, since it allows you to write C# targeting the iPhone (it is statically compiled to native code).
MonoGame is a free OpenGL implementation of the XNA 4.0 Framework. It is built upon the excellent range of Mono compilers and is compatible with MonoTouch (iOS), Mono for Android (Android), MonoMac (Mac OS X), Mono for Windows and now Linux!
A list of 12 games currently using MonoGame that are on the Apple iOS App Store can be found #
http://monogame.codeplex.com/
https://github.com/mono/MonoGame/wiki/Released-Games
I believe XNA depends on Direct3D 9 (see http://msdn.microsoft.com/en-us/xna/aa937793.aspx), which may hint at the hurdles one might encounter in both porting to mono as well as having sufficient graphics horsepower on iPhone.
Everyone saying this is possible because there are CLR libraries for Mono, does not even think about the fact that XNA is a WHOLE DIFFERENT set of frameworks:
"The XNA Framework class library is a library of classes, interfaces, and value types that are included in XNA Game Studio."
As another responder noted, this is so far from happening it's not even funny. If you really want to write a game I'd check out Unity. It's commercial, but it looks utterly impressive and you can script your game logic in Javascript or (here's the funny part) C#!
Yes, instead of going through a ton of work to port a whole framework because you want to write a game in C#, why not just use a framework that lets you do that today?
From the horse's mouth:
MonoTouch + SilverSprite = XNA 2D
games on iPhone? :)
What Bill means is that it will eventually be feasible to write a 2D XNA game, then use SilverSprite to run it on Silverlight, then use MonoTouch to run it on the iPhone
This space is definitely heating up. There is now an XNA Touch project on codeplex that aims to bring the XNA API onto the iPhone/iPad platform:
http://xnatouch.codeplex.com/
'Maybe' you could just change XnaTouch's namespace to match those of existing Xna code (i.e. Microsoft.Xna.Framework.*), when developing a MonoTouch project? This could be done on a vendor fork (copy) of the XnaTouch code, easy to manage using Git, Mercurial or Piston etc.
I'm unsure as to whether the XnaTouch team would undertake such a change on its own codebase, so this is probably best done on your own, personal, code branches (interestingly, the Mono.xna project uses the original Microsoft.Xna.Framework.* namespaces, I'm unsure why XnaTouch chose not do so).
JFYI, the current XnaTouch (v1.0) follows Xna 4.0 quite faithfully. I've found a [small] few missing method calls, which I've 'implemented' to throw not implemented exceptions (?). The original-xna4-and-modified-xna-touch code does compile, now I need to implement iphone-specific gui and handling etc.
Hope this helps someone.
Cheers
Rich
For starters you would need a CLR implementation on the iPhone, which doesn't exist at the moment, but it seems someone is trying: MonoTouch.
A friend of mine is developing an architecture port of XNA 4.0 for the iOS platform. It's of course written in Objective-C, but it has the feel of XNA. He has published the source under LGPL at http://code.google.com/p/xni/.
Xna is not officially supported on iPhone; however, you could use ExEn (http://exen.codeplex.com/) or MonoGame (http://monogame.codeplex.com/) to port your Xna games. A bonus for using either of these is that they support Mono for Android.
If you're looking for a free cross-platform sort of thing, you could check out phonegap. I don't have any experience with it but it looks cool.
http://phonegap.com/