2D Graphics - Best library?

Started by
8 comments, last by FireNet 15 years, 3 months ago
Hi all, I'm planning a game that will involve some 2D (side-shooter) graphics. I have experience of 3D graphics in OpenGL, and I *could* in fact do the whole thing in orthogonal 3D - but I'm drawn towards sprites for simplicity and charm. Would OpenGL still be a good choice of library, or should I investigate DirectX? I'm not too worried about cross-platform compatibility, this game is a personal challenge. However, I'd like to do it 'properly', according to the opinions of the game development community. What's the standard for this sort of thing?
Advertisement
There is no "best" library; each library serves specific purposes and goals. Try looking at some 2D libraries, and decide which one will be best for you:

SFML (OpenGL), HGE (DirectX), Allegro (Software), SDL (Software), or others.
I'd just like to reinforce what _fastcall said; there's no such thing as a "best" library, just pick one that's suitable for the task at hand and get to work.

I personally quite like SFML and HGE (depending on whether you're looking for a highish level API (SFML) or something more like a complete engine(HGE)), and I'll add The PopCap Framework to the list of potential options (although if your shooter is going to involve lots of fast-moving objects it won't be as good as some other options).


Using OpenGL (or DirectX if you wanted to learn it) would also be a perfectly valid option should you choose to do so.

Take a look at some of the available libraries and engines and pick one that you're happy with. [smile]


----------
The moderator formerly known as 'Kaz': Why you shouldn't use Dev-C++

- Jason Astle-Adams

Hi

You can have a look at my engine ArcEngine.

If you need some *special* feature, 2 possibilities : You add it yourself (open source project) or ask for it :)
- Iliak -
[ ArcEngine: An open source .Net gaming framework ]
[ Dungeon Eye: An open source remake of Eye of the Beholder II ]
Apologies for the somewhat ambiguous/misleading title. I suppose what I really meant to ask was "Is using OpenGL a valid choice for 2D sprite-based games?" - I know there are a lot of libraries around but they tend to be suited towards different uses. For example, OpenGL has a lot of 3D capability - dynamic lighting, texture, normalization etc, and I'm unsure if it's just plain overkill for my purposes.

I also forgot to mention that I'll be writing the game in C++ (not that it's of particular importance in this query)
If you choose to use plain OpenGL, you can use GLFW as a convenient multiplatform library to create a window and get input, etc.

Keep in mind OpenGL might not be very friendly to 2d sprites, and you may run into and have to resolve some small issues. It is possible though.
Quote:Original post by m0nkfish
I suppose what I really meant to ask was "Is using OpenGL a valid choice for 2D sprite-based games?"
Yes, it is, if you're happy to use it go for it - if not, take a look at one of the other libraries we listed.

Quote:Originally posted by shurcool
If you choose to use plain OpenGL, you can use GLFW as a convenient multiplatform library to create a window and get input, etc.
SFML or SDL can also be used as windowing/input/etc. libraries if desired.

- Jason Astle-Adams

Thanks for your input, everyone. I think I'll investigate a few of the OpenGL-based libraries mentioned here and see if there's anything I think would be too difficult to do by hand(!) - the main aim of my game is to give me some broad experience in every area of game development.
In my opinion, niether OpenGL or DirectX would be the most optimal choice to begin with, unless of course it is your intent to follow up on them with later projects. For simply beginning to program games, you're probably like me, you want the library to cut the amount of cruft and code so you can actually get on snd start making your game. I haven't tried either of the two aforementioned libraries, but I've heard that DirectX requires you to do at least some Windows programming, and OpenGL requires a fair amount of learning before you can get up and go. If time isn't involved in your equation, go for whichever you think will be easiest for you. Do this by looking up some beginner tutorials and seeing which one you'd imagine yourself as most comfortable in. I don't know how they fair in respects to 2D work.

But 2D games are the specialty of SDL and Allegro, and if you just want to get in there and make a game, these two will do it for you. I've only ever messed around with SDL, but it's really documented well, and it's been treating me nice for the last 2 years. it's easily accessible in terms of how the library is implemented in C++. There are a lot of great tutorials made by Lazy Foo' Productions - http://www.lazyfoo.net/SDL_tutorials/index.php There's quite enough content to fill a small book even in code alone. SDL can also use OpenGL if need be.
You can also use FreeGLUT to handle your window creation and input. It's the same as glut... You will still be working with OpenGL.

The problem with DX is that you will have to download the SDK, set it up and use a bunch of code to set it up. OpenGL has a much simpler API, and as you are already familiar with it you can get coding your game faster.

A sprite can be a texture mapped quad, so OpenGL can handled sprites just fine. You can also use an alpha channel in your images for transparent or translucent areas, just make sure you setup the blending properly.


In any case since you are in the beginner's forum, the choice between DX or OGL is a simple one.... go with what easiest for you...

-

SFML is neat and does a fair amount of load lifting for you. I've been going over it documents and will be using it in a project I am working on.


But in my opinion if you are just starting out, it's a lot more fun to do things yourself.... you dont have any time constraints and you get to learn a lot of things about the important background details.
______________________________________________________________________________________________________
[AirBash.com]

This topic is closed to new replies.

Advertisement