Search code examples
c#graphics.net-4.0gdi+system.drawing

System.Drawing Fast Enough For 2D Game Programming?


Say I am making a 2D Tile Based game in C# using System.Drawing for graphics.

OOP Layer for GDI?

The System.Drawing namespace provides access to GDI+ basic graphics functionality. ~ MSDN

Back when I was starting out Graphics & Game programming in C, a lot of books such as this one taught me that a software-rendered API like GDI was not efficient enough for Double-Buffered 2D games running at a decent FPS. So does Microsoft .NET's System.Drawing implementation fall into the same category? Does it use GDI & GDI+ under the hood, or can it use a different, faster backend?

How Much FPS Can I Hope For?

Even if System.Drawing can only use GDI, is it impossible to make a game run at a decent Frame rate, say 50-60 frames per second, with GDI?


Solution

  • It's not really a question of it being fast enough as it is it being suitable for the task you want to perform. In all honesty, it's quite easy to implement basic functionality to do the drawing you require using for instance XNA, and you get so much for free. There is simply no reason to go into System.Drawing for making games.

    The book you linked in quite ancient, while it contains a few algorithms that never goes out of style most of it is really outdated.

    As to how much FPS you can get from System.Drawing, you can probably get enough FPS from it from a simple tile based game. It's going to work if you do it that way, but it will hinder you from making real progress later on - especially as the threshold for making games using XNA is so low these days.