• Advertisement
Sign in to follow this  

Absolute beginner question regarding APIs, frameworks, libraries...

This topic is 1928 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, I've been learning C++ for some time now and I would like to make a basic game. But I have some questions about game programming in general - I really don't know the difference between (or the uses of) things like DirectX, OpenGL, etc.

From what I understand, DirectX and OpenGL are APIs... what exactly is an API, why/when would you use them for a game? What is something like XNA, then?

Further on, from what I understand, things like SDL and SFML are libraries - how are they separate from things like DirectX and OpenGL, are they used together/in conjunction? When would you use one over the other?

Finally, there's Unity, which from what I understand is an engine. So can you just use something like Unity to make a game and ignore the rest?


Share this post

Link to post
Share on other sites

It's true that there's no need to get bogged down in terminology. But sometimes the best way to avoid that is to get answers to your questions.

The term "Library" refers to a specific way functionality can be packaged for use by the application programmer.

Specifically, in a compiled language like C++, a set of functionality is compiled to object code (i.e., "link-able" .obj files), and made available in an "archive" or "library", which on windows is a .lib file (.lib files essentially contain a bunch of .obj files). The application programmer generally "includes" provided header files which declare functions and types implemented in the library, uses them in code, and links the library into the executable.

The term "library" says nothing about what type of functionality is provided, or what it might be used for.

As mentioned, API means "Application Programming Interface". "API" generally refers to a library, but is named for the interface (i.e., the contents of accompanying header files) to which the application code will be written, rather than the implementation in the library.

The phrase, "Application Programming" implies that the functionality provided is specific for creating some certain type of application. The Windows API is used for making Windows applications; The OpenGL ("Open Graphics Library") API is used for making graphical applications; Etc. APIs often deal with how the application interacts with the outside world - how it gets input and/or generates output.

In general, an API is a library but a library is not necessarily an API. The C++ standard library, for example, is mostly functionality for a program's internal processing. It's not designed for giving an application access to, or control over, any specific platform/environment.

A game engine is a unified set of run-time software technology designed to provide a good portion of the core functionality of a game. The thing that makes it an engine, is its frame-based multi-tasking nature. The thing that makes it a game engine is all the basic functionality it delivers that makes it useful for building games. (OpenGL and Direct 3D are not engines, for example. They provide nothing but a way to get graphics on screen.)

While not technically part of the engine itself, most engines would be useless without a set of accompanying tools for generating content specific to that engine, so a tool-set is sometimes thought of as part of the engine.

The term "engine" says nothing about how the functionality is delivered. It could, for example, be delivered as a set of libraries, or as source code for a sample game "stub". If it's a set of libraries, they could be considered an API for developing applications on that engine.

The "Open Graphics Library" is a cross-platform API for putting graphics on-screen.

Providers of all sorts of different platforms, that have graphics rendering ablilty, can implement the library for their platform. All implementations of the library work with the published OpenGL interface. That way, applications programmers can write applications using that interface, and they'll build and work on various different platforms, without alteration.

Direct X
Direct X is a Microsoft API for developing "multi-media" applications on Microsoft platforms. In addition to Direct 3D (their graphics API), it includes other components like Direct Sound and Direct Input.

SDL & SFML are video games APIs.

They provide facilities for such things as audio output, input acquisition, networking, threading, timing, etc. They work with, or along-side, OpenGL.

I don't really know much about Unity, but in general, any robust game engine will include all of the functionality provided by the graphics and video games APIs, and more (e.g., physics, collision, AI, game objects/entities, message passing, asset handling, load/save, GUI/menus, etc.).

Edited by vreality

Share this post

Link to post
Share on other sites
As mentioned above I also agree but I can relate to the whole fuzziness. API's are a collection of libraries like as Windows API. What is a Windows API - it just that a collection of headers files, library files and whamo. DirectX is a API (Application Programming Interface) - a collection of libraries headers to create a DirectX Game. SDK is Software Development Kit - just as described is collection of libraries and header files to develop the software. Framework like .NET Framework is like a tree heirchy. System is a namespace that is used in CLI and C#. System::IO stems from System namespace - etc... You get the point! :)

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement