I am considering writing a 2D RTS in C#/.NET and i was wondering what options are available for a graphics library aside from XNA. What are they?
The answers posted so far (apart from SDL.NET) have all just said to use OpenGL, DirectX or some variant of the 2. Personally, I wouldn't use either of these for a 2D game when you already have XNA. XNA already has some classes for doing 2D graphics (the main one being the SpriteBatch).
If you do use XNA, not only can you make a game that runs on Windows, but also one for XBox, Zune and Silverlight as well (Zune and Silverlight require that you don't use the 3D part of XNA though, but that shouldn't worry you). Basically, XNA will save you the trouble of writting all of the low level management code that DirectX or OpenGL need (such as handling window switching and a plethora of other problems).
I haven't used SDL at all, so I can't give you any personal opinions on it, but I have heard it is quite good for 2D graphics, so I'd recommend looking into SDL.NET or just going with XNA, the other suggestions here require a lot more work with little advantage (most people just want to make the game and not worry about the HAL interfaces and getting everything to play nice with the OS).
Going straight to DirectX is a perfectly valid option, although for only 2D, you probably need to know a bit too much about 3D graphics to effectively use it.
Back when I was into game development, I was quite fond of the Artificial Heart graphics engine, which was somewhat basic but incredibly easy to use. Unfortunately, the website appears to have been replaced with a parked domain. Perhaps the company went out of business. If so, it is a shame.
For a more extensive catalogue, take a look at the DevMaster game engine database
If you are looking for opensource community supported library, you can try
SlimDX
TAO framework -- opengl bindings for .Net framework
But am not sure if they are matured enough.. but its worth giva try..
I'm sure there are other options out there, but you can also take a look at SDL.Net, a .Net implementation for SDL.
To make the most of today's computers' hardware and to keep up with the graphics of other 2D games, I would go with a 2D-in-3D solution, based on DirectX or OpenGL. You would render sprites as so-called quads (two polygons combined to make a square.)
I personally think OpenGL is much more appropriate for a 2D game. You should definitely read through the NeHe tutorials (they're for C++, but the OpenGL parts are still valid. You can find a C# conversion of the code at the bottom of the page of each lesson.) as they are an awesome resource for getting started with making a simple graphics engine for your game.
Furthermore, a lot of the articles on GameDev have helped me a lot when developing games. They've got all sorts of articles that will help you along, ranging from adding lighting effects to your games to adding simple physics.
I use Gorgon (which uses SlimDX).
http://tape-worm.net/?tag=gorgon
There is always Unity. Uses Mono not MS.Net
http://unity3d.com/unity/
Related
As the title suggests it, I`m looking for the best solution for creating a 2D or a 3D graphic simulator. I need to build a program that simulates the behavior of some custom solar panels (how the rays fall on the surface of the panels, what happens if the panels are rotated etc). The main problem is that it has to be done in a very short amount of time and depending on how big the difference between the 2D and the 3D one will be (in terms of needed time for completion), I will choose the most appropriate solution. The program has to create also some charts based on the input data.
Thus, I`m interested looking for you suggestions in regard to which one of the aforementioned languages would provide the best and easiest to use tools (for both the 2D and the 3D one), and a good combination of the final code complexity, ease of the graphic design and final appearance.
If you don't have much time you should choose the language you know better.
Personally I'd go for python because I think it's a very productive language. To do the rendering I'd rely on the module pygame. Nevertheless there are numerous possible libraries that can do what you need. I've used XNA a while ago and it was a real pleasure. Especially its support for 2d graphics is excellent. On the bottom-line I guess it boils down to this:
Python is "working pseudo code". It will allow you to code the logic very efficiently. Pygame however is a 3d game library. It's great for creating games and visualizations but you'll have trouble to make a nice gui.
C# is a little more "heavy" than python. You'll definitely end up writing more code, just in terms of the number of lines. XNA + WPF is a powerful combo though and has very good tools - VisualStudio has a great gui designer
I haven't tried graphics in python yet, but worked with XNA Game Studio (for .Net framework) for a while and think that it's quite easy to use and powerful. So it's worth to have a look. Never mind its name, it's not only for games.
I don't know much about C#, but Python has quite a number of modules that you probably could use. Someone already mentioned Pygame, for 3D visualization you can use for example Vpython or Panda3D. There is a nice lists of 3D software for Python or written in Python at this website.
I was wondering about the performance of using XNA in C# for developing games and not using it. Could I not use PictureBoxes instead of 2D Textures? Is it viable to go with Windows Form programming for games, or is XNA the best solution? Any advantages/disadvantages?
The more complex your game is the less likely you'll find WinForms development sustainable. XNA is geared towards that sort of thing so why not use it?
The real question you should ask yourself is "do I want my game to run on Windows Phone 7, XBOX 360, and/or the Windows desktop?" If your answer is yes then learn XNA. The best thing is it does most of the work for you to allow you to target these different platforms.
I recommend listening to a recent podcast by Scott Hanselman on the topic: Hanselminutes Podcast 240 - Developing Indie Games for Xbox 360 and XNA with George Clingerman.
It depends on your game's graphics complexity.
If you want to learn a good library that allows to make high-end games with good graphics, use XNA; it'll open more variety to your flavor.
But if you want to make a simple non-scrolling, Tetris-like, or solitaire games, double-buffered .NET controls can do the trick.
Use XNA. Aside from having significantly better performance, better supported platforms (Xbox 360, Windows Phone), other API niceness like sound and input handling, there is one very important reason:
XNA is an "immediate" style API (as opposed to a retained one; see this description).
Developing games with this type of API is significantly eaiser. The reason being, without getting into too much detial, is that in a retained API you have to ensure the external scene stays in sync with your game state. This is tedious and bug-prone (believe me, I've done it).
If you are looking for the best performance, you shouldn't be looking at c# or XNA at all, the lower level you go the better in that regard. However, lower level means you will spend more time on the programming with less results.
XNA was developed to make game programming easy. It takes a lot of the tedious low level coding and wraps it up in nice simple methods for us to call so that we don't have to deal with reinventing the wheel, while still harnessing a very powerful framework.
I'd highly suggest if you are interested in making a game, go with XNA. I think you will enjoy it much more than the alternatives.
I want to learn about programming 2D games in C#. What are the best tutorials that are beginner oriented, written for C#, and preferably use GDI+ (or something equally simple)? I am relying on the experience this community has to direct me towards the best.
Books
Beginning .NET Game Programming
Beginning C# Game Programming
Links
Coding 4 Fun is a great .NET resource that has quite a few user-created games. They also have a book and a 2-D game primer
Tutorial Listing at C# corner
C# Game Tutorial for Beginners (video)
Link to more game programming e-books
Advanced Topics
The Farseer Physics Engine on Codeplex would be a good next step once you get comfortable with programming games. You could even end up contributing to the project if you like it enough. I'm sure they'd appreciate the help.
I watched these DNR TV episodes recently and thought they were very well done and informative.
http://www.dnrtv.com/default.aspx?showNum=165
http://www.dnrtv.com/default.aspx?showNum=166
These focus on XNA, which is definitely where I'd start if I was planning on creating a game. Their tutorial take you through:
creating a 2D game with:
collision detection
texture creation and usage
geometry creation
physics simulation (They use an open-source physics engine and show you how to use it)
If you haven't heard of XNA:
The framework runs on a version of the Common Language Runtime that is optimized for gaming to provide a managed execution environment. The runtime is available for Windows XP, Windows Vista, Windows 7, and Xbox 360 [also can be played on Zune HDs].
XNA attempts to free game developers from writing "repetitive boilerplate code" and to bring different aspects of game production into a single system. wikipedia
Even if you don't want to use XNA, I think these videos will help learn about the concepts and techniques common to most (if not all) game dev. Oh, and it's all C# :)
Good luck!
This link seems reasonable ( if a little verbose ) - it's takes you through how to code a simple tetris-like game in c# using GDI+. I has code listings and links to download the source code.
I would start with learn a little object oriented architecture - this is a key to your ultimate success.
Then learn how to design the model - the entities in the game (characters and etc) in code
and the view - the 2D representation of them, and how to connect the two (data and command binding).
I would try using WPF and not GDI+.
The code project has a lot of good articles for beginners.
I would take a look at SDL.Net it's a pretty good games library for .NET (well a binding to a good library for the pedants ;))
It has a lot of resources on its pages right from beginner stuff to more advanced things like isometric engines etc.
It doesn't seem to have been very active for a while however what is there already is more than enough for even complex 2D games.
Hey stackoverflow Community!
I learned the basics of C# (i can write some Form-Applications) and now I want to learn how to write 2d games. I don't know where to start.
Is there a engine that's good for 2d games? After learning the basics of 2d I'll want to write simple games which work under windows and linux (that whould be cool, linux :) ).
I asked a friend who is into programming and he said I should use XNA with C# (but that would only work on windows). After googleing I found out that OpenGL with C++ whould be best to write games for linux, since there is no DirectX/XNA. And I haven't used C++ yet, that whould take some time to learn, again.
Is there something you can suggest? Maybe an other engine? I just installed XNA and took a look at the demo game (Platformer), that code isn't hard at all. Is XNA good for 2d games?
Take one step at a time. When you're starting out you don't need your code to work on every platform. It doesn't matter whether it uses OpenGL or DirectX, because you're going to have your hands full creating a game to run on one platform with one graphics API.
Second, don't worry too much about "engines". You don't need an engine to make a game, and often, it'll be more trouble than it's worth. The whole obsession with "engines" is fundamentally a bad idea. If you try to get one single software component to support every bit of functionality you need for a game, then it's not going to be worth using for any of them..
All you need is:
a programming language you're comfortable with. It sounds like this is C#, so stick with that.
Some way to put graphics on the screen. The .NET library can do that to some extent, but some higher level library will probably make it easier. You could use XNA or SlimDX or another Direct3D wrapper. Or you can give SDL.NET a shot. Or you can write your own. The capabilities you're going to need are pretty basic and every graphics library, 2d or 3d, will let you do it.
You especially don't need anything which is "good for 2D games". XNA is able to put graphics on the screen, so it does what you need. If you also understand the code required to use it, then XNA is good enough. Don't bother trying to find the "best", or something that has "awesome for 2D games" as a selling point.
Probably the easiest and most accessibly platform is Flash. Easily distributable and rather quick to learn for games (judging by the sheer amount of flash games available on the web).
I agree with jalf. Don't start thinking about engines. Engines are a complex beast and considering your programming experience is small, it can get very overwhelming very quickly. There's a lot of stuff that goes into games and the design patterns that are involved in them tend to be much different from those of say a typical application. And OpenGL type of stuff gets very complex when you start talking about things such as hit detection.
Another direction you could take is instead of starting your own game from the ground up, you could try making a mod to something like Half-Life 2, or Unreal. That gives you a basic platform that you can change and see how it behaves. In the mean time you'd be viewing other people's code and seeing the intricacies of game development.
Here are a quick links I pulled off of a Google search with regards to flash gaming. I'm sure there are probably quite a few books available online as well with regards to creating a game in flash and other languages.
http://www.flash-game-design.com/
http://www.tutorialized.com/tutorials/Flash/Games/1
http://blog.onemorelevel.com/?p=12
Someone mentioned Flash, which is a good suggestion, but a bit expensive. If you'd like to do some Flash/AS3 development for free, I'd recommend playing with Flixel. You'll also need FlashDevelop, which is a nice (also free) IDE. The Flixel site has a lot of good resources to get you started.
If you're thinking about pursuing a future in graphics programming, I would pick OpenGL for the following reasons:
OpenGL is implemented on Windows, Mac, Linux, and even PlayStation 3. (extremely versatile)
Once you're comfortable with 2D programming, you can move onto 3D and stay with OpenGL.
OpenGL is equally as fast in terms of performance compared to DirectX.
C++ is a part of every collegiate-level programming curriculum.*
I think employers respect knowledge of C++ more than any other language.
The learning curve may be higher, but your time will be well-spent.
* If your college doesn't have C++ as a part of their programming curriculum, you are an outlier.
From my experience it's far better writing the basis of your game first in a form of simple application (perhaps text based) and then building graphics on top of that just by trying out bits and pieces from tutorials. That way you will always have a working skeleton that you can play around with and you don't immediately complicate yourself with all the graphics calls.
Other point is motivation: if you always have a working app it's far more satisfying to watch it slowly grow and develop rather than being frustrated by constant "works/doesn't work transitions" and always awaiting all the bits to come together to form something remotely complete.
As far as engines go: DirectX and OpenGL these days are kind of engines themselves. They let you do a lot of primitive work very easily (get a model from 3ds Max and load it into your app in 1-2 lines of code), for a small game you won't need anything else.
I also agree with MunkiPhD: Flash would be a very good platform for a 2d game. It's very simple and lets you get away with all the boring graphic programming. However, ActionScript-programming is not anywhere near "heavy-duty" programming with C-family languages and proper dev. platforms. ActionScript frustrates me every time I see it.
If you want to focus on 2D games and keep using C# for now, AND be able to have your friends play your games on Mac and PC, had you thought about using Silverlight?
Using Silverlight would get around some issues such as installation.
You might try a creating a few games in Silverlight and then after getting your feet wet you'd be in a better position to decide what other tools you'd like to learn next. With Silverlight 3.0 being recently released there is actually an influx of people trying to see how far it can be pushed for gaming, which might help you get questions answered. If you decide on this route you can post here or on sites like Silverlight.net
DISCLAMER: I'm not sure what the status of Silverlight for Linux
Flixel does rock - you can get a 2D game up and running with a minimal amount of code. You can find a detailed tutorial that steps you through the process of creating a simple platform game using Flixel here.
I am trying to build a raster drawing application using C# and so far I have not been able to locate any versatile light weight 2D graphics frameworks, or guides.
I was hoping a few of you would be able to give me a good head start because currently my choices are using GDI+ or WPF and that is about it :(...
Basically I need something simple that will provide me with the ability to create a Canvas, Layers, Brushes, and the ability to import/export all of these things. I have looked through several graphic applications to see how they implemented their tools and looked online for books and have come out with no knowledge about where to begin.
Thank You,
Andrew
You don't mention if you want to make a vector editor or a raster editor. I'm assuming raster.
If you don't have much graphics API experience, and just want to get something working as soon as possible, just go with GDI+. It is much simpler than WPF conceptually.
Both GDI+ and WPF can do what you want. Working with WPF will probably give better performance because it uses Direct-X for acceleration. It also uses a stored-scene paradigm, which may make a lot of drawing operations conceptually simpler. The learning curve is much higher than GDI+, though.
You could always use Open-GL, Direct-X, or unmanaged GDI. They all have good 2D performance. But you will have to make calls to unmanaged code.
Well, two things.
One, you can take a look at Paint.Net. It is a free .Net program for working with 2D Graphics. Using the plugin model, you may be able to solve whatever problem you are working on more easily.
Second, a good 2D graphics library is SDL.Net. It's a set of OO wrappers for the C SDL library, and makes drawing 2D images pretty easy. I don't know if it will offer support for all of the more "manipulation" questions you have, though.
If you are trying to learn 2D graphics, WinForms is much easier to learn than WPF. WinForms supports brushes, canvases, multiple graphics formats, file import/export, and such.
The Code Project site has many WinForms graphics tutorials, try starting here.
Piccolo 2D is a 2d gfx framework for Java and C#. Free, open-source. Provides a scene graph, etc. Zoomable. Looks good.
The XNA framework is easy use and performs well since it is actually just a wrapper for DirectX. The big advantage is that you can write all your code in managed C#. Have a look at this post on the xna forum to see how you can read out the display for export.
There is also the Tao framework, which allows you to use either OpenGL or SDL for your drawing needs. It also is a set of OO wrappers around each. There are quite a few tutorials out there on Google for getting started as well.
Tao Framework