Sign in to follow this  

APIs/libraries for a 2D online game

This topic is 3044 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone. I have several years experience with programming but much less with the specific APIs necessary for game development. I'm making a 2D online semi-RPG game, partly to get more experience but partly to make a game that could be very good and fun. On principle I'd like it to be as cross-platform as possible; I guess consoles or handhelds are out of the question but PC-wise at least. I'm not sure which APIs/libraries would work best for me. I've considered OpenGL, freeglut, SDL, SFML, OpenAL, Allegro, all the usual. The game will be 2D but I'd like the option to be able to rotate sprites and skew them to give a 3D impression; probably the best cross-platform way to do this would be using OpenGL. Sounds will be ogg and wav, possibly mp3. I'm also unsure of which networking engine to use (a lot of the small online games I've played appear to have huge speed/reliability problems here), or even which timer mechanism to use, since if I'm working cross-platform I can't use Windows functions. Boost or SDL maybe? Basically I'm looking for a push in the right direction. [Edited by - 92catchall on August 13, 2009 9:54:41 AM]

Share this post


Link to post
Share on other sites
If you pick SDL you'll be able to do everything you need. It already has the code implemented to be used across different platforms. There is a built in SDL timer also.

Share this post


Link to post
Share on other sites
I know, but I'm considering different options. My knowledge of these APIs is currently very limited and making this game is partly about learning them as I go along. For example, if I use OpenGL instead for the graphics aspects, that'll probably be more useful knowledge in the long run, and possibly more flexible/efficient, though in 2D, it probably doesn't matter. I don't particularly plan to ever do 3D but you never know.

So console/handheld compatibility would require a ton of work to add, right? And probably a costly license.

Also, can SDL and/or SFML do all of the following, in real time:
-Rotate sprites
-Apply coloring/lighting effects to sprites (universally, to every pixel)
-Do the skewing I mentioned?

The skewing is meant to give an effect sort of like the one in the lower right panel here, except using 2D sprites: http://i177.photobucket.com/albums/w224/WhoIsMrNate/pokemon-diamond-pearl_61.jpg (couldn't find a better example).

[Edited by - 92catchall on August 13, 2009 3:25:26 PM]

Share this post


Link to post
Share on other sites
As mmakrzem mentioned, SDL is about the best cross platform lib out there.

As far as the specific questions you are asking concerning skewing and color transformations, I don't know if the current SDL has native support for that. I haven't used SDL in about 4 or 5 years. What I can tell you, in support of SDL, is that it gives you easy direct memory access to your images, meaning you can make whatever adjustments you need to on the textures themselves. This makes, for instance, applying a lighting layer on top of your original texture quite easy.

This reminds me that I should go look up SDL again.

Share this post


Link to post
Share on other sites
How about Java? Its syntax is kind of simplified C++ and inbuilt user interface and networking libraries. Java also has the best backward compatibility I have seen, we have developed our game (http://isopuli.net/2009/index.php?id=0) for over decade and no code is obsoleted so far.

Share this post


Link to post
Share on other sites
Haaf's Game Engine would be something to consider if you're using C++. Alternately, you can look into other languages: Python, combined with Pygame or Pyglet, is a pretty good choice.

Share this post


Link to post
Share on other sites
Sorry guys, I forgot to mention that I was using C++. I considered using Python for the game but for a few general reasons (I actually can't remember what they were right now... probably just that C++ is so much more commonly used for game development) I decided to go with C++ instead. It's possible I could change my mind on this, since I haven't done that much coding yet.

Right now I'm tossing up between SDL and SFML, with Boost support and the option to switch to a third party networking engine, so I'll have to check out what each of those is capable of and probably give them both a quick spin. I know SDL is much older, so probably more reliable.

Share this post


Link to post
Share on other sites
Quote:
Original post by 92catchall
probably just that C++ is so much more commonly used for game development
Don't let that be the deciding factor - the massive inertia with respect to changing languages in large companies has little to do with the relative merits of the languages.
Quote:
Right now I'm tossing up between SDL and SFML, with Boost support and the option to switch to a third party networking engine
Neither of SDL or SFML have high-level networking support - I would suggest you go with something at least on the level of enet, and preferably even higher-level, such as RakNet.
Quote:
I know SDL is much older, so probably more reliable.
Don't fall into that trap either - SFML is *far* newer than SDL, easier to use, much safer (networking and threading in particular), and generally better designed.

SDL does of course have better platform coverage - but when was the last time you needed to port your game to Amiga, BeOS or 16-bit DOS?

Share this post


Link to post
Share on other sites
Thanks for the replies.

Quote:
Original post by evillive2
You could take a look at The Mana World for some inspiration as far as what libraries to use. It is more of an action RPG but I think you could easily learn from their accomplishments.

Yeah, one thing I've learned is that the hardest thing about any project is finishing it. Any project which managed to get itself finished has a few things to learn from.
Quote:
Original post by swiftcoder
Don't let that be the deciding factor - the massive inertia with respect to changing languages in large companies has little to do with the relative merits of the languages.

Legacy code has a lot to do with it too (for companies, not for me). I also chose C++ since I'm more familiar with it, and it has RAII. But if not C++, what? Python, maybe, but I can't really think of anything else I'd be interested in that has both the flexibility and speed required. I'm not terribly fond of Java or C#, and I don't want .NET dependency.
Quote:
Neither of SDL or SFML have high-level networking support - I would suggest you go with something at least on the level of enet, and preferably even higher-level, such as RakNet.

Yep, RakNet was my first choice there, although I'm shopping around for alternatives.
Quote:
Don't fall into that trap either - SFML is *far* newer than SDL, easier to use, much safer (networking and threading in particular), and generally better designed.

Speaking of threading, should I and do I have to use SFML's threading system, for multithreading between SFML components? Or can I go with a more proven, well known system, such as boost::thread? From the design of SFML, I'm not sure. Most likely, I can do whatever I want.

[Edited by - 92catchall on August 17, 2009 2:22:22 AM]

Share this post


Link to post
Share on other sites
SFML is better designed and better maintained than SDL in my opinion. I'm currently using SFML to build a simple 2D RTS and I absolutely love it. If you know or understand C++ and OOP in general you'll really appreciate SFML and the way it was designed. SFML is cross platform for Mac/Linux/Windows so I don't think you would have anything else to port to except for like DOS or amiga, etc.

Share this post


Link to post
Share on other sites

This topic is 3044 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this