Learn to use additional APIs/libraries!

Published May 30, 2013
Advertisement
I'm coding my game in C++. I chose to go this route because I have learned some over the years and C++ is mostly what I've learned with. I've done previous small projects with it as well.

Once upon a time, as a newbie, I was incredibly insistent on learning how to do everything myself. It didn't matter to me that I was constantly reinventing the wheel, as they say, as I just told myself I was learning. Why should I use std::list when I can make my own linked list class? Sure mine is error prone, horribly inefficient, and has half the functionality of std::list... but its mine! I must've created several different "button" classes as well. I told myself each time that it was better than the last one and therefore worth it... but I would wager that none could hold a candle to what was freely available to use both at the time and now.

Now, I'm a stubborn person, I freely admit that. I'm the kind of person that does things the hard way purely to spite those who tell me not to. That said, I also like to think I learn from my mistakes.

In my current project, I'm using C++. I'm using SFML 2. I'm also using SFGUI for my menu system, and while it isn't implemented in my game yet, I intend to also use the Thor library for further graphical effects on top of SFML. I've implemented Boost and make liberal use of all that the standard library has to give me. I will also not hesitate to bring in additional resources as I go.

When you start to incorporate additional resources, you will have linker errors, nothing will compile, the new resources won't make sense to you, you'll have to learn a whole new way of thinking about certain things that may or may not be the way you prefer to think about it. Before to long you'll have to learn how to compile a library on your own. But, I'm here right now to say to you It is absolutely, positively, no question about it, worth every second of your time.

If your goal is to create a finished game, this is the way to go!

A few disclaimers:

No, I'm not trying to say that learning how things work isn't valuable, I'm talking from the perspective of someone whose goal is more towards creating a finished product.

Also, whenever using some 3rd part library, make SURE you are familiar with the licensing terms and understand what is expected of you should you ever have a finished product you wish to release commercially.
1 likes 2 comments

Comments

Bacterius

The NIH was strong in this one.. :) I think one argument against mindlessly piling on additional libraries into your program is to limit the number of dependencies, which isn't usually a problem but can become irritating. I've come across a few github projects which I wanted to build and play with but gave up after looking at the frankly daunting list of external dependencies, as if they picked every function they use out of 10+ distinct libraries at random.

For small utility programs and other POC's which people can compile on the fly, I prefer to do most of the stuff myself (well, I mean, I'm not going to reimplement the standard library but I will not pull in a dependency and complicate the code and build process when I can confidently do the same thing myself unless it's a static, non-intrusive header-only library, e.g. an XML parser is a good candidate for a "friendly" dependency).

However when it is reasonable to do so (especially on long-term projects) extensively using libraries is definitely the way to go and is certain to save a lot of time (and make you feel more productive). Reinventing the wheel is fine, especially if you want to learn, but inventing a square wheel, trying to drive with it, and missing your deadline is not particularly smart and will even get you discouraged as you won't see any progress.

And of course learning as many API's as possible increases your immediate value as a developer as you are familiar with more technologies, which is never wasted on anyone.

June 01, 2013 07:35 AM
Plethora

All points definitely true. :)

I think my main point is aimed towards beginners. Speaking for myself, in the beginning I tried to do everything myself because I was under the false impression that pulling in additional libraries was always going to be insanely hard to do. I remember getting very frustrated once just trying to use Boost because I didn't have any real understanding of the differences between compilers, versions, or even a real clue about what linking was and how it worked (nevermind the difference between static and dynamic linking). So for a long time I didn't try.

Obviously though, a lot of those lessons are things you have to learn once and only once. I think a good analogy for what I'm trying to get across is that imagine you're a carpenter. You have a saw, hammer and nails, screwdriver, etc. Those things will get your jobs done eventually, but there's this big locked door and behind it there's a nailgun, a circular saw, and a power drill. Getting the key to that door means jumping through a lot of hoop and getting frustrated with things that don't make sense, but you only have to do it once and then you have access to those things forever. Sure, there will still be times that a hammer and nails are the best tool for the job, but having the option to use a nailgun is never a bad thing even if you choose not to.

:)

June 01, 2013 02:44 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement