Skip to main content
GameDev.net gamedev.net
🔒 Locked

2D .NET Game library?

Started by Pxtl Sep 12, 2005 at 8:36 PM 9 replies 3.9k views
Original Post
Pxtl
Pxtl
I'm getting back into gamecrafting after about a 5 year hiatus. My last game was VB sprite game - this time through I'm using C# and want to make it compatible with opensource platforms, so directX and suchlike is out. I'm considering SDL.NET, but I had bad experiences with PyGame being slow as molasses in the anything but the hardware mode that most guides say not to use.
-- Single player is masturbation.
Rob Loach
Rob Loach
SDL.NET is probably the best choice if you're coming from Visual Basic. C# is an excellent language no matter what your background. Heck, you can even use SDL.NET with VB.NET if you want. Jendave (the author of SDL.NET) has been very busy with making it compatible with Linux and Mac, you can check out The Absolute Newbie's Guide To SDL.NET on more information about that.

The limitations your talking about with PyGame are the results of the limitations from SDL. SDL uses bitmapped surfaces for rendering, therefore implementating rotations and zooming on these surfaces is slow. If you think your game requires a lot of complex rotations and scaling, you might want to go with OpenGL via the Tao Framework. SDL.NET implements use of SDL_gfx's rotozoom library for rotation and scaling of surface objects. Just be aware that those opperations are slow so you might want to cache the rotations in memory instead of doing the rotations realtime.
Rob Loach [Website] [Projects] [
Arydrall
Arydrall
This raises an interesting question.

I originally thought that the general slowness of PyGame was because of Python itself, not because of SDL. Soooooooo, which is it? Granted, this question is coming from a complete newbie, so I don't really know what the slowdown is. (besides, y'know, the virtual machine bit that Python implements)

Thanks! :D
Rob Loach
Rob Loach
The question you should be asking is "C# or Python". Both SDL.NET and PyGame use SDL for rendering so it doesn't really matter, although SDL.NET deals with a more high-level interface than PyGame and, of course, is CLS-compliant. Since you're coming from Visual Basic, C# might be a better step forward then Python. A lot is planned for the upcoming release...

Later on, after you're comfortable with SDL.NET, you could take a look at Boo, a CLS-compliant Python-inspired programming language. Check out SDL.NET SimpleExample using Boo. I've heard that an addin for Visual Studio is in development [cool].
Rob Loach [Website] [Projects] [
Wuntvor
Wuntvor
Quote:
Original post by Arydrall
This raises an interesting question.

I originally thought that the general slowness of PyGame was because of Python itself, not because of SDL. Soooooooo, which is it? Granted, this question is coming from a complete newbie, so I don't really know what the slowdown is. (besides, y'know, the virtual machine bit that Python implements)

Thanks! :D

Actually, it is both, as far as I know.. The problem is that rendering to the screen is pretty slow with SDL, at least a lot slower than using OpenGL for 2D stuff would be.
It's not that bad, however, as long as you don't do anything too fancy (such as rotations or zooming or the like), it will probably be enough.

Now, PyGames problem is this and additionally the slowness of Python, and combined it means you have to be very careful only to update those parts of the screen that need updating.
Pxtl
Pxtl
to clarify - my VB game was 5 years ago. I spent those 5 years getting my computer engineering degree. I'm coming from C++ and Python - but yes, I found that Pygame was quite slow in software mode - rendering some 100 small tiles once per frame had a limited framerate. I was wondering if there was anything platform-agnostic and yet fast.
-- Single player is masturbation.
Pxtl
Pxtl
Quote:
Original post by Rob Loach
The question you should be asking is "C# or Python". Both SDL.NET and PyGame use SDL for rendering so it doesn't really matter, although SDL.NET deals with a more high-level interface than PyGame and, of course, is CLS-compliant. Since you're coming from Visual Basic, C# might be a better step forward then Python. A lot is planned for the upcoming release...

Later on, after you're comfortable with SDL.NET, you could take a look at Boo, a CLS-compliant Python-inspired programming language. Check out SDL.NET SimpleExample using Boo. I've heard that an addin for Visual Studio is in development [cool].


I've been considering Nemerle instead of C# actually, but I was hoping for proper IDE bindings. C# is so much better supported by IDEs.
-- Single player is masturbation.
Rob Loach
Rob Loach
Quote:
Original post by Pxtl
I've been considering Nemerle instead of C# actually, but I was hoping for proper IDE bindings. C# is so much better supported by IDEs.
Wow, I hadn't even heard of Nemerle. I'll make a note of it for future use. If you're just learning, it might be a better idea to learn C# before you jump into Nemerle as they say it's mostly similar to C# then anything. Looking at the differences between Nemerle and C#, C# looks like it's a bit easier to understand [wink].

About a month ago, I made up a test program that included any number of moving, rotating surfaces being rendered realtime. You would increase the number by pressing up and decrease it by pressing down. It was at a constant 60 FPS at about 120 moving and rotating surfaces so I tried it without the rotations and I couldn't find the FPS cap without the rotations because I gave up just after it got to 500 moving surfaces. Once I get the time, I'll write up the test again and see how it does.
Rob Loach [Website] [Projects] [
Pxtl
Pxtl
That's just what I wanted to hear. I'd some funky stuff with particle-trails in mind, but 120 objects shouldn't strain things at all, and rocket trails don't need rotation. And I already know C# and want to use Nemerle, but I think I might stick to C# for the better IDE support.
-- Single player is masturbation.
Pxtl
Pxtl
Quote:
Original post by HopeDagger
Take a glance at the Trans2D library, which is a nice wrapper over Managed DirectX for easy-to-use 2D graphics development.


Hoping for something platform agnostic. Trans2d is dead sexy, but I'd like to be able to run my apps on *nix.

-- Single player is masturbation.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.