So it has been a while since I have done any game programming in C#, but I have had a recent bug to get back into it, and I wanted some opinions on what configuration I should use.
I wanted to use C# as that is what I use for work, and have become vary familiar with. I have worked with both DirectX and OpenGL in the past, but mostly in 3D, but now I am interested in writing a 2D game with all vector graphics, something that resembles the look of Geometry Wars or the old Star Wars arcade game.
Key points I am interested in:
• Ease of use/implementation.
• Easy on memory. (I plan on having a lot going on at once)
• Looks good, I don't want curve to look pixelated.
• Maybe some nice effects like glow or particle.
I am open to any and all suggestions, maybe even something I have not thought of...
Thanks in advance!
If you're just starting out again and already have a C# background, why not try XNA? You'll definitely be able to leverage your C# skills here
http://creators.xna.com
http://creators.xna.com/en-US/downloads
I use SlimDX for C# graphics programming and I prefer it to XNA.
http://slimdx.org/
TBH it doesn't really matter what you use. OpenGL, SlimDX, or XNA. They'll all be about as complex (or not as the case may be) as each other.
You might consider using the Axiom engine, which is a C# port of Ogre3D. It's enough higher level that you can have it render your graphics via XNA or OpenGL with little or no change to your code. It can also handle keyboard and mouse input (which are normally separate -- e.g., via DirectInput on Windows or SDL on Linux).
You also might consider using TAO Framework which is OpenGL based and quite nice. But you have to write the 2D Engine all by yourself tho. It also works on Mono!
I create my OpenGL engine with a C# wrapper because I like C# a lot too. Sadly managed languages are very slow when it comes to graphics and that's why I always make my OpenGL part in C++, compile it as a DLL and get it from C# using interop. If you by any chance dislike DirectX than I suggest you stay away from XNA. Everybody I know is very dissapointed about it and switched back to C++(OpenGL) + C#.
Since you already know C# I'd use XNA or Unity. While there are faster languages and middlewares, they're probably plenty fast enough. Both frameworks would have the necessary features you require.
Related
I created a Game in C# (Multi-player Tanks Game) using Windows Forms Tools (Panels, shapes, buttons, etc...) but the Animation and Graphics are just so poor, so is there any Type of simple Graphics or Animation to use in C# to make this game a little better, can I use flash in C#, anything?!!!
XNA is great, its a completely different technology to Windows Forms as its based on DirectX.
Another idea is to check out silverlight or WPF depending on how complex your game is. For simple 2D games with not too busy screens it might be a lot easier than XNA.
I found a great example of building a multiplayer game in WPF.
I would recommend having a look at Microsoft XNA.
I'm pretty sure if you want to improve the graphics of your game you're going to have to use design software or hire someone to do it for you. A simple look up on Google will direct you to model development software.
A good place to start is the microsoft XNA framework.
I also recommend using Blender: http://www.blender.org/
It's a completely free open source 3D model creation program.
There are many librarys and ways for game development in C#.
I prefer to use XNA, which is based on DirectX and developed by Microsoft itself.
But there are also many other wrapper like OpenGL wrapper SharpGL, a custom DirectX wrapper SlimDX or using the plain DirectX SDK.
Some time ago I was looking for libraries or frameworks to improve winforms experience with nice animations. My best options were XNA or OpenTK (OpenGL) and SDL.Net.
I have done some looking and I can't figure out a good way to write a 2D tile/sprite based game in C# for Win8. According to the MSDN documentation:
You can use managed code languages like C# and Visual Basic to develop 2D (and lightweight 3D) games.
The problem is that I can't figure out how to do this. The reason I would like to use C# is because I already have a lot of code written for Windows Phone that I would like to reuse.
Can anyone point me to how I would write a fairly efficient 2D tile/sprite MetroUI game for Win8? The only thing I can find uses C++ and DirectX.
[EDIT]
To clarify I do not care too much what I use (WinRT, DirectX...) so long as I can submit to the app store, and write my code in C#.
If you are familiar with the DirectX API, you can use SharpDX available via http://sharpdx.org. It is basically exposing DirectX APIs into C#. From my understanding, if you are going to upload apps to the store, the SharpDX should be fine and pass compliance, but I would look into it further before going too deep.
Also, as of this time, not all of the features are available (like Direct2d not fully certified for Win8 Metro).
If your game uses simple graphics, you can use Drawing Library for Modern UI, it exposes a GDI+ like interface to be used in XAML/C#/VB.NET Windows 8 Modern UI applications, it works by drawing to a XAML Canvas.
If you're looking for something quick and easy check out the "Physics Helper XAML" project;
http://physicshelperxaml.codeplex.com/
It's based on the farseer engine, and comes with sample apps. There are a few games already released using it.
http://www.andybeaulieu.com/Home/tabid/67/EntryID/223/Default.aspx
Have a look at:
[XAML images sample] (http://code.msdn.microsoft.com/windowsapps/0f5d56ae-5e57-48e1-9cd9-993115b027b9/sourcecode?fileId=102748&pathId=677969581)
The page and samples give some code for NineGrid and WriteableBitmap Image manipulation.
You can now use Win2D (open source, released by Microsoft for metro/WinRT apps) which provides hardware-accelerated 2D graphics rendering.
I want to write a simple game like pacman in C# in order to learn
the new language.
However, I don't know how to make a circle move?
Which part of knowledge in C# is needed?
You should check out XNA Game Studio from Microsoft. It's a version of Visual Studio that's targetted especially for writing games. You use C# but get a lot of things for free - graphics, sound, timing...
Here's a tutorial for making a ball move in XNA.
The simplest way would be to move your circle a small bit with every tick of a timer control.
If you want to learn a new language stay away from all fuss and just look into the most essential parts.
Having knowledge about previous programming languages helps a lot, espesially if one of those are Java.
You don't need to look into XNA for this, all you really do need is to Start Visual Studio, create a new Windows Form, drag over an PictureBox and start playing with the KeyEvents.
Your game does not have to be awesome for you to learn the very basics of C# and .NET. And you certainly don't need to dig down in the deep jungle of XNA!
Once you have your form up and running with a PictureBox or two and you have conqured the Event-system, take a look at the other fundamental parts of .NET that makes your life easier. Properties, Generics, Data Sources and much much more.
Well, for a simple single player game like that, some of the most important things you need to know about are data structures and GDI.
Data structures are important because you need to store information such as what does a map look like? Where are the walls? Can you go from one end to the other? How does the map draw itself?
GDI is used in C# to draw. This uses the Graphics context. You'll find lots of examples online, and I'd suggest checking out BobPowell.Net GDI+ FAQ to avoid some of the common mistakes.
You probably want to look into XNA - http://creators.xna.com/
Simply download the studio, install, then run Visual Studio C# (mine is Express Edition).
So when you run, you create a new Windows Game Project and you've created your first game.
Good to read up some books and articles on XNA.
Book: Microsoft XNA Game Studio 2.0: Learn Programming Now! by Rob Miles.
if you mean how to move an object around in a circular movement, then you just need math knowledge:
int circlePosX = centerX + Math.Cos(degrees) * radius;
int circlePosY = centerY + Math.Sin(degrees) * radius;
radius is here how big you want the circle to be, and degrees is the position ion the circle the object is moving.
Here's an answer to a question about a radar-type game that demonstrates generally how to do this in C#/WinForms using GDI+ (with a sample and source code):
What would be the best way to simulate Radar in C#?
I'm making a turn-based top-down game in C#. The graphics requirements are pretty simple: it's entirely 2D, requires drawing some images taken from graphics files (perhaps rotating them first), line drawing to make a hex grid and the ability to place text at any position on the screen.
I'm wondering what the best API is for doing these graphics. Is XNA overkill for this, is there something more appropriate? Thanks (I have zero experience of graphics or game development in .net so don't be afraid to dumb-down any answers).
I'd recommend XNA for this. If you don't want some of the overhead of XNA, I've found SlimDX to be a very nice little framework. They also provide some basic game classes to make this type of thing easy.
Doing your drawing directly in WPF is also fairly easy, but more difficult to extend later. XNA and SlimDX give you access to shaders, very fine grained control of alpha blending, as well as the potential to easily extend portions into 3D later if needed.
I've used the Farseer Physics engine before which was pretty cool and extremely easy to pickup (I am an enterprise developer, not a game developer). It works for Silverlight so you could actually make your game web based. I would suggest silverlight or WPF for 2D.
http://www.codeplex.com/FarseerPhysics
I would recommend WPF. Loading your graphics and moving them around should be fairly easy. Since WPF also is vector based, your line drawing is straight forward.
XNA would be the next step. Great support for sprite graphics and also gives you access to shaders.
If it is as simple as it sounds, and not even real-time, maybe you don't need any of this stuff. Drawing a hex grid and some images should not be hard even without a game engine. Maybe WPF would be good for this.
Given your requirement you could just use plain C# and the GDI (for 2d rastering). However learning XNA is easy enough, and it'll serve you well once you decide to make a realtime game (2d or 3d) down the road. Either way have fun, and if XNA seems to complicated when your starting out, just drop back to GDI. Making games should be as fun as playing them :)
XNA sounds like a good choise (it will better than using DirectX SDK !! and it is quite easy to learn)
You can do this by just using classes inside the System.Drawing namespace. And XNA is certainly overkill for this type of stuff. Also you would introduse many dependencies for your small game which might be an unwanted thing for your gamers.
Check out Unity 3D - it's based on C# and it can be used for 2D. It might be overkill (including price), but for game development it's in general HUGE help.
Hi i want to write a game with a main game form and lot of other normal forms. What is the best way to manage update-paint cycle in that case?
Should the game form paint loop only should be overriden? or should i do an application.do events() in the main method?
Please guide me regarding this. i am new to windows forms world
The body of the question doesn't mention Compact Framework, just Winforms. This is pretty much the accepted answer for Winforms from Tom Miller (Xna Game Studio and Managed DirectX guy from Microsoft):
Winforms Game Loop
#Rich B: The game loop is independent of how the rendering is done (DirectX, MDX, GDI+)
Your logic thread should be separate from the form, so you won't need DoEvents(). If you're using GDI+, then you should force an Update() on a loop. Windows Forms doesn't do double buffering very well, so depending on how sophisticated your graphics will be you might have some difficulties with flicker.
My suggestion is to look at using the DirectX managed library. It's a lot to learn, but gives you everything you need.
EDIT:
I have been reading recently about WPF, which seems like a much better platform for simple to moderately complex games, because it provides a much higher level API than the DirectX managed Library. It probably has performance and flexibility limitations for more complex games, however.
If you are making a game, you should be looking into DirectX, OpenGL, or XNA.