Advertisement

Finding and Choosing Libraries for C++

Started by June 02, 2018 09:09 PM
6 comments, last by Iltis 6 years, 6 months ago

I've been wondering how to choose from what seems like a huge assortment of external C++ libraries. How do people choose what's best for them?

I know I need a 2D graphical library for my game, but I'm unsure what else could be useful. Is there an easy way to see what's available?

well I use opengl but there is also direct x

Advertisement
37 minutes ago, RidiculousName said:

I've been wondering how to choose from what seems like a huge assortment of external C++ libraries. How do people choose what's best for them?

I know I need a 2D graphical library for my game, but I'm unsure what else could be useful. Is there an easy way to see what's available?

There a lot of libraries, so pick what you feel is needed.

If it's just 2D you can look into SFML or SDL2 for C++. No reason to go into full openGL right away unless you have a need, plus both SFML and SDL2 can utilize openGL as well.

Both libraries have classes that deal with events, input, sound, graphics, and networking.

Programmer and 3D Artist

7 hours ago, RidiculousName said:

I've been wondering how to choose from what seems like a huge assortment of external C++ libraries. How do people choose what's best for them?

I know I need a 2D graphical library for my game, but I'm unsure what else could be useful. Is there an easy way to see what's available?

For a suggestive rather than exhaustive list, you can take a look at the external dependencies of FOSS engines and frameworks like Urho3D (scroll down to "Third-party libraries"), GamePlay, and Cocos2d-x. You'll see several FOSS libraries for physics, sound, graphics, and other purposes.

There are two very good resources for anything you seek in the C++ world

https://github.com/fffaraz/awesome-cpp

https://github.com/danistefanovic/build-your-own-x

Bjourne Stroustrup suggest to know what the code your using is doing in his lessons. He goes into detail explaining why it is important to read the functions you use from someone’s library and ensure they provide efficient and effective code. It’s always good to know what your adding to your project. As for what libraries to choose I would say decide depending on who you wish to target, some libraries are cross platform and others are not. As well as the features the library provides. as GDnet said, don’t get into an advanced graphics library if you just wish to do 2D because it will become too challenging. Hope this kinda helps give you a better backbone when choosing libraries :) 

Advertisement

A full list of C++ libraries might not help you at all, since there are so many. I doubt you want to spent weeks of reading every libraries description. You can narrow your scope step by step, though.

The first thing to consider when choosing libraries is the operating system you want your game to run on. Not every Library supports every OS, which invalidates the use of some of them right off the bat.

Then you have to make a very personal decision: Is your goal the game, or the journey (learning experience)? The former means that you most likely don't intend to spend much time on low-level hardware programming, without significant progress on your game per week. The latter could mean, that you want to know as much as possible of the code required to create a game, including the low-level stuff. In short, how code affin are you?

Depending on your code-affinity you can use

  • Libraries: different libraries for different things (e.g. a library for input, one for sound, one for graphics, ....), not necessarily cross-platform friendly
  • Frameworks: a collection of pre-combined libraries, as well as cross-platform compatibility (e.g. SDL, Monogame, SFML, ...)
  • Engines: which have 'pre-connected' libraries for audio, video, input, .... as well as a GUI and tools to aid development, like Source Control or  Pick'n'Place Map-editors (e.g. Godot, Unreal Engine, ...)

The provided functionality tends to get more abstract with each step down that list. That means you have to do a lot of 'boilerplate' and 'platform'-code yourself when using only libraries, to connect all these services. You'll have much more control over your project like this (and even more, if you use no libraries at all, but that's just nuts). It will most likely take way longer to finish your game, though.

An Engine like Godot on the other hand just provides all of these functionalities as a bundle, and you don't have to worry about connecting audio, video, input and Library compatibility.... Engines are potentially easier to learn and shorten development time (unless you have a hard time learning and accepting that the 3rd party doesn't tell you everything that happens).

When you've made your choice on HOW you want to program, there's not much left to do. If you want to use e.g. libraries, just google 2D-library, Audio-library, ... and pick one of the top 5 google results. There's a reason they are up there; and pay attention to community activity (a dead community cannot help you in times of need).

 

This topic is closed to new replies.

Advertisement